Check for UNIX printers?
Stephan Janosch
stephan.janosch at interface-business.de
Mon Jan 3 10:47:52 CET 2005
Emmett Hogan wrote:
> Hi again, :-)
>
> I am "going to the well" once again looking for a plugin...
>
> Has anyone written a plugin that checks the status of UNIX printers?
> (i.e. by parsing the output of "lpc status all")
>
> Thanks,
> Emmett
>
I did a very bad piece of code. The code checks for 'waiting' in `lpc
status all`.
Perhaps this is something for you.
-----------------------------------
#!/usr/bin/perl -w
my %STATUS_CODE = ('UNKNOWN' => '-1',
'OK' => '0',
'WARNING' => '1',
'CRITICAL' => '2');
$lpc="/usr/sbin/lpc";
$count=0;
@i=`$lpc status all`;
$i_length=@i;
$num_print=($i_length)/5;
while ($count < $num_print)
{
if ($i[$count*5+4] =~ /waiting/)
{
chop $i[$count*5];
print "$i[$count*5]"." does not work properly!\n";
exit($STATUS_CODE{"CRITICAL"});
}
$count++;
}
print "OK Everthing looks good.\n";
exit($STATUS_CODE{"OK"});
---------------------
Stephan
-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
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