Check_Printer Assistance Defining Command

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.
lingpanda
Posts: 10
Joined: Wed Sep 03, 2014 10:19 am

Check_Printer Assistance Defining Command

Post by lingpanda »

Hello,

I'm able to manually call the plugin and receive results(ie check_printer 192.168.1.1 public 1 alerts). I do not know know how to properly define the command in commands.cfg.

Code: Select all

define command{
        command_name    check_printer
        command_line    /usr/lib/nagios/plugins/check_printer
The plugin help is in German which is not my native language. After I learn to properly configure the command my next goal is to define the service.

Code: Select all

define service{
        use                               generic-service         ; Inherit values from a template
        host_name                    Office-Printer                ; The name of the host the service is associated with
        service_description       Printer Alert Status          ; The service description
        check_command            check_printer!192.168.1.1!public!1!alerts    ; The command used to monitor the service and return OK,Warning,Error
        }
Assistance would be greatly appreciated. Thanks.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Check_Printer Assistance Defining Command

Post by tmcdonald »

What's the exact command you run from the CLI, as well as the output from that command?
Former Nagios employee
lingpanda
Posts: 10
Joined: Wed Sep 03, 2014 10:19 am

Re: Check_Printer Assistance Defining Command

Post by lingpanda »

tmcdonald wrote:What's the exact command you run from the CLI, as well as the output from that command?
CLI command

Code: Select all

/usr/lib/nagios/plugins/check_printer 172.16.232.23 public 1 alerts
Result

Code: Select all

OK - ( 4 6 5 1 0 503)
Thanks.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Check_Printer Assistance Defining Command

Post by tmcdonald »

So you would want your command defined like:

Code: Select all

define command {
        command_name    check_printer
        command_line    /usr/lib/nagios/plugins/check_printer $ARG1$ $ARG2$ $ARG3$ $ARG4$
}
and your service like:

Code: Select all

define service{
        use                      generic-service
        host_name                Office-Printer
        service_description      Printer Alert Status
        check_command            check_printer!172.16.232.23!public!1!alerts
}
Former Nagios employee
lingpanda
Posts: 10
Joined: Wed Sep 03, 2014 10:19 am

Re: Check_Printer Assistance Defining Command

Post by lingpanda »

tmcdonald wrote:So you would want your command defined like:

Code: Select all

define command {
        command_name    check_printer
        command_line    /usr/lib/nagios/plugins/check_printer $ARG1$ $ARG2$ $ARG3$ $ARG4$
}
and your service like:

Code: Select all

define service{
        use                      generic-service
        host_name                Office-Printer
        service_description      Printer Alert Status
        check_command            check_printer!172.16.232.23!public!1!alerts
}
That appears to work. Thank you. If I may ask another question. How do I define the warning and critical response?
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Check_Printer Assistance Defining Command

Post by abrist »

If it has alert threshold options, you should find them in the help context:

Code: Select all

./check_printer --help
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.
lingpanda
Posts: 10
Joined: Wed Sep 03, 2014 10:19 am

Re: Check_Printer Assistance Defining Command

Post by lingpanda »

abrist wrote:If it has alert threshold options, you should find them in the help context:

Code: Select all

./check_printer --help
Unfortunately for me the help context is in German. This is the Google translate version.

- > Counter num
Are from different counters of the printer. Counter 2 - num are Ricoh specific.
Counter 1 is always Lifetime Counter for printed pages . Provides perfdata .
Status is always OK if Counter exists UNKNOWN otherwise .

- > 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 as if perfdata
possible . If the printer false maximums supplies for cartridge / toner
(eg HP Businessink ) can be specified with up to the correct value ( usually 100 ) .
warning is the threshold between ok and warning of ( 0.0 to 1.0 ; default: 0.2 = 20 % )

- > Wallpaper num [ warn] [ crit ]
Returns the status of the 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 ) .
Provides perfdata if possible ( meaning often uncertain ) .

- > Parts num
Returns the status of the printer part num from ( ex: Rear Unit).

- > Alerts
Returns all major printer messages . Ignored as far as possible unimportant messages
( for example, energy saving mode or Warming ) . Are in each status message = 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 1 - num from ( Kyocera ) . Cost centers can by
" KM Net for Accounting " or pressured by Druckermenu hold OK and
Pressure are created on Menu .
Password is composed of printer number ( 4 digits) and then with 0 to
15 points aufgefuellt . ( bsp FS - 2000 = > 200000000000000 )
warning is the threshold between ok and warning of ( 0.0 to 1.0 ; default: 0.2 = 20 % )
provides perfdata


I still can't make sense of this. Can anyone piece together what I need to do?
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Check_Printer Assistance Defining Command

Post by slansing »

Where did you get this plugin from? Can you provide a link? That usage output is very convoluted.
lingpanda
Posts: 10
Joined: Wed Sep 03, 2014 10:19 am

Re: Check_Printer Assistance Defining Command

Post by lingpanda »

slansing wrote:Where did you get this plugin from? Can you provide a link? That usage output is very convoluted.
Downloaded from the following link

http://exchange.nagios.org/directory/Pl ... es/details
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Check_Printer Assistance Defining Command

Post by lmiltchev »

To be honest with you, your best bet would be to either use a better documented plugin or contact the developer. Having said that, the following commands seemed to work for me:

Code: Select all

./check_printer 192.168.x.x public 1 toner 1 0.6 0.5
OK - Black Cartridge HP CC530A 72% (3875517 of 5308928 left) | toner=3875517;3185356.8;2654464;0;5308928

./check_printer 192.168.x.x public 1 toner 1 0.9 0.7
Warning - Black Cartridge HP CC530A 72% (3875517 of 5308928 left) | toner=3875517;4778035.2;3716249.6;0;5308928

./check_printer 192.168.x.x public 1 toner 1 0.9 0.8
Critical - Black Cartridge HP CC530A 72% (3875517 of 5308928 left) | toner=3875517;4778035.2;4247142.4;0;5308928

Maybe you can use something similar to this.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked