|
今天在同事的帮助下,弄了个强大的监控存储设备性能的脚本,check_snmp_storage.pl
2,复制在/usr/lib/nagios/plugins/ 目录下
3,修改vi /etc/nagios/conf.d/test/services.cfg 该文件为我测试监控自己机器的服务配置文件,配置内容如下
define service {
host_name 102
service_description C: disk
check_command check_snmp_storage.pl!^C:!
use generic-service
}
define service {
host_name 102
service_description E: disk
check_command check_snmp_storage.pl!^E:!
use generic-service
}
define service {
host_name 102
service_description Physical Memory
check_command check_snmp_storage.pl!^Physical Memory!
use generic-service
}
define service {
host_name 102
service_description Virtual Memory
check_command check_snmp_storage.pl!^Virtual Memory!
use generic-service
}
我就用这个脚本一次监控自己机器4个参数 C盘,E盘,物理内存,虚拟内存的使用率 ,!^C:!和后面的$ARG1$对应
4,在/etc/nagios-plugins/config/test.cfg 自定义命令文件中添加如下内容
define command{
command_name check_snmp_storage.pl
command_line /usr/lib/nagios/plugins/check_snmp_storage.pl -H '$HOSTADDRESS$' -C public -m $ARG1$ -w 80% -c 90%
}
也可以用 -m $ARG1$ -w $ARG2$ -c $ARG3$ 来定义 ,以便可以在服务配置文件/etc/nagios/conf.d/test/services.cfg里做灵活的修改
5,重启服务/etc/init.d/nagios restart
附件:http://down.运维网.com/data/2356612
|
|
|