using check_printer to check Ricoh toner

Jon Angliss jon at netdork.net
Thu Aug 14 06:44:17 CEST 2008


On Wed, 13 Aug 2008 16:04:54 +0100, "Marcelo M. Garcia"
<marcelo.maia.garcia at googlemail.com> wrote:

>Hi.
>
>I'm trying to use the plugin "check_printer" to monitor the toners of 
>our Ricoh Aficio 3245C.

There are several "check_printer" plugins on the nagios exchange, it
may be helpful to detail which one you're referring to.

>
>When I run from the command line it works fine:
>mgarcia at newt /usr/lib/nagios/plugins $sudo ./check_printer 
>194.193.148.130 public toner 1
>OK - Black Tonermgarcia at newt /usr/lib/nagios/plugins $
>

You're running this command using the sudo command.  This implies a
root execution, unless you failed to disclose information about the
sudo setup, and how you're executing it.  You should always attempt to
start the command as the user running the nagios daemon.

>I defined a command "check_ricoh_toner":
># 'chech_ricoh_toner command definition
>define command {
>         command_name    check_ricoh_toner
>         command_line    $USER1$/check_printer $HOSTNAME$ public toner 
>$ARG1$
>         }
>
>And then, the service:
>mgarcia at newt /etc/nagios/cd-adapco/services $more ricohprinter.cfg
>#
># Printers.
>
>define service {
>     host_name        ricoh
>     service_description    check Ricoh Aficio
>     check_command        check_ricoh_toner!1
>     normal_check_interval    90
>         max_check_attempts      5
>     retry_check_interval    15
>         check_period            24x7
>     notification_interval    90
>     notification_period    workhours
>     notification_options    w,c,r
>     contact_groups        cd-admins
>}
>
>But in the web interface I see the message:
>UNKNOWN - Toner/Ink 1 does not exist!
>
>What is wrong? What am I missing?

Guessing you're using the PHP version from ciphron.de, it requires php
with SNMP support.  You've already validated that it exists due to
being able to execute it under sudo, so the next thing would be a
quick sample script to validate, and get real errors.  The PHP script
has the errors masked, so it makes it harder to debug.  Use the
following as a sample:

#!/usr/bin/php
<?php
echo snmpget('printaddress','public','.1.3.6.1.2.1.43.11.1.1.8.1.1');
?>

Save as a script, make executable, and run as the user executing
nagios.  snmpget might be returning an error message in the script
that is being masked with the @ symbol.
-- 
Jon Angliss


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list