Build a printer monitoring server using nagios and monitor the nagios printer
Tutorial Background: The company has many HP printers, which are difficult to manage. So I thought about whether I could be a printer monitoring server to quickly respond to all the printer problems. After that, I checked the relevant information on the Internet and set up one, so there was no problem in using it. I shared it with you.
Experiment knowledge: check_hpjd plug-in (this command is a standard component of the Nagios plug-in software release package) can be used to monitor JetDirect compatible printers in SNMP mode. This plug-in can check the following printer status: Paper jam, no paper, offline printer, manual intervention, low ink cartridge, insufficient memory, open shell, output tray full, other...
Experimental System: CentOS 6.6 _ x86_64
Prerequisites: Firewall and selinux are both disabled.
Tutorial Description: there is a total of 1 Host in this experiment, and the IP address is assigned to 192.168.19.79.
1. Install nagios
1. Install with yum:
yum -y install epel*
yum -y install nagios nagios-plugins-all
2. If you need to send an email alert, modify the Administrator email address (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 through the web. Open http: // 192.168.19.79/nagios and enter your username and password to log in:
2. configure printer monitoring:
1. Edit the main configuration file:
Vim/etc/nagios. cfg -------------------------------------------------------> export _file =/etc/nagios/objects/printer. cfg // remove this line comment
2. Edit printer. cfg:
Vim/etc/nagios/objects/printer. cfg ----------------------------------------------------------> define host {// defines a printer host, copy the changes to multiple printers and then use generic-printer host_name 31 west alias 31-WEST address 192.168.4.62 hostgroups network-printers // to add the changes to the Group for the convenience of the following configuration}
Define host {// define another print host use generic-printer host_name 31 east alias 31-EAST address 192.168.4.61 hostgroups network-printers} define hostgroup {// define a group hostgroup_name network-printers alias Network Printers members 31 east, 31 west // group member. Here, two simple statements are written, note that the name corresponds to} define service {use generic-service hostgroup_name network-printers // the members of this group use this method to monitor service_description Printer Status check_command check_hpjd! -C public // useCheck_hpjdPlugin to detect printer status
Icationication_interval 1440 // notification interval, the Unit is minute normal_check_interval 10 // retry_check_interval 1 is detected every 10 minutes // an error occurs every 1 minute} define service {use generic-service hostgroup_name network-printers service_description PING check_command check_ping! 3000.0, 80%! 5000.0, 100% // use ping to detect whether the printer is online
Icationication_interval 1440 normal_check_interval 10 retry_check_interval 1}
<----------------------------------------------------------
Service nagios restart
3. Use the web management interface of the printer to set the threshold value:
4. Go to the web interface to view the information:
If there is a problem with the printer, it will appear in the list shown above. Click to view:
5. Configure email sending (optional ):
Yum-y install sendmail
Vim/etc/mail. rc ------------------------------------------------> // Add the following lines: set from = Email account smtp = server address set smtp-auth-user = Email account smtp-auth-password = email password set smtp-auth = login
-------------------------------------------------->
Echo "nagios test mail" | mail-s "nagios" email address // test whether the email address can be sent successfully. Replace the email address with your own address.
After that, you will receive an alert email when the monitoring system starts to trigger an alert!
Now, the experiment has been demonstrated. Thank you! If you have any questions, contact QQ: 82800452