Experimental background: The company has many HP HP printers, management is more troublesome. So you can be a printer monitoring server, able to quickly respond to all the problems of the printer. After the internet to check the relevant information to build a, use and no problem, so I took out to share with you.
Experimental knowledge: The CHECK_HPJD plugin (which is a standard part of the Nagios plug-in software release package) can be used to monitor JetDirect compatible printers in SNMP mode. The plugin can check the following printer status: paper jam, paperless, printer offline, manual intervention required, low ink cartridge toner, insufficient memory, open shell, output tray full, other ...
Experimental system: CentOS 6.6_x86_64
Lab Prerequisites: Firewall and SELinux are off
Experiment Description: This experiment has 1 hosts, IP assigned to 192.168.19.79
First, install Nagios
1. Install with Yum:
- y epel*
Yuminstall Nagios nagios-plugins-all
2. If you need to make an email alert, modify the admin mailbox (optional):
Vim/etc/nagios/objects/contacts.cfg
3. Configure the Web login password:
Htpasswd-c/etc/nagios/passwd nagiosadmin
4. Start the test:
Chkconfig httpd onchkconfig nagios onservice httpd startservice nagios start
Now you can access Nagios from the Web, open Http://192.168.19.79/nagios, enter your username and password to log in:
Second, configure printer monitoring:
1. Edit the master configuration file:
vim/etc/nagios/nagios.cfg--------------------------------------------------------->cfg_file =/etc/nagios/objects/printer.cfg // remove this line comment
2. Edit Printer.cfg:
vim/etc/nagios/objects/printer.cfg---------------------------------------------------------->define host{ // Define a printer host, and multiple printers can replicate this modification to use Generic-Printer host_name 31westAlias to-WEST Address192.168.4.62hostgroups Network-printers// join a group to facilitate unified configuration below }
Define host{ // define another print host use generic-Printer host_name 31eastAlias to-EAST Address192.168.4.61hostgroups Network-printers}define hostgroup{ // define a group hostgroup_name NETW Ork-printers alias Network printers members 31east,31west // group member, Here are two simple to write, note the name of the corresponding }define service{use generic-Service Hostgroup_name Network-printers // members of this group use this method to monitor service_description Printer Status Check_command CHECK_HPJD!-C public //Use CHECK_HPJD plug-in to detect printer status
notification_interval 1440 //notification interval, unit is minutes Normal_check_interval tested every 10 minutes Retry_check_interval1 //problem detected every 1 minutes }define service{Use generic-Service Hostgroup_name Network-printers service_description PING check_command check_ping!3000.0, the%!5000.0, -% //Ping to detect if the printer is online
notification_interval 1440 Normal_check_intervalTenRetry_check_interval1 }
<----------------------------------------------------------
Service Nagios Restart
3. Use the printer's web management interface to set the relevant thresholds:
4. Go to the Web interface to view:
If there is a problem with the printer, it will appear in the list above and click to view:
5. Configure mail delivery (optional):
Yum- y install sendmail
vim/etc/mail.rc-------------------------------------------------->//Add the following linesset from= e-mail account smtp= server address set smtp-auth-user= mailbox account smtp-auth-password= mailbox password set smtp-auth= Login
-------------------------------------------------->
echo "nagios Test Mail" | mail-s "Nagios" email address //test can be sent successfully, email address for your own
Then, when monitoring the alarm, you will receive the alarm mail!
At this point, the experimental demonstration is complete, thank you! If you have any questions, please contact qq:82800452
Using Nagios to build a printer monitoring server