How to monitor a printer

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Ladi
Posts: 46
Joined: Tue Nov 06, 2012 3:27 am

How to monitor a printer

Post by Ladi »

Hi,

Everything is working as I expected now. I could edit all the file. Please am having little issue on how to monitor printer.

currently, Ping and printer status is being monitored. but I want to monitor out of paper and toner low.


Please how can we monitor these. I will be glad to hear from you
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: How to monitor a printer

Post by lmiltchev »

What kind of printer would you like to monitor? Did you look for plugins on the Nagios Exchange that can fit your needs?
Be sure to check out our Knowledgebase for helpful articles and solutions!
Ladi
Posts: 46
Joined: Tue Nov 06, 2012 3:27 am

Re: How to monitor a printer

Post by Ladi »

Hi lmitchev,

Thanks for your swift response. Actually am trying to monitor hp printer. I read one documentation that showed me how to go about it, which have done. Am using check_hpjp plugin am currently monitoring the printer status and ping, but i want to monitor the below, pls i dont knw how to go about it, have trying to use check_hpjp plugin to monitor out of paper, but its does not work.

Paper Jam
Out of Paper
Printer Offline
Intervention Required
Toner Low
Insufficient Memory
Open Door
Output Tray is Full

I will be glad to hear from you.


Regards.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: How to monitor a printer

Post by slansing »

Are you sure you are not using 'check_hpjd', what is the issue you are running into with checking the metrics above? What output does it give you, what have you tried, etc? We need to know what the problem is in order to help.
Ladi
Posts: 46
Joined: Tue Nov 06, 2012 3:27 am

Re: How to monitor a printer

Post by Ladi »

Hi Slansing,

Currently am using check_hpjp, but have tried check_snmp also, with no luck. I was about to monitor the printer status and ping of the printer , but the rest like Out of Paper and toner, i dont know how to do that. kindly see attached my configurations file for printer and the screenshot of nagios.


I will be waiting for your response.



# Define a host for the printer we'll be monitoring
# Change the host_name, alias, and address to fit your situation

define host{
use generic-printer ; Inherit default values from a template
host_name hplj2605dn ; The name we're giving to this printer
alias HP LaserJet 2605dn ; A longer name associated with the printer
address 192.168.1.30 ; IP address of the printer
hostgroups network-printers ; Host groups this printer is associated with
}


define host{
use generic-printer ; Inherit default values from a template
host_name NP18CB7B3 ; The name we're giving to this printer
alias HP LaserJet CP2025N ; A longer name associated with the printer
address 192.168.7.180 ; IP address of the printer
hostgroups network-printers ; Host groups this printer is associated with
}



###############################################################################
###############################################################################
#
# HOST GROUP DEFINITIONS
#
###############################################################################
###############################################################################

# A hostgroup for network printers

define hostgroup{
hostgroup_name network-printers ; The name of the hostgroup
alias Network Printers ; Long name of the group
}




###############################################################################
###############################################################################
#
# SERVICE DEFINITIONS
#
###############################################################################
###############################################################################

# Create a service for monitoring the status of the printer
# Change the host_name to match the name of the host you defined above
# If the printer has an SNMP community string other than "public", change the check_command directive to reflect that

define service{
use generic-service ; Inherit values from a template
host_name hplj2605dn ; 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
normal_check_interval 10 ; Check the service every 10 minutes under normal conditions
retry_check_interval 1 ; Re-check the service every minute until its final/hard state is determined
}


define service{
use generic-service ; Inherit values from a template
host_name NP18CB7B3 ; 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
normal_check_interval 10 ; Check the service every 10 minutes under normal conditions
retry_check_interval 1 ; Re-check the service every minute until its final/hard state is determined
}


# Create a service for "pinging" the printer occassionally. Useful for monitoring RTA, packet loss, etc.

define service{
use generic-service
host_name hplj2605dn
service_description PING
check_command check_ping!3000.0,80%!5000.0,100%
normal_check_interval 10
retry_check_interval 1
}

define service{
use generic-service
host_name NP18CB7B3
service_description PING
check_command check_ping!3000.0,80%!5000.0,100%
normal_check_interval 10
retry_check_interval 1
}

# Create a service for "toner" on the printer occassionally. Useful for monitoring consum toners, etc.

define service{
use generic-service
host_name NP18CB7B3
service_description Toner Supply
check_command check_hpjd!-C public
}


# Create a service for "Printer Model" the printer occassionally. Useful for monitoring printer model etc.

define service{
use generic-service
host_name NP18CB7B3
service_description Printer Model
check_command check_hpjd!-C public
}




Regards.
Attachments
printer.PNG
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: How to monitor a printer

Post by tmcdonald »

Can you also post the check_hpjp command you are using with those services? And please run the plugin manually from the command line with all the proper parameters, and post both the command and the output here.
Former Nagios employee
Ladi
Posts: 46
Joined: Tue Nov 06, 2012 3:27 am

Re: How to monitor a printer

Post by Ladi »

Hi tmcdonald,

Below is the command that am using.

'check_hpjd' command definition
define command{
command_name check_hpjd
command_line $USER1$/check_hpjd -H $HOSTADDRESS$ $ARG1$
}


I will run it manually and post the output shortly. Dont forget that i said someone the services are working fine except the new one that i need to monitor.


Regards.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: How to monitor a printer

Post by abrist »

Could you try specifying the port?

Code: Select all

check_command check_hpjd!-C public -p 161 
Additionally, run an nmap against the printer's default snmp port(161):

Code: Select all

nmap -p 161 <ip of printer>
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: How to monitor a printer

Post by tmcdonald »

Ladi wrote:I will run it manually and post the output shortly. Dont forget that i said someone the services are working fine except the new one that i need to monitor.
My guess then (assuming these services all use this command) is that you have your arguments wrong. Post the command and output when you can and we'll continue.
Former Nagios employee
User avatar
millisa
Posts: 69
Joined: Thu Jan 16, 2014 11:13 pm
Location: Austin, TX
Contact:

Re: How to monitor a printer

Post by millisa »

Ladi posted these service definitions:

Code: Select all

define service{ 
use generic-service 
host_name NP18CB7B3
service_description Toner Supply 
check_command check_hpjd!-C public 
}
and

Code: Select all

define service{ 
use generic-service 
host_name NP18CB7B3
service_description Printer Model 
check_command check_hpjd!-C public
}
These are identical to Ladi's 'Printer Status' check except for the service_description; it's effectively just running the same check_hpjd command three times, back to back. (I couldn't guess why one is failing when the other two are not unless there is an intermittent connectivity issue or possibly the jetdirect cards don't respond when the same snmp get request comes in so quickly?).

check_hpjd doesn't take arguments for a specific type of check of the printer (it looks like Andy added the port option back in January and it was part of the 2.0 plugins release, I don't have it in my 1.4 version); (relevant code snippet located at the bottom of this post). You don't specify that you want a toner-level check or a paper-out check. The plugin just warns if there is a paper jam, out of paper, peripheral error, intervention required, toner low, insufficient memory, a door is open, output tray is full, data too slow, or unknown paper type - any one of those conditions puts the return to a warning state. The plugin is just running a single snmpget for around a dozen snmp query strings to match up with those conditions above (relevant code snippet at the bottom of this post). I only see the plugin mark the check critical on a timeout. There just isn't any more granular control. I think this may be some of Ladi's confusion? I'm pretty sure you don't need the 'Printer Model' or the 'Toner Supply' check. You are already monitoring those things with 'Printer Status'. If 'Printer Status' isn't picking up those conditions, then it's more likely an issue with what your jet direct card is returning in the snmpget.



References:
SNMP query strings used by check_hpjd to retrieve various jetdirect status:

Code: Select all

#define HPJD_LINE_STATUS           ".1.3.6.1.4.1.11.2.3.9.1.1.2.1"
#define HPJD_PAPER_STATUS          ".1.3.6.1.4.1.11.2.3.9.1.1.2.2"
#define HPJD_INTERVENTION_REQUIRED ".1.3.6.1.4.1.11.2.3.9.1.1.2.3"
#define HPJD_GD_PERIPHERAL_ERROR   ".1.3.6.1.4.1.11.2.3.9.1.1.2.6"
#define HPJD_GD_PAPER_OUT          ".1.3.6.1.4.1.11.2.3.9.1.1.2.8"
#define HPJD_GD_PAPER_JAM          ".1.3.6.1.4.1.11.2.3.9.1.1.2.9"
#define HPJD_GD_TONER_LOW          ".1.3.6.1.4.1.11.2.3.9.1.1.2.10"
#define HPJD_GD_PAGE_PUNT          ".1.3.6.1.4.1.11.2.3.9.1.1.2.11"
#define HPJD_GD_MEMORY_OUT         ".1.3.6.1.4.1.11.2.3.9.1.1.2.12"
#define HPJD_GD_DOOR_OPEN          ".1.3.6.1.4.1.11.2.3.9.1.1.2.17"
#define HPJD_GD_PAPER_OUTPUT       ".1.3.6.1.4.1.11.2.3.9.1.1.2.19"
#define HPJD_GD_STATUS_DISPLAY     ".1.3.6.1.4.1.11.2.3.9.1.1.3"

Relevant part of the check_hpjd.c code for the arguments (around line 307):

Code: Select all

process_arguments (int argc, char **argv)
{
	int c;

	int option = 0;
	static struct option longopts[] = {
		{"hostname", required_argument, 0, 'H'},
		{"community", required_argument, 0, 'C'},
  		{"port", required_argument,0,'p'}, 
		{"version", no_argument, 0, 'V'},
		{"help", no_argument, 0, 'h'},
		{0, 0, 0, 0}
	};
The case statement for the options are just below that section - no other arguments are taken.
Locked