標籤:nagios snmp printer
Nagios以為其良好的狀態檢測機制,使Nagios可以利用在不同平台上的不同外掛程式實現監控,當然它也支援使用SNMP協議(簡易網路管理通訊協定)實現各個平台和裝置的監控,所以Nagios也可以使用SNMP協議來監控區域網路內的印表機,Nagios監控印表機是使用check_hpjd工具調用SNMP協議來監控印表機的,在安裝好的Nagios中的libexec外掛程式目錄下可能沒有,是因為伺服器上沒有安裝SNMP協議相關的依賴包net-snmp和net-snmp-utils,所以可以直接用yum或者是apt安裝下,再重新編譯下nagios-plugins,有一點像Nagios沒有安裝MySQL時沒有check_mysql一樣,操作如下:
[[email protected] nagios-plugins-2.2.1]# yum -y install net-snmp net-snmp-utils[[email protected] nagios-plugins-2.2.1]# ./configure --with-nagios-user=nagios --with-nagios-group=nagios[[email protected] nagios-plugins-2.2.1]# make && make install
此時再看libexec外掛程式目錄下就有check_hpjd外掛程式,印表機的監控方式有點類似於Nagios監控Windows上的NSClient++,可以參看http://jim123.blog.51cto.com/4763600/1956790,在Nagios配置好後就有列印的配置模板,同NSClient++中一樣修改下模板:
/usr/local/nagios/etc/objects/printer.cfgdefine hostgroup{ hostgroup_name network-printers alias Network Printers }######################################################################################## /usr/local/nagios/etc/servers/192.168.1.254.cfgdefine host{ use generic-printer ; Inherit default values from a template host_name hplj200 ; The name we‘re giving to this printer alias HP LaserJet 200dn ; A longer name associated with the printer address 192.168.1.254 ; IP address of the printer hostgroups network-printers ; Host groups this printer is associated with contact_groups admins }define service{ use generic-service ; Inherit values from a template host_name hplj200 ; The name of the host the service is associated with service_description Printer Status ; The service description check_command check_hpjd!-C public ; The command used to monitor the service check_interval 10 ; Check the service every 10 minutes under normal conditions retry_interval 1 ; Re-check the service every minute until its final/hard state is determined max_check_attempts 2 notifications_enabled 1 }define service{ use generic-service host_name hplj200 service_description PING check_command check_ping!3000.0,80%!5000.0,100% check_interval 10 retry_interval 1 max_check_attempts 2 notifications_enabled 1 }
配置好後重啟Nagios後就可以實現印表機的監控650) this.width=650;" src="https://s4.51cto.com/wyfs02/M01/00/0F/wKiom1mVZoyi4kMqAAAau-PMe94393.png-wh_500x0-wm_3-wmp_4-s_483796998.png" title="printer" alt="wKiom1mVZoyi4kMqAAAau-PMe94393.png-wh_50" />
本文出自 “技術隨筆” 部落格,謝絕轉載!
Nagios監控印表機