Nagios监控check_http~
2012-04-21 05:30
330 查看
1,首先咱们先得在/usr/local/nagios/etc/object/command.cfg 关于check_http的指令的配置!
}
define command{
command_name check_http
command_line $USER1$/check_http -H $HOSTADDRESS$ $ARG1$
}
2,监控主机设定文件
}
define host{
use linux-server (继承模板中linux-server的监控参数)
host_name source.rui.com (主机名称)
alias source.ruicom (主机别名)
address source.rui.com(IP地址)
}
}
define service {
use generic-service
host_name source.rui.com
service_description Core-source.rui.com
contact_groups ops_admin
check_command check_http!-H source.rui -u '/opsmon/opsmon.htm' -s 'Qunar OPS monitor page' -A 'nagios cn1'
}
注释:在这里 主机名就是source.rui ,URL是'/opsmon/opsmon.htm' ,整个URL就是www.source.rui.com/opsmon/opsmon.htm' !!!!!!!!!
3,这里介绍一下监控http服务参数描述
check_http -H <vhost> | -I <IP-address> [-u <uri>] [-p <port>][-w <warn time>] [-c <critical time>] [-t <timeout>] [-L][-a auth] [-f <ok | warn | critcal | follow>] [-e <expect>][-s string] [-l] [-r <regex> | -R <case-insensitive regex>][-P string][-m <min_pg_size>:<max_pg_size>] [-4|-6] [-N] [-M <age>] [-A string][-k string] [-S] [-C <age>] [-T <content-type>]
常用参数
-H 用于虚拟主机,并可以增加端口。例如,test.com:10000
-I IP地址
-S 基于SSL连接。默认端口为443
-u URL地址
-w 警告响应时间 响应时间超过指定时间则显示WARNING
-c 临界报警响应时间 响应时间超过设定时间则显示CRITICAL
-p 端口设定
-e 监测服务器反馈的第一行(状态)信息是否包含匹配字符
-N 不读取body部分,在读取header信息
-t timeout时间值
-v 显示服务器反馈的所有信息
-r 正则表达式匹配反馈页信息
-R 同上,但可以不考虑大小写问题
--invert-regex 反馈信息中包含字符则报警
-L 反馈信息包含URL link
-a 对需要基础认证的,提供用户名和密码,获取反馈值
}
举例:
1.监控192.168.9.4机器http服务使用情况
/usr/lib64/nagios/plugins/check_http -I 192.168.9.4
HTTP OK: HTTP/1.1 302 Found – 619 bytes in 0.009 second response time |time=0.008873s;;;0.000000 size=619B;;;0
2.监控192.168.120.2机器http9090端口服务的使用情况
/usr/lib64/nagios/plugins/check_http -I 192.168.120.2 -p 9090
HTTP WARNING: HTTP/1.1 403 Forbidden
3.监控192.168.120.2机器http9090端口服务的使用情况,当http返回200,403时,nagios返回OK
/usr/lib64/nagios/plugins/check_http -I 192.168.120.2 -p 9090 -e 403,200
HTTP OK HTTP/1.1 403 Forbidden – 389 bytes in 0.004 seconds |time=0.003794s;;;0.000000 size=389B;;;0
4.监测www.twitter.com能否访问;
/usr/lib64/nagios/plugins/check_http -H www.twitter.com
CRITICAL – Socket timeout after 10 seconds
5.监测http://123.112.137.221:10009/nagios/能否访问;
/usr/lib64/nagios/plugins/check_http -I 123.112.137.221 -p 10009 -u /nagios/
HTTP WARNING: HTTP/1.1 401 Authorization
6.检测http://www.abc.com/search.aspx?name=abc&id=100能否访问
/usr/lib64/nagios/plugins/check_http -H www.abc.com -u “/search.aspx?name=abc&id=100″
HTTP OK: HTTP/1.1 301 Moved Permanently – 486 bytes in 0.567 second response time |time=0.567176s;;;0.000000 size=486B;;;0
本文出自 “生锈的老枪_技术博客” 博客,转载请与作者联系!
}
define command{
command_name check_http
command_line $USER1$/check_http -H $HOSTADDRESS$ $ARG1$
}
2,监控主机设定文件
}
define host{
use linux-server (继承模板中linux-server的监控参数)
host_name source.rui.com (主机名称)
alias source.ruicom (主机别名)
address source.rui.com(IP地址)
}
}
define service {
use generic-service
host_name source.rui.com
service_description Core-source.rui.com
contact_groups ops_admin
check_command check_http!-H source.rui -u '/opsmon/opsmon.htm' -s 'Qunar OPS monitor page' -A 'nagios cn1'
}
注释:在这里 主机名就是source.rui ,URL是'/opsmon/opsmon.htm' ,整个URL就是www.source.rui.com/opsmon/opsmon.htm' !!!!!!!!!
3,这里介绍一下监控http服务参数描述
check_http -H <vhost> | -I <IP-address> [-u <uri>] [-p <port>][-w <warn time>] [-c <critical time>] [-t <timeout>] [-L][-a auth] [-f <ok | warn | critcal | follow>] [-e <expect>][-s string] [-l] [-r <regex> | -R <case-insensitive regex>][-P string][-m <min_pg_size>:<max_pg_size>] [-4|-6] [-N] [-M <age>] [-A string][-k string] [-S] [-C <age>] [-T <content-type>]
常用参数
-H 用于虚拟主机,并可以增加端口。例如,test.com:10000
-I IP地址
-S 基于SSL连接。默认端口为443
-u URL地址
-w 警告响应时间 响应时间超过指定时间则显示WARNING
-c 临界报警响应时间 响应时间超过设定时间则显示CRITICAL
-p 端口设定
-e 监测服务器反馈的第一行(状态)信息是否包含匹配字符
-N 不读取body部分,在读取header信息
-t timeout时间值
-v 显示服务器反馈的所有信息
-r 正则表达式匹配反馈页信息
-R 同上,但可以不考虑大小写问题
--invert-regex 反馈信息中包含字符则报警
-L 反馈信息包含URL link
-a 对需要基础认证的,提供用户名和密码,获取反馈值
}
举例:
1.监控192.168.9.4机器http服务使用情况
/usr/lib64/nagios/plugins/check_http -I 192.168.9.4
HTTP OK: HTTP/1.1 302 Found – 619 bytes in 0.009 second response time |time=0.008873s;;;0.000000 size=619B;;;0
2.监控192.168.120.2机器http9090端口服务的使用情况
/usr/lib64/nagios/plugins/check_http -I 192.168.120.2 -p 9090
HTTP WARNING: HTTP/1.1 403 Forbidden
3.监控192.168.120.2机器http9090端口服务的使用情况,当http返回200,403时,nagios返回OK
/usr/lib64/nagios/plugins/check_http -I 192.168.120.2 -p 9090 -e 403,200
HTTP OK HTTP/1.1 403 Forbidden – 389 bytes in 0.004 seconds |time=0.003794s;;;0.000000 size=389B;;;0
4.监测www.twitter.com能否访问;
/usr/lib64/nagios/plugins/check_http -H www.twitter.com
CRITICAL – Socket timeout after 10 seconds
5.监测http://123.112.137.221:10009/nagios/能否访问;
/usr/lib64/nagios/plugins/check_http -I 123.112.137.221 -p 10009 -u /nagios/
HTTP WARNING: HTTP/1.1 401 Authorization
6.检测http://www.abc.com/search.aspx?name=abc&id=100能否访问
/usr/lib64/nagios/plugins/check_http -H www.abc.com -u “/search.aspx?name=abc&id=100″
HTTP OK: HTTP/1.1 301 Moved Permanently – 486 bytes in 0.567 second response time |time=0.567176s;;;0.000000 size=486B;;;0
本文出自 “生锈的老枪_技术博客” 博客,转载请与作者联系!
相关文章推荐
- Nagios通过check_http监控一台web应用服务器上多个tomcat服务
- nagios通过check_http监控tomcat
- nagios使用check_http监控网页及用法实例
- nagios网页监控check_http
- nagios监控添加check_http服务
- nagios监控check_http出现403Forbidden
- nagios实例配置2-关于nagios 的check_http 监控报警的设置
- nagios使用check_http监控web server
- nagios监控需要验证的http服务
- nagios监控插件 nagios_oracle_health+check_linux_stats.pl
- Cacti+Nagios(七):Nagios监控windows(基于check_nt)
- nagios - remote check http
- nagios plugins之 check_http ZT
- MongoDB nagios check_mongodb插件监控
- Nagios通过check_megaraid_sas(基于MecaCli工具的插件)对RAID卡和硬盘进行监控的方法
- nagios监控nginx状态(check_nginx.sh)
- nagios+check_logifiles实现日志监控
- 修改Nagios的check_oracle脚本来监控Oracle的临时表空间
- nagios监控mysql(check_mysql)及内存使用率(check_mem) 推荐
- nagios使用check_mysql监控mysql