監控路由器、思科交換機
因爲在交換機、路由器無法安裝監控客戶端,所以要用到snmp插件
查看
# vi /usr/local/nagios/libexec/下有沒有check_snmp插件,沒有則需要安裝。
一、安裝snmp服務
#yum install -y net-snmp net-snmp-devel net-snmp-perl net-snmp-utils mrtg
安裝snmp後要重新編譯安裝nagios插件nagios-plugins-2.0纔會在
/usr/local/nagios/libexec/下生成 check_snmp插件 [root@cache-2 ~]# tar -xvf nagios-plugins-2.0.tar.gz [root@cache-2 ~]# cd nagios-plugins-2.0 [root@cache-2 ~]#./configure --with-nagios-user=nagios --with-nagios-group=nagios --prefix=/usr/local/nagios --with-mysql [root@cache-2 ~]# make && make install
思科交換機:
系統測試:
check_snmp命令提供了詳細的使用說明,只需要在Linux命令行輸入 check_snmp –help即可查看幫助信息,這其中包括每一項參數的使用等。
這裏以檢測Cisco交換機的系統爲例,示範如何使用check_snmp。交換機爲Cisco 4500系列,系統描述的OID爲.1.3.6.1.2.1.1.1.0
[root@wardking libexec]# ./check_snmp -H 10.241.10.1 -o .1.3.6.1.2.1.1.1.0 -C public
SNMP
OK – “Cisco IOS Software, Catalyst 4500 L3 Switch Software
(cat4500-ENTSERV | K9-M), Version 12.2(53)SG2, RELEASE SOFTWARE (fc1)
建議用於Nagios監控的OID:
系統內存使用(5分鐘內)1.3.6.1.4.1.9.9.48.1.1.1.5.1
系統可用內存(5分鐘內)1.3.6.1.4.1.9.9.48.1.1.1.6.1
CPU使用率(5分鐘內)1.3.6.1.4.1.9.2.1.58.0
硬件狀態1.3.6.1.4.1.9.9.13
rosteros:
在RouterOS中啓用SNMP:
[admin @ MikroTik] / snmp> print 啓用:不 聯繫: 位置: 發動機ID: 陷阱社區:(不明) 陷阱版本:1[admin @ MikroTik] / snmp> set enabled yes
對象標識符(OID)
[admin @ MikroTik] / interface> print oid標誌:D - 動態,X - 禁用,R - 運行,S - 奴隸 0 R name = .1.3.6.1.2.1.2.2.1.2.1 mtu = .1.3.6.1.2.1.2.2.1.4.1 mac-address = .1.3.6.1.2.1.2.2.1.6.1 admin-status = .1.3.6.1.2.1.2.2.1.7.1 操作狀態= .1.3.6.1.2.1.2.2.1.8.1 bytes-in = .1.3.6.1.2.1.2.2.1.10.1 packet-in = .1.3.6.1.2.1.2.2.1.11.1 discards-in = .1.3.6.1.2.1.2.2.1.13.1 errors-in = .1.3.6.1.2.1.2.2.1.14.1 bytes-out = .1.3.6.1.2.1.2.2.1.16.1 packets-out = .1.3.6.1.2.1.2.2.1.17.1 discard-out = .1.3.6.1.2.1.2.2.1.19.1 錯誤超時= .1.3.6.1.2.1.2.2.1.20.1
上面是oid是接口流量這些的
下面是cpu和men的oid
配置文件:
define service{ use generic-service ; Inherit values from a template host_name routeros-xxxxx service_description cpu check_command check_snmp!-C public -o .1.3.6.1.2.1.25.3.3.1.2.1 -w 30 -c 50 }
轉載參考:
https://wiki.mikrotik.com/wiki/Manual:SNMP
http://www.net130.com/CMS/Pub/Tech/tech_zh/2011_07_13_89499.htm