Page 1 of 2

Check_Printer Assistance Defining Command

Posted: Sat Oct 04, 2014 2:04 pm
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.

Re: Check_Printer Assistance Defining Command

Posted: Mon Oct 06, 2014 11:20 am
by tmcdonald
What's the exact command you run from the CLI, as well as the output from that command?

Re: Check_Printer Assistance Defining Command

Posted: Mon Oct 06, 2014 11:47 am
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.

Re: Check_Printer Assistance Defining Command

Posted: Mon Oct 06, 2014 11:51 am
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
}

Re: Check_Printer Assistance Defining Command

Posted: Mon Oct 06, 2014 12:01 pm
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?

Re: Check_Printer Assistance Defining Command

Posted: Mon Oct 06, 2014 2:31 pm
by abrist
If it has alert threshold options, you should find them in the help context:

Code: Select all

./check_printer --help

Re: Check_Printer Assistance Defining Command

Posted: Mon Oct 06, 2014 7:56 pm
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?

Re: Check_Printer Assistance Defining Command

Posted: Tue Oct 07, 2014 5:01 pm
by slansing
Where did you get this plugin from? Can you provide a link? That usage output is very convoluted.

Re: Check_Printer Assistance Defining Command

Posted: Tue Oct 07, 2014 6:11 pm
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

Re: Check_Printer Assistance Defining Command

Posted: Wed Oct 08, 2014 1:52 pm
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.