[背景]
昨天看了一位兄弟写的nagios借助snmp监控Windows服务端,采取它的配置,可惜错误出的让人受不了......所幸就自己学起来,自己搞起来了.写个教程给那些一在配置文件上还有难度的朋友!~ [过程] 下载:[url]http:///search/?type_of_search=soft&words=nagios-snmp-plugins[/url] Requirements
(1) Perl in /usr/bin/perl - if not run 'perl script' or change the path in the scripts first line 系统默认都安装了perl,告诉脚本的perl解释器在哪里.where perl就知道了.如果在/usr/bin/perl就不用改脚本首行了,如果不是,那就要改脚本了.哈哈,感觉一般都不用动吧! (2)Net::SNMP 这个包需要下载安装的,网上教程很多,我用的是centos,直接yum -y install net-snmp (3)file 'utils.pm' in diretory /usr/local/nagios/libexec or change the line "use libs /usr/local/nagios/libexec/" in the scripts 一般情况下将插件放到nagios的libexec下吧,直接执行install.sh会有安装提示的. 看了doc下的Configuration examples
我们看下它说的 ========================================================================= If you are using snmp v2c : $USER7$=-C <community> -2 这样我们就可以直接使用了,而不用在服务定义下还要传递这个参数!~ ========================================================================== 修改 vi resource.cfg 追加 $USER7$=-C WOKAO -2 那么再定义命令
define command{ command_name check_snmp_proc command_line $USER1$/check_snmp_process.pl -H $HOSTADDRESS$ $USER7$ -n $ARG1$ -w $ARG2$,$ARG3$ } 再定义服务
define service { host_name Windows service_description check_process PRTG Traffic Grapher.exe check_period 24x7 max_check_attempts 4 normal_check_interval 3 retry_check_interval 2 contact_groups sagroup notification_interval 10 notification_period 24x7 notification_options w,u,c,r check_command check_snmp_proc!PRTG Traffic Grapher.exe!0!3 } 检查,再重启服务.基本完成工作!其他的插件和这进程监控一样的用法,如果不明白,你可以自己-h看下,或者看doc下的文档,很全的......足够你使用了,真是不会perl者又不想在windows端装插件的福音.....
[总结]
nagios功能真是越来越全了,从EMAIL报警,到web报警,声音报警,FIREFOX报警,再到更N的短信报警......哈哈,现在连在WINDOWS上装插件都不需要了.不过,各有优劣点.......希望大家能根据工作需要的不同来采取不同的方式......毕竟它很灵活嘛! 本文出自 “坏男孩” 博客,请务必保留此出处http://5ydycm.blog.51cto.com/115934/115711 |
|