nagios监控iostat

1.下载check_iostat插件并上传到客户端的/usr/local/nagios/libexec目录中,下载地址:
#wget http://exchange.nagios.org/components/com_mtree/p_w_upload.php?link_id=3379&cf_id=24
2.授予权限
# chmod +x /usr/local/nagios/libexec/check_iostat
# chown nagios. /usr/local/nagios/libexec/check_iostat
3.测试是否可用
# ./check_iostat -d sda -w 100 -c 200
OK - I/O stats tps=0.31 KB_read/s=5.94 KB_written/s=6.66 | 'tps'=0.31; 'KB_read/s'=5.94; 'KB_written/s'=6.66;
4.测试完成后添加到nrpe.cfg中
# vi /usr/local/nagios/etc/nrpe.cfg
command[check_iostat]=/usr/local/nagios/libexec/check_iostat -d sda -w 100 -c 200
5.重启xinetd服务
# /etc/init.d/xinetd restart
Stopping xinetd: [  OK  ]
Starting xinetd: [  OK  ]
6.服务端添加命令
# vi /usr/local/nagios/etc/objects/commands.cfg
define command{
        command_name    check_iostat
        command_line    $USER1$/check_iostat -d $ARG1$ -w $ARG2$ -c $ARG3$
}
7.服务端添加服务  
# vi /usr/local/nagios/etc/services/mail_156.cfg
define sevice{
        use     generic-service
        host_name       mail_156
        service_description     check-iostat
        check_command   check_nrpe!check_iostat!sda!100!200
}
8.等会出现结果

nagios监控iostat

创新互联建站秉承实现全网价值营销的理念,以专业定制企业官网,网站设计、成都网站制作,重庆小程序开发公司,网页设计制作,移动网站建设营销型网站建设帮助传统企业实现“互联网+”转型升级专业定制企业官网,公司注重人才、技术和管理,汇聚了一批优秀的互联网技术人才,对客户都以感恩的心态奉献自己的专业和所长。

9.出错问题解决
[root@mail ~]# /usr/local/nagios/libexec/check_iostat -d sda1 -w 100 -c 200
/usr/local/nagios/libexec/check_iostat: line 54: sda1: command not found
/usr/local/nagios/libexec/check_iostat: line 55: sda1: command not found
/usr/local/nagios/libexec/check_iostat: line 56: sda1: command not found
/usr/local/nagios/libexec/check_iostat: line 60: bc: command not found
/usr/local/nagios/libexec/check_iostat: line 60: bc: command not found
/usr/local/nagios/libexec/check_iostat: line 61: bc: command not found
/usr/local/nagios/libexec/check_iostat: line 64: bc: command not found
/usr/local/nagios/libexec/check_iostat: line 64: bc: command not found
/usr/local/nagios/libexec/check_iostat: line 65: bc: command not found
OK - I/O stats tps= KB_read/s= KB_written/s= | 'tps'=; 'KB_read/s'=; 'KB_written/s'=;
提出54行到56行命令未找到,查看脚本的54行需要什么命令。我查找到是iostat未安装
# yum install -y sysstat
提示60行到66行bc命令未找到,需要安装bc命令
# yum install -y bc

本文名称:nagios监控iostat
文章地址:http://hbruida.cn/article/ppdssd.html