1.网站图片域名
[root@10-6-8-200 libexec]# more /usr/local/nagios/etc/webpage.txt http://radfile.example.info/201108/12/717_20110804012.mp3 http://tvcpic.example.info/smallpic/200309/12/030912_3774.jpg http://iadpic.example.info/200104/20010406/dang01040613.jpg http://wcresource.example.info/201002/23/79d3816e-5e49-40e3-966a-a40c47fca403_1.jpg http://odgpic.example.info/1304/sh/nearphoto/SHD007L01A0513041.JPG http://micepic.example.info/201207/25/11801343157855425.jpg http://pospic.example.info/201011/24/26629_9.jpg http://nadpic.example.info/200901/15/4953766_1.jpg
2.监控脚本
#!/bin/bash state_ok=0 state_warning=1 state_critical=2 state_unknown=3 WEBPAGE='/usr/local/nagios/etc/webpage.txt' web(){/usr/bin/wget $1 -O /tmp/down &> /dev/nullif [ $? -eq 0 ]thenecho "ok"return $state_okelseecho "$line is down"return $state_criticalfi } while read line doweb $line done < $WEBPAGE
3.脚本放在/usr/local/nagios/libexec下
chown nagios. check_webpage.sh chown nagios. check_webpage.sh
4.nrpe定义
command[check_webpages]=/usr/local/nagios/libexec/check_webpage.sh
5.主机定义
define service{use generic-servicehost_name varnishservice_description check-webpagescheck_command check_nrpe!check_webpages }
6.效果如下
转载于:https://blog.51cto.com/charlie928/1344133