check_squid命令参数
Usage: url urluser urlpass proxy proxyport proxyuser proxypass expectstatus
url squid dst站点域名 如:
urluser 目标站点需要认证登录的用户名, 符号“-”代表没有
urlpass 目标站点需要认证登录的用户密码, 符号“-”代表没有
proxy squid cache服务器的IP地址或者域名
proxyport Squid cache服务器监听的端口,默认3128
proxyuser squid cache服务器需要认证登录的用户名, 符号“-”代表没有
proxypass squid cache服务器需要认证登录的用户名, 符号“-”代表没有
expectstatus HTTP协议返回的HTTP code, 符号“2”代表从2开始
测试
目标主机,squid cache服务器111.111.111.111,监听端口80
[root@count libexec]# ./check_squid - - 111.111.111.111 80 - - 2
OK - Status: 200 OK
# vi /usr/local/nagios/etc/objects/commands.cfg
#check_squid
define command {
command_name check_squid
command_line $USER1$/check_squid $ARG1$ $ARG2$ $ARG3$ $HOSTADDRESS$ $ARG4$ $ARG5$ $ARG6$ $ARG7$
}
#vi /usr/local/nagios/etc/objects/cdn-linuxtone.cfg
define service {
host_name www-cache3
service_description squid
check_interval 30
retry_interval 18
max_check_attempts 5
check_command check_squid!!-!-!80!-!-!2
}
检测无语法错误:
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Checking for circular paths between hosts...
Checking for circular host and service dependencies...
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...
Total Warnings: 29
Total Errors: 0
重启nagios服务,5分钟后测试状态成功!
阅读(710) | 评论(0) | 转发(0) |