Jump to content

Recommended Posts

Posted

Hello,

 

I've finally got around to installing nagios yesterday and all seems to be fine. I would like to monitor my printers (a xerox 8550DP and a brother mfc 8860), but I'm having trouble getting the check_snmp to work. I was wondering if anyone else has had any experience using nagios to monitor said printers.

 

Tom

Posted
Ideally, you need to get the MIB file(s) for the printer from the manufacturer. That way you can work out what snmp node you need to query.
Posted

I wrote this to check my Phaser 8400s but I have found it seems to work on most printers as the OIDs must be standard. I have used it on the HP printers the dont like the HPJD plugin.

 

I think this is my final version but I am not in a position to check at the mo.

 

#!/usr/bin/perl -w
# Author : Chris Hindmarch
# Date :  17/10/2006
# Uses SNMP to check a Phaser 8400 status
# and determines the status of the printer.




if  ( !defined $ARGV[0] || !defined $ARGV[1])

{
print "Arg 1 = $ARGV[0] Arg 2 = $ARGV[2]";
  #print "One or more arguments are missing";

exit 3;

}
# Set the default status to 3.
$mystatus = 3;



# Set the community string and host from the arguments

# used to call the script

$COMMUNITY=$ARGV[0];

$IP=$ARGV[1];



# Get the results of the OID and put it into a variable

#$result = `snmpwalk -v1 -c $COMMUNITY $IP 1.3.6.1.4.1.9600.1.1.1.1.5.6.95.84.111.116.97.108`;

# Check the first static OID to see if there is a message
$result = `snmpwalk -v1 -c $COMMUNITY $IP mib-2.43.16.5.1.2.1.1`;
#print "$resultat";



# Use a regex to make sure the data has been returned

if ($result =~ m/(= STRING: ")(.*)(")$/)

{
$mystatus = 0;
print "PRINTER OK - ($2)\n";
$result = $2;
if ($result =~ m/Ink low/)
{
$mystatus = 1;
}
}

else # Go get the error message
{

$result ="";
# Get the message from the OID range that contains other messages
# if the above OID does not return a valid result.
$result = `snmpwalk -v1 -c $COMMUNITY $IP mib-2.43.18.1.1.8.1`;
if ($result =~ m/(Job)(.*)(")$/)
{
print "PRINTER WARNING - ($1$2)\n";
$mystatus = 1;
}
else
{
$result =~ m/(= STRING: ")(.*)(")$/;
print "CRITICAL - ($2)\n";
$mystatus = 2;
}
}

exit $mystatus;

Posted
Hello,

 

I've finally got around to installing nagios yesterday and all seems to be fine. I would like to monitor my printers (a xerox 8550DP and a brother mfc 8860), but I'm having trouble getting the check_snmp to work. I was wondering if anyone else has had any experience using nagios to monitor said printers.

 

Tom

 

I have just had the same problem with the snmp plugin.

you need to make sure that you have net-snmp installed on your system.

 

yum install net-snmp

yum install net-snmp-utils

yum install net-snmp-devel

 

with them installed reinstall you plugins and it should compile the check_snmp plugin:)

Posted

Thanks for the replies. Chris I'll give your script a go once I've finished kicking in GDI for a couple of hours ;-)

 

chekc_snmp does work and i knew that i would need an mib and believe i found the mib i would like to monitor but when i tried it did not work.

 

Like i said i'll give Chris's script a go...oh there is a standard call checkprinter mib or something like that.

 

"In the name of Kane"

  • 1 month later...
Posted
This script looks helpful, could someone please tell me the simple steps to make this work with nagios? I've attempted to make it an exec and put it in the commands.cfg file without success. thanks, and sorry for my ignorance.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...