nagios监控iostat

发布时间:2020-08-04 03:46:52 作者:charlie_cen
来源:网络 阅读:4124
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


推荐阅读:
  1. nagios 监控自身
  2. nagios监控服务

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

check_iostat nagios st

上一篇:sed使用小结

下一篇:for循环和shell数组小脚本案例

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》