Page 2 of 3

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

Posted: Thu Dec 03, 2015 4:20 pm
by Jacktivated
rkennedy wrote: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
I will start doing that and report back.

I really appreciate all of the help. I like Nagios a lot and want to learn as much as I can.

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

Posted: Thu Dec 03, 2015 4:45 pm
by rkennedy
Sounds good.

Just in case you don't know how to check things over the CLI, you can run the following command -

Code: Select all

/usr/local/nagios/libexec/check_printer <inputhere>
Replace <inputhere> with the variables you're trying to process.

I'll leave this open, let us know if you have any more questions.

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

Posted: Fri Dec 04, 2015 10:02 am
by Jacktivated
rkennedy wrote:Sounds good.

Just in case you don't know how to check things over the CLI, you can run the following command -

Code: Select all

/usr/local/nagios/libexec/check_printer <inputhere>
Replace <inputhere> with the variables you're trying to process.

I'll leave this open, let us know if you have any more questions.
Thanks. That's where I get hazy, though. Knowing how to choose the variables and how to input it.

For example...


When running ./check_printer --help, it outputs the following, which was translated from German:
Outputs various Counter the printer. Counter 2-num are Ricoh specific.
Counter 1 is always Lifetime Counter for printed material. Returns perfdata.
Status is always OK if Counter exists otherwise UNKNOWN.
-> Toner_kyocera_monochrome
-> Toner_ricoh_monochrome / toner_ricoh_color
-> Toner / ink num [warn] [crit] [max]
Returns the status of the toner or ink. Provides level than when perfdata
possible. If the printer false maximums supplies for cartridge / toner
(eg HP Businessink) can be specified with max the correct value (usually 100).
Warning is the threshold between OK and warning of (0.0 to 1.0; default: 0.2 = 20%)
-> Paper num [warn] [crit]
Returns the status of Papiertrays num. Provides level as perfdata if possible.
Warning is the threshold between OK and warning of (0.0 to 1.0; default: 0.2 = 20%)
-> Hardware num
Indicates status of the component num (eg CPU, RAMDISK).
Returns perfdata when possible (meaning often uncertain).
-> Num parts
Returns the status of the printer part num out (Ex: Rear Unit).
-> Alerts
Returns all major printer messages. Ignoring the extent possible unimportant messages
(for example, energy-saving mode or Warming Up). Returns for each message status = warning.
For messages that require trained field service or servity same critical or is
is status = Critical returned.
-> Accounting pw num [warn]
Returns the status of the account from 1-num (Kyocera). Cost centers can be made by
"KM Net for Accounting" or Druckermenu by holding down OK and
Pressure be created on Menu.
Password is composed of printer number (4 digits), and then with 0 to
15 points aufgefuellt. (bsp FS-2000 => 200 trillion)
Warning is the threshold between OK and warning of (0.0 to 1.0; default: 0.2 = 20%)
Returns perfdata


So, if I'm trying to monitor Ricoh printers, does that mean that i need to select option 2, based on the output above?

Going by the command examples given in the last link you provided me with on this plugin, I was able to get some results in the CLI. Are these only limited to toner? Is the examples he gave for option 1, which is not for Ricoh? I realize the parameters set in the example are thresholds, but I don't see the breakdown of each piece. And then, what do I ultimately do with the results? How do I take this info, and turn it into something in the printer.cfg that will check a number of items on those printers?
example
example
Here is my output, based on the example provided above:
[root@nagioscore libexec]# ./check_printer 10.0.202 public 1 toner 1 0.6 0.5
OK - Toner 100% (100 of 100 left) | toner=100;60;50;0;100

[root@nagioscore libexec]# ./check_printer 10.0.202 public 1 toner 1 0.9 0.7
OK - Toner 100% (100 of 100 left) | toner=100;90;70;0;100

[root@nagioscore libexec]# ./check_printer 10.0.0.202 public 1 toner 1 0.9 0.8
OK - Toner 100% (100 of 100 left) | toner=100;90;80;0;100


This is why I had originally started another thread that was asking for documentation for installing 3rd party custom plugins, in general, so I could learn and then apply that to this plugin. But that didn't get me very far, so I am asking specifically how to get this working from start to finish, hoping to learn something. I have, at best, a basic understanding of Linux. At least enough to follow direction well enough, though I am completely lost with this, and yet had no trouble setting up everything else in Nagios (servers, HP printers, switch), because I had good documentation. I wish there was another plugin that worked just as well with my Ricoh printers/copiers. This is not the greatest one to be using for my first attempt at managing additional plugins.

Sorry this is so long. I'm hoping by being thorough, it might help you assist me. Thank you again.

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

Posted: Fri Dec 04, 2015 11:39 am
by rkennedy
Thanks. That's where I get hazy, though. Knowing how to choose the variables and how to input it.
This changes based on what script you're using. With our exchange, comes custom scripts made my people of the community. Most script should have a -h or --help that helps outline which variables are needed for that command in particular.
So, if I'm trying to monitor Ricoh printers, does that mean that i need to select option 2, based on the output above?
Judging from the text above, yes I would think so. However, we do not have a printer here to test with so I can't make that confirmation. The best thing to do is experiment over the command line and find the result you're looking for, and then move it into your check.
Going by the command examples given in the last link you provided me with on this plugin, I was able to get some results in the CLI. Are these only limited to toner? Is the examples he gave for option 1, which is not for Ricoh? I realize the parameters set in the example are thresholds, but I don't see the breakdown of each piece.
I don't believe that they are only limited to the toner, again - this goes with the two answers above. We don't control the flow of how someone writes their scripts, and we do not have a printer here to test with. The best judgement is to experiment with the script. The examples he posted may or may not work on your printer in particular -

Code: Select all

Papertray:
# paper tray 2
$ check_printer 192.168.123.1 public 1 paper 2

# alerts
$ check_printer 192.168.123.1 public 1 alerts
OK - ( 5 3 10 1 0 1001) ( 5 3 10 1 0 1001)

# pagecounts, just iterate through the argument after counter

$ check_printer 192.168.123.1 public 1 counter 1
OK - Total: 95 | pagecount=95;

# hardware parts
$ check_printer 192.168.123.1 public 1 hardware 1
OK - FS-2100DN Status=2 | data=2;

# hardware parts
$ check_printer 192.168.123.1 public 1 parts 1
OK - Top Cover Status=4
And then, what do I ultimately do with the results? How do I take this info, and turn it into something in the printer.cfg that will check a number of items on those printers?
You will want to define a service, and check_command. I've drawn lines to show how the $ARG#$ values correspond, and provided a bit more of detail.
command-service-relationship.png
There were a few links provided in your other thread asking for documentation to help clarify. This is what we have for now, and in the future we may be able to build a more descriptive document that outlines these steps.

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

Posted: Fri Dec 04, 2015 3:52 pm
by Jacktivated
rkennedy wrote:
Thanks. That's where I get hazy, though. Knowing how to choose the variables and how to input it.
This changes based on what script you're using. With our exchange, comes custom scripts made my people of the community. Most script should have a -h or --help that helps outline which variables are needed for that command in particular.
So, if I'm trying to monitor Ricoh printers, does that mean that i need to select option 2, based on the output above?
Judging from the text above, yes I would think so. However, we do not have a printer here to test with so I can't make that confirmation. The best thing to do is experiment over the command line and find the result you're looking for, and then move it into your check.
Going by the command examples given in the last link you provided me with on this plugin, I was able to get some results in the CLI. Are these only limited to toner? Is the examples he gave for option 1, which is not for Ricoh? I realize the parameters set in the example are thresholds, but I don't see the breakdown of each piece.
I don't believe that they are only limited to the toner, again - this goes with the two answers above. We don't control the flow of how someone writes their scripts, and we do not have a printer here to test with. The best judgement is to experiment with the script. The examples he posted may or may not work on your printer in particular -

Code: Select all

Papertray:
# paper tray 2
$ check_printer 192.168.123.1 public 1 paper 2

# alerts
$ check_printer 192.168.123.1 public 1 alerts
OK - ( 5 3 10 1 0 1001) ( 5 3 10 1 0 1001)

# pagecounts, just iterate through the argument after counter

$ check_printer 192.168.123.1 public 1 counter 1
OK - Total: 95 | pagecount=95;

# hardware parts
$ check_printer 192.168.123.1 public 1 hardware 1
OK - FS-2100DN Status=2 | data=2;

# hardware parts
$ check_printer 192.168.123.1 public 1 parts 1
OK - Top Cover Status=4
And then, what do I ultimately do with the results? How do I take this info, and turn it into something in the printer.cfg that will check a number of items on those printers?
You will want to define a service, and check_command. I've drawn lines to show how the $ARG#$ values correspond, and provided a bit more of detail.
command-service-relationship.png
There were a few links provided in your other thread asking for documentation to help clarify. This is what we have for now, and in the future we may be able to build a more descriptive document that outlines these steps.

Excellent reply. It definitely is helping for me to gain perspective. And I can appreciate that there's no docs yet for this, but it's a little surprising since there's a plethora of documentation for almost everything else Nagios. I really am impressed with the level of help that's provided here in the forums. Thank you! I will continue to play with this through a lot of trial and error.

I did add the commands you mentioned in a CLI and was able to get results on all but alerts. Your line mapping to the different arguments in my screenshot helped quite a bit, but it doesn't seem to be working from the Nagios Web GUI. I guess I still don't know how to take the the results of the command line commands, and translate those to the commands.cfg and printer.cfg files. I'm sorry if I am becoming a pain. I feel like it has almost clicked, but I'm not quite there yet.

Command Line:
[root@nagioscore libexec]# ./check_printer 10.0.0.202 public 1 paper 2
Critical - Tray 2 0% (0 of 550 left) | paper=0;110;0;0;550
[root@nagioscore libexec]# ./check_printer 10.0.0.202 public 1 alerts
UNKNOWN - Internal error
[root@nagioscore libexec]# ./check_printer 10.0.0.202 public 2 alerts
UNKNOWN - Internal error
[root@nagioscore libexec]# ./check_printer 10.0.0.202 public 1 counter 1
OK - Total: 322427 | pagecount=322427;
[root@nagioscore libexec]# ./check_printer 10.0.0.202 public 1 counter 2
OK - Counter:Copy:Total: 292062 | pagecount=292062;
[root@nagioscore libexec]# ./check_printer 10.0.0.202 public 1 hardware 1
Warning - RICOH Aficio MP 6002 Status=3 | data=10;
[root@nagioscore libexec]# ./check_printer 10.0.0.202 public 1 hardware 2
OK - RICOH Aficio MP 6002 Status=2 | data=0;
[root@nagioscore libexec]# ./check_printer 10.0.0.202 public 1 parts 1
OK - Front Cover Status=4 | part=4;
[root@nagioscore libexec]# ./check_printer 10.0.0.202 public 1 parts 2
OK - ADF Cover Status=4 | part=4;
[root@nagioscore libexec]# ./check_printer 10.0.0.202 public 1 parts 3
OK - Finisher Front Cover Status=4 | part=4;


COMMANDS.CFG
# 'check_printer' command definition
define command{
command_name check_printer

command_line $USER1$/check_printer -H $HOSTADDRESS$ $ARG1$ $ARG2$
}


PRINTER.CFG
define service{
use generic-ricoh ; Inherit values from a template
host_name RICOH8110s,Fiery-0517,COPBEN ; The name of the host the service is associated with
service_description Ricoh Status ; The service description

check_command check_printer!-C v2c public!1!parts!1 ; 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
}




Do my configs above look correct?

Here is my HPJD for refernce:
define service{
use generic-service ; Inherit values from a template
host_name PTRPRESS1,PTRPRESS2 ; 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
}

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

Posted: Sun Dec 06, 2015 9:50 pm
by Box293
Jacktivated wrote:# 'check_printer' command definition
define command{
command_name check_printer
command_line $USER1$/check_printer -H $HOSTADDRESS$ $ARG1$ $ARG2$
}
Jacktivated wrote:check_command check_printer!-C v2c public!1!parts!1 ; The command used to monitor the service
command_name: check_printer
The exclamation marks separate the arguments:
$ARG1$: -C v2c public
$ARG2$: 1
$ARG3$: parts
$ARG4$: 1

However your check command only has $ARG1$ and $ARG2$ defined, so Nagios is executing:

Code: Select all

/usr/local/nagios/libexec/check_printer -H 192.168.123.1 -C v2c public 1
Try this:

Code: Select all

check_command check_printer!-C v2c public!1 parts 1

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

Posted: Tue Dec 08, 2015 9:24 am
by Jacktivated
Box293 wrote:
Jacktivated wrote:# 'check_printer' command definition
define command{
command_name check_printer
command_line $USER1$/check_printer -H $HOSTADDRESS$ $ARG1$ $ARG2$
}
Jacktivated wrote:check_command check_printer!-C v2c public!1!parts!1 ; The command used to monitor the service
command_name: check_printer
The exclamation marks separate the arguments:
$ARG1$: -C v2c public
$ARG2$: 1
$ARG3$: parts
$ARG4$: 1

However your check command only has $ARG1$ and $ARG2$ defined, so Nagios is executing:

Code: Select all

/usr/local/nagios/libexec/check_printer -H 192.168.123.1 -C v2c public 1
Try this:

Code: Select all

check_command check_printer!-C v2c public!1 parts 1
Thanks very much.

I still can't get this working. With my HP pinters, I am notified by Nagios right away of various problems that may occur.

But right now with my Ricoh printers, the only thing that works is check_ping, and so there have been situations where Nagios says the printer is fine, but then when we go to the printer room, expecting to see a few thousand reports, nothing printed and there is an error on the screen. This is so frustrating.

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

Posted: Tue Dec 08, 2015 12:42 pm
by rkennedy
Can you post a screenshot to show us what error messages the other services are receiving?

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

Posted: Mon Dec 28, 2015 2:17 pm
by tgrtjake
Don't know if this will help, but we have some Ricoh printers that work fine with checks. Here is our Ricoh Aficio MP 5000 B&W. I don't have it alerting me because it's not important.

# 'check_printer' command definition

Code: Select all

define command{
        command_name    check_printer
        command_line    $USER1$/check_printer $ARG1$ $ARG2$ $ARG3$ $ARG4$ $ARG5$ $ARG6$
        }
ricoh.cfg

Code: Select all

define host{
        use                    generic-printer
        host_name              printer-LANIER-ECC
        alias                  RICOH LANIER-ECC
        address                172.16.120.33
        max_check_attempts     5
        contact_groups         candj
        hostgroups             all, ccc, printers
        notification_period    none
        }

define service{
        use                    generic-service
        host_name              printer-LANIER-ECC
        service_description    Black Toner
        check_command          check_printer!172.16.120.33!public!1!toner!1!0.05
        }

define service{
        use                    generic-service
        host_name              printer-LANIER-ECC
        service_description    Waste
        check_command          check_printer!172.16.120.33!public!2!toner!2!0.05
        }

define service{
        use                    generic-service
        host_name              printer-LANIER-ECC
        service_description    .Printed Page Count - Total
        check_command          check_printer!172.16.120.33!public!2!counter!1
        }

define service{
        use                    generic-service
        host_name              printer-LANIER-ECC
        service_description    .Printed Page Count - Copier
        check_command          check_printer!172.16.120.33!public!2!counter!2
        }

define service{
        use                    generic-service
        host_name              printer-LANIER-ECC
        service_description    .Printed Page Count - Printer
        check_command          check_printer!172.16.120.33!public!2!counter!8
        }
What I see on website
Image

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

Posted: Mon Dec 28, 2015 2:23 pm
by rkennedy
Thannks for adding @tgrtjake! Maybe this will help.

@Jacktivated let us know when you get a chance to review the newest posts.