nagios plugins之 check_http ZT
创始人
2024-07-24 08:21:55
0

nagios下的check_http ZT具体参数是一个比较重要的点,我带大家来看看。.

  //显示版本

  #./check_http -V

  check_http v2053 (nagios-plugins 1.4.13)

  //-H -u -p

  (不能直接-u写URL,用-u时要用-H;-u带的URL可以写全或相对)

 

  1.   #./check_http -H www.****.com  
  2.  

 

  HTTP OK HTTP/1.1 200 OK - 106540 bytes in 1.833 seconds |time=1.833151s;;;0.000000 size=106540B;;;0

 

  1.   #./check_http -H www.****.com -u /url1/url2/index.html  
  2.  
  3.   #./check_http -H www.****.com -u http://www.****.com/url1/url2/index.html  
  4.  
  5.   #./check_http -H www.****.com -p 80 -u http://www.****.com/url1/url2/index.html  
  6.  

 

  //-I

 

  1.   #./check_http -I xxx.xxx.xxx -u /url1/url2/index.html  
  2.  

 

  //-e ; 预期服务器返回的***行字串匹配

 

  1.   # ./check_http -H www.laabaa.com -e "200 OK" 
  2.  

 

  HTTP OK HTTP/1.1 200 OK - 106540 bytes in 1.736 seconds |time=1.736245s;;;0.000000 size=106540B;;;0

 

  1.   # ./check_http -H www.laabaa.com -e "200 notOK" 
  2.  

 

  HTTP CRITICAL - Invalid HTTP response received from host: HTTP/1.1 200 OK

  //-s ; 预期页面代码中的字串

  //-M ;检测页面的 Last modified时间,如1m,1h,1d等(分钟,小时,天);

 

  1.   # ./check_http -I 192.168.100.107 -u /cehq/zhishu.html -M 1m  
  2.  

 

  HTTP CRITICAL - Last modified 1:11:40 ago

  //-m :; 最小页面size(bytes):***页面size(bytes)

 

  1.   # ./check_http -I 192.168.100.107 -u /cehq/zhishu.html -m 100:200  
  2.  

 

  HTTP WARNING: page size 3466 too large|size=3466B;100;0;0

  //-w和-c;定义warning和critical的告警阀值(单元:seconds)

 

  1.   # ./check_http -I 192.168.100.107 -u /cehq/zhishu.html -w 0.0001  
  2.  

 

  HTTP WARNING: - HTTP/1.1 200 OK - 0.002 second response time |time=0.001646s;0.000100;;0.000000 size=3466B;;;0

 

  1.   # ./check_http -I 192.168.100.107 -u /cehq/zhishu.html -c 0.0001  
  2.  

 

  HTTP CRITICAL: - HTTP/1.1 200 OK - 0.002 second response time |time=0.001778s;;0.000100;0.000000 size=3466B;;;0

  // -N; 检查一个页面访问,为了获得较好的响应时间,不读取页面体,no-body:

 

  1.   # ./check_http -H www.ce.cn -u /index.shtml -N  
  2.  

 

  HTTP OK: HTTP/1.1 200 OK - 4300 bytes in 0.015 second response time |time=0.014826s;;;0.000000 size=4300B;;;0

  // -a; 以用户名密码访问一个需认证的页面:

 

  1.   # ./check_http -I 10.10.10.32 -u /nagios/  
  2.  

 

  HTTP WARNING: HTTP/1.1 401 Authorization Required - 717 bytes in 0.004 second response time |time=0.004006s;;;0.000000 size=717B;;;0

 

  1.   # ./usr/lib/nagios/plugins/check_http -I 192.168.10.2 -u /nagios/ -a nagios:nagios  
  2.  

 

  HTTP OK: HTTP/1.1 200 OK - 911 bytes in 0.005 second response time |time=0.004724s;;;0.000000 size=911B;;;0

  //-t;连接超时的时间(default:10seconds)

 

  1.   #./check_http -H laabaa.com  
  2.  

 

  HTTP OK HTTP/1.1 200 OK - 106540 bytes in 1.840 seconds |time=1.839614s;;;0.000000 size=106540B;;;0

 

  1.   #./check_http -H laabaa.com -t 1  
  2.  

 

  CRITICAL - Socket timeout after 1 seconds

  //-v;verbose,show details for command-line debugging

  以上常用的,没有post、header等相关的参数。

在应用nagios时,我们得多关心下check_http,这个功能非常好用!

【编辑推荐】

  1. Nagios图形化Pnp 安装和配置 ZT
  2. Redhat Nagios安装详解
  3. Nagios 配置文件解析
  4. Nagios安装笔记
  5. Suse 9 安装Nagios过程
  6. Nagios扩展的主机和服务监测

 

相关内容

热门资讯

如何允许远程连接到MySQL数... [[277004]]【51CTO.com快译】默认情况下,MySQL服务器仅侦听来自localhos...
如何利用交换机和端口设置来管理... 在网络管理中,总是有些人让管理员头疼。下面我们就将介绍一下一个网管员利用交换机以及端口设置等来进行D...
施耐德电气数据中心整体解决方案... 近日,全球能效管理专家施耐德电气正式启动大型体验活动“能效中国行——2012卡车巡展”,作为该活动的...
Windows恶意软件20年“... 在Windows的早期年代,病毒游走于系统之间,偶尔删除文件(但被删除的文件几乎都是可恢复的),并弹...
20个非常棒的扁平设计免费资源 Apple设备的平面图标PSD免费平板UI 平板UI套件24平图标Freen平板UI套件PSD径向平...
德国电信门户网站可实时显示全球... 德国电信周三推出一个门户网站,直观地实时提供其安装在全球各地的传感器网络检测到的网络攻击状况。该网站...
为啥国人偏爱 Mybatis,... 关于 SQL 和 ORM 的争论,永远都不会终止,我也一直在思考这个问题。昨天又跟群里的小伙伴进行...
《非诚勿扰》红人闫凤娇被曝厕所... 【51CTO.com 综合消息360安全专家提醒说,“闫凤娇”、“非诚勿扰”已经被黑客盯上成为了“木...