Nagios内存监控脚本使用方法
版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://gzmaster.blog.51cto.com/299556/63709 |
#!/bin/bash
# check memory script # sunny 2008.2.15 # Total memory
TOTAL=`free -m | head -2 |tail -1 |gawk '{print $2}'` # Free memory FREE=`free -m | head -2 |tail -1 |gawk '{print $4}'` # to calculate free percent
# use the expression free * 100 / total FREETMP=`expr $FREE \* 100` PERCENT=`expr $FREETMP / $TOTAL` echo "$FREE MB ($PERCENT%) Free Memory"
exit 0 #将上面的内容复制到/usr/local/nagios/libexec/check_mem.sh
#并用chmod a+x check_mem.sh 为这个插件添加执行功能 #在command.cfg中添加一项check_mem的内容如下 # 'check_mem' command definition
define command{ command_name check_mem command_line $USER1$/check_mem.sh -H $HOSTADDRESS$ } #接下来可以在services.cfg文件中添加了一项内存的监控如下
define service{ host_name nagios-server service_description check_mem check_command check_mem max_check_attempts 5 normal_check_interval 3 retry_check_interval 2 check_period 24x7 notification_interval 10 notification_period 24x7 notification_options w,u,c,r contact_groups sagroup } 记得最后测试一下配置文件
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg 本文出自 “gzmaster” 博客,请务必保留此出处http://gzmaster.blog.51cto.com/299556/63709 本文出自 51CTO.COM技术博客 |
附件下载:
另外的check_mem脚本,带警告和严重功能
另外的check_mem脚本,带警告和严重功能

fine102
博客统计信息
热门文章
最新评论
友情链接
