nagios 監(jiān)控 cisco 交換機(jī)
創(chuàng)新互聯(lián)服務(wù)項(xiàng)目包括梁平網(wǎng)站建設(shè)、梁平網(wǎng)站制作、梁平網(wǎng)頁(yè)制作以及梁平網(wǎng)絡(luò)營(yíng)銷策劃等。多年來(lái),我們專注于互聯(lián)網(wǎng)行業(yè),利用自身積累的技術(shù)優(yōu)勢(shì)、行業(yè)經(jīng)驗(yàn)、深度合作伙伴關(guān)系等,向廣大中小型企業(yè)、政府機(jī)構(gòu)等提供互聯(lián)網(wǎng)行業(yè)的解決方案,梁平網(wǎng)站推廣取得了明顯的社會(huì)效益與經(jīng)濟(jì)效益。目前,我們服務(wù)的客戶以成都為中心已經(jīng)輻射到梁平省份的部分城市,未來(lái)相信會(huì)繼續(xù)擴(kuò)大服務(wù)區(qū)域并繼續(xù)獲得客戶的支持與信任!一、環(huán)境:
1.已搭建好nagios4.0.8
2.Centos6.5 x86_64
二、需要有4個(gè)監(jiān)控cisco的腳本
check_snmp_cisco_ifstatus
check_snmp_cisco_loadavg
check_snmp_cisco_memutil
check_snmp_env
下載鏈接:http://down.51cto.com/data/2118262
三、配置
vim /usr/local/nagios/etc/objects/templates.cfg
define host{ name etnet-switch use generic-host check_period 24x7 check_interval 1 retry_interval 1/2 max_check_attempts 2 check_command check-host-alive notification_period 24x7 notification_interval 30 notification_options d,r contact_groups admins register 0 }
vim /usr/local/nagios/etc/objects/commands.cfg
##check cisco #define check_snmp_env define command{ command_name check_snmp_env command_line $USER1$/check_snmp_env -H $HOSTADDRESS$ -C $ARG1$ $ARG2$ } #define check_snmp cisco mem define command{ command_name check_snmp_cisco_mem command_line $USER1$/check_snmp_cisco_memutil -H $HOSTADDRESS$ -C $ARG1$ -w $ARG2$ -c $ARG3$ } #define check_snmp cisco cpu define command{ command_name check_snmp_cisco_cpu command_line $USER1$/check_snmp_cisco_loadavg -H $HOSTADDRESS$ -C $ARG1$ -w $ARG2$ -c $ARG3$ } #define check_snmp cisco if define command{ command_name check_snmp_cisco_if command_line $USER1$/check_snmp_cisco_ifstatus -H $HOSTADDRESS$ -C $ARG1$ -i $ARG2$ -w $ARG3$ -c $ARG4$ }
vim /usr/local/nagios/etc/objects/151.3.cfg
define host{ use etnet-switch host_name Office-192.168.151.3 alias Switch 151.3 address 192.168.151.3 } define service{ use generic-service host_name Office-192.168.151.3 service_description PING check_command check_ping!200.0,20%!600.0,60% normal_check_interval 5 retry_check_interval 1 } define service{ use generic-service host_name Office-192.168.151.3 service_description Uptime check_command check_snmp!-C public -o sysUpTime.0 } define service{ use generic-service host_name Office-192.168.151.3 service_description Port 1 Link Status check_command check_snmp!-C public -o ifOperStatus.1 -r 1 -m RFC1213-MIB } define service { use generic-service host_name Office-192.168.151.3 service_description Memutil check_command check_snmp_cisco_mem!public!90!95 } define service { use generic-service host_name Office-192.168.151.3 service_description LoadAVG check_command check_snmp_cisco_cpu!public!90!95 } define service { use generic-service host_name Office-192.168.151.3 service_description Environment check_command check_snmp_env!public }
添加監(jiān)控交換機(jī)
vim /usr/local/nagios/etc/nagios.cfg
cfg_file=/usr/local/nagios/etc/objects/151.3.cfg
重啟nagios
/etc/init.d/nagios restart
四、可能會(huì)報(bào)錯(cuò)
No output on stdout) stderr: Can't locate Net/SNMP.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /usr/local/nagios/libexec/check_snmp_env line 21.
問(wèn)題1:
perl -MCPAN -e shell
Can't locate CPAN.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl
/usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .).
解決:
yum install -y perl-CPAN*
問(wèn)題2:
No output on stdout) stderr: Can't locate Net/SNMP.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5
/usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at
/usr/local/nagios/libexec/check_snmp_env line 21.
解決:
perl -MCPAN -e shell cpan[1]> install Net::SNMP cpan[2]> quit
網(wǎng)上的解決方案
How do I install Net::SNMP perl module ? There are 2 ways of doing this
1) By CPAN (best)
on command line, as root :
[your_host]# perl -MCPAN -e shell
cpan shell -- CPAN exploration and modules installation (v1.76)
ReadLine support enabled
cpan> install Net::SNMP
If it's the first time you run CPAN, it will probably ask you some (simple) questions.
CPAN will also ask you to satisfy some dependencies (Crypt::DES, Digest::MD5, etc..).
2) "By hand"
Get the folowings modules (tar.gz format) on www.cpan.org
- Crypt::DES
- Digest::MD5
- Digest::SHA1
- Digest::HMAC
- Net::SNMP
for each one (you must install Net::SNMP at the end) :
tar zxf
cd
perl Makefile.pl
make test
make install
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。