Can't get check_printer plugin to work in Nagios Core

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.
Jacktivated
Posts: 33
Joined: Wed Nov 25, 2015 1:49 pm

Can't get check_printer plugin to work in Nagios Core

Post by Jacktivated »

I'm hoping someone can help me get this working. I'm trying to monitor our Ricoh printers and copiers beyond the check_hpjd plugin (which is part of the standard Nagios plugins distribution). This plugin works well with our HP printers, but I can't get it to do anything for the Ricoh devices. I found a 3rd party plugin in the Nagis Exchange community, that claims it monitors Ricoh printers, and others, quite well. It received a high rating and got 16 votes.

HERE IS THE LINK:
https://exchange.nagios.org/directory/P ... es/details

BUT...There isn't any clear documentation to get it installed and configured...and to make things even more difficult, it's in German, lol. I managed to successfully run it in a command line, but it spits out German results, and even after translating in Google Translate, it still doesn't make sense.

I'm including some steps I took, as well as the details from my command.cfg and printers.cfg files below. The only thing I could find on the web about this plugin, wasn't very helpful at all and, at best, outlined a solution to create a new service per check, which is not efficient at all, nor what this plugin is capable of. Here is that link as well:

https://www.reddit.com/r/nagios/comment ... r_to_work/

Thanks very much for taking the time to read this and help me. I am new to Nagios Core in general, but really struggling with installing additional third party plugins. I really want to get this working and understand working with these custom plugins.

Here is my config...

COMMANDS.CFG:
# 'check_printer' command definition
define command{
command_name check_printer
command_line /usr/bin/php $USER1$/check_printer $ARG1$ $ARG2$ $ARG3$ $ARG4$ $ARG5$
}


PRINTER.CFG:
define service{
use generic-ricoh ; Inherit values from a template
host_name RicohFiery-0517,COPBEN ; The name of the host the service is associated with
service_description Ricoh Status ; The service description
check_command check_printer!-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
}

TEMPLATES.CFG:
# Test service for Ricoh printers.
define service{
name generic-ricoh ; The 'name' of this service template
active_checks_enabled 1 ; Active service checks are enabled
passive_checks_enabled 1 ; Passive service checks are enabled/accepted
parallelize_check 1 ; Active service checks should be parallelized (disabling this can lead to major performance problems)
obsess_over_service 1 ; We should obsess over this service (if necessary)
check_freshness 0 ; Default is to NOT check service 'freshness'
notifications_enabled 1 ; Service notifications are enabled
event_handler_enabled 1 ; Service event handler is enabled
flap_detection_enabled 1 ; Flap detection is enabled
process_perf_data 1 ; Process performance data
retain_status_information 1 ; Retain status information across program restarts
retain_nonstatus_information 1 ; Retain non-status information across program restarts
is_volatile 0 ; The service is not volatile
check_period 24x7 ; The service can be checked at any time of the day
max_check_attempts 3 ; Re-check the service up to 3 times in order to determine its final (hard) state
normal_check_interval 10 ; Check the service every 10 minutes under normal conditions
retry_check_interval 2 ; Re-check the service every two minutes until a hard state can be determined
contact_groups nagios-testers ; Notifications get sent out to everyone in the 'nagios-testers' group
notification_options w,u,c,r ; Send notifications about warning, unknown, critical, and recovery events
notification_interval 0 ; Send notifications when a service status is changed
notification_period 24x7 ; Notifications can be sent out at any time
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL SERVICE, JUST A TEMPLATE!
}


...and finally, here is my COMMANDS.CFG config for the check_hpjd plugin for comparison:

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

HERE IS THE OUTPUT IN THE NAGIOS WEB GUI:
Current Status:
UNKNOWN
(for 0d 17h 19m 56s)
Status Information: /usr/local/nagios/libexec/check_printer ip community snmp command
-> snmp versions = 1, v2c
-> counter num
Gibt verschiedenen Counter des Druckers aus. Counter 2-num sind Ricoh spezifisch.
Counter 1 ist immer Lifetimecounter fuer gedruckte Seiten. Liefert perfdata.
Status ist immer OK wenn Counter existiert ansonsten UNKNOWN.
-> toner_kyocera_monochrome
-> toner_ricoh_monochrome / toner_ricoh_color
-> toner/ink num [warn] [crit] [max]
Gibt den Status des Toners bzw der Tinte aus. Liefert Fuellstand als perfdata wenn
moeglich. Wenn der Drucker falsche Maximalwerte fuer Patronen/Toner liefert
(z.b. HP Businessink) kann mit max der richtige Wert angegeben werden (meist 100).
warn gibt die Schwelle zwischen ok und warning an (0.0 bis 1.0; default: 0.2 = 20%)
-> paper num [warn] [crit]
Gibt den Status des Papiertrays num aus. Liefert Fuellstand als perfdata wenn moeglich.
warn gibt die Schwelle zwischen ok und warning an (0.0 bis 1.0; default: 0.2 = 20%)
-> hardware num
Gibt Status der Komponente num aus (z.b. CPU, RAMDISK).
Liefert perfdata wenn moeglich (Bedeutung oft ungewiss).
-> parts num
Gibt den Status des Druckerteiles num aus (Bsp: Rear Unit).
-> alerts
Gibt alle wichtigen Druckermeldungen aus. Ignoriert soweit moeglich unwichtige Meldungen
(z.b. Energiesparmodus oder Aufwaermphase). Gibt bei jeder Meldung Status=warning.
Bei Meldungen die trained bzw fieldservice erfordern oder servity gleich critical ist
wird Status=critical zurueckgegeben.
-> accounting pw num [warn]
Gibt den Status der Kostenstelle 1-num aus (Kyocera). Kostenstellen koennen per
"KM Net for Accounting" oder im Druckermenu durch gedrueckt halten von OK und
Druck auf Menu erstellt werden.
Passwort setzt sich zusammen aus Druckernummer (4stellig) und wird dann mit 0 auf
15 Stellen aufgefuellt. (bsp FS-2000 => 200000000000000)
warn gibt die Schwelle zwischen ok und warning an (0.0 bis 1.0; default: 0.2 = 20%)
Liefert perfdata
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Can't get check_printer plugin to work in Nagios Core

Post by hsmith »

The German doesn't make this any easier. Do you have an exact model number of the printer? We may have to find a different way to do this.
Former Nagios Employee.
me.
Jacktivated
Posts: 33
Joined: Wed Nov 25, 2015 1:49 pm

Re: Can't get check_printer plugin to work in Nagios Core

Post by Jacktivated »

hsmith wrote:The German doesn't make this any easier. Do you have an exact model number of the printer? We may have to find a different way to do this.
That's good thinking.

One is a Ricoh Aficio MP 6002:
http://www.ricoh-usa.com/products/produ ... r/_/R-2415

The other is a Ricoh 8110s:
http://rpp.ricoh-usa.com/products/produ ... 110s-8120s
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Can't get check_printer plugin to work in Nagios Core

Post by tgriep »

I think you have to define the snmp version in your command. If you are using SNMP version 2 add v2c to your command.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Jacktivated
Posts: 33
Joined: Wed Nov 25, 2015 1:49 pm

Re: Can't get check_printer plugin to work in Nagios Core

Post by Jacktivated »

tgriep wrote:I think you have to define the snmp version in your command. If you are using SNMP version 2 add v2c to your command.
Thanks.

So, I added v2c in my command: (check_command check_printer!-C v2c public), and the output in the nagios web gui is:
Current Status
Current Status
Performance Data
Performance Data
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Can't get check_printer plugin to work in Nagios Core

Post by rkennedy »

Can you attempt to run this check over the command line and let us know the result?

Code: Select all

/usr/local/nagios/libexec/check_printer <insertrestofyourvariableshere>
As well check the permissions,

Code: Select all

ls -l /usr/local/nagios/libexec/check_printer
And, finally can you verify the check_printer file and output the following -

Code: Select all

head -5 /usr/local/nagios/libexec/check_printer
Former Nagios Employee
Jacktivated
Posts: 33
Joined: Wed Nov 25, 2015 1:49 pm

Re: Can't get check_printer plugin to work in Nagios Core

Post by Jacktivated »

rkennedy wrote:Can you attempt to run this check over the command line and let us know the result?

Code: Select all

/usr/local/nagios/libexec/check_printer <insertrestofyourvariableshere>
I don't know what my variables would be. (sorry. Not a complete noob, but this is new to me).

As well check the permissions,

Code: Select all

ls -l /usr/local/nagios/libexec/check_printer
-rwxr-xr-x 1 nagios nagios 19786 Dec 2 13:14 /usr/local/nagios/libexec/check_printer

And, finally can you verify the check_printer file and output the following -

Code: Select all

head -5 /usr/local/nagios/libexec/check_printer
iphron - Advanced Security
*
* Tel.: (05 11) 5151 33 0 Fax: (05 11) 5151 33 - 29
* Web: http://www.ciphron.de/ Support: (05 11) 5151 33 - 11
*
* Advanced Nagios printer check
*
*
* @author: [email protected]
* @updated by: [email protected]
* @bugfixes / improvements by: Sebastian Puschhof (MIDAN Software GmbH), Juan Jesúrvera (Teruel)
Last edited by Jacktivated on Thu Dec 03, 2015 2:42 pm, edited 1 time in total.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Can't get check_printer plugin to work in Nagios Core

Post by rkennedy »

The reason I asked for the first 5 lines is to check the plugin, and it looks like you're missing a key component -

Code: Select all

[b]#!/usr/bin/php
<?php[/b]
/*
 * Ciphron - Advanced Security
 *
The above should be the first 5 lines.

Can you redownload / paste the script and let us know the results once it's fixed?
Former Nagios Employee
Jacktivated
Posts: 33
Joined: Wed Nov 25, 2015 1:49 pm

Re: Can't get check_printer plugin to work in Nagios Core

Post by Jacktivated »

rkennedy wrote:The reason I asked for the first 5 lines is to check the plugin, and it looks like you're missing a key component -

Code: Select all

[b]#!/usr/bin/php
<?php[/b]
/*
 * Ciphron - Advanced Security
 *
The above should be the first 5 lines.

Can you redownload / paste the script and let us know the results once it's fixed?
Lol...When I was pasting the code into the file, I must have forgotten to press I (insert). Thanks very much. Here's the output now:

#!/usr/bin/php
<?php
/*
* Ciphron - Advanced Security
*

However, in the Nagios Core Web GUI, it still shows:
Current Status
Current Status
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Can't get check_printer plugin to work in Nagios Core

Post by rkennedy »

It looks like the check is running now, but the parameters aren't properly configured now. I would recommend testing over the command line at this point until you can gather the information you're looking for.

As this is a plugin found on our exchange, we do our best to help with it - but, we don't directly support it.

With that said here's a thread I found (in english) with a bit more information about it - https://support.nagios.com/forum/viewto ... =7&t=29459
Former Nagios Employee
Locked