+ Post New Thread
Results 1 to 10 of 10
*nix Thread, nagios and snmp in Technical; Hello, I've finally got around to installing nagios yesterday and all seems to be fine. I would like to monitor ...
  1. #1

    Join Date
    Jan 2006
    Location
    Hertfordshire
    Posts
    151
    Thank Post
    2
    Thanked 8 Times in 8 Posts
    Rep Power
    19

    nagios and snmp

    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

  2. #2

    plexer's Avatar
    Join Date
    Dec 2005
    Location
    Norfolk
    Posts
    13,328
    Thank Post
    622
    Thanked 1,578 Times in 1,415 Posts
    Rep Power
    413
    You need to look at the mibs for those printers to see if you can find out what to monitor then add that to a check.

    Ben

  3. #3

    Ric_'s Avatar
    Join Date
    Jun 2005
    Location
    London
    Posts
    7,590
    Thank Post
    109
    Thanked 762 Times in 593 Posts
    Rep Power
    180
    You can run snmpwalk over them too to get the locations of the required info

  4. #4

    plexer's Avatar
    Join Date
    Dec 2005
    Location
    Norfolk
    Posts
    13,328
    Thank Post
    622
    Thanked 1,578 Times in 1,415 Posts
    Rep Power
    413
    Yes you can but you may not understand which snmp values to plug in to your check.

    Ben

  5. #5

    Geoff's Avatar
    Join Date
    Jun 2005
    Location
    Fylde, Lancs, UK.
    Posts
    11,802
    Thank Post
    110
    Thanked 583 Times in 504 Posts
    Blog Entries
    1
    Rep Power
    224
    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.

  6. #6
    ChrisH's Avatar
    Join Date
    Jun 2005
    Location
    East Lancs
    Posts
    4,998
    Thank Post
    120
    Thanked 280 Times in 258 Posts
    Rep Power
    106
    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.

    Code:
    #!/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;

  7. #7

    rush_tech's Avatar
    Join Date
    Jul 2006
    Location
    Nottingham
    Posts
    1,408
    Thank Post
    111
    Thanked 265 Times in 201 Posts
    Rep Power
    194
    Quote Originally Posted by uk101man View Post
    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

  8. #8

    plexer's Avatar
    Join Date
    Dec 2005
    Location
    Norfolk
    Posts
    13,328
    Thank Post
    622
    Thanked 1,578 Times in 1,415 Posts
    Rep Power
    413
    He wasn't neccessarily saying that check_snmp wasn't working but that he wanted to use it to check his snmp printers.

    Ben

  9. #9

    Join Date
    Jan 2006
    Location
    Hertfordshire
    Posts
    151
    Thank Post
    2
    Thanked 8 Times in 8 Posts
    Rep Power
    19

    thanks

    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"

  10. #10

    Join Date
    Apr 2008
    Location
    Washington, DC
    Posts
    1
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    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.

SHARE:
+ Post New Thread

Similar Threads

  1. Nagios - MRTG
    By rush_tech in forum *nix
    Replies: 5
    Last Post: 13th July 2010, 04:27 PM
  2. Replies: 51
    Last Post: 10th November 2009, 05:23 AM
  3. Cisco Aironet 1230v series. Recommended SNMP monitor
    By complete_phreak in forum Hardware
    Replies: 11
    Last Post: 11th April 2008, 10:12 AM
  4. Nagios Display
    By plexer in forum How do you do....it?
    Replies: 4
    Last Post: 17th July 2007, 07:43 PM
  5. snmp on isa2004
    By browolf in forum Windows
    Replies: 1
    Last Post: 11th May 2006, 09:26 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •