+ Post New Thread
Results 1 to 4 of 4
*nix Thread, nagios: Some plugin questions (HP 2605N) in Technical; Ive got this php plugin to check hp printers for nagios but im not too sure how to implement it ...
  1. #1

    RabbieBurns's Avatar
    Join Date
    Apr 2008
    Location
    Sydney
    Posts
    5,532
    Thank Post
    1,341
    Thanked 470 Times in 307 Posts
    Blog Entries
    6
    Rep Power
    200

    nagios: Some plugin questions (HP 2605N)

    Ive got this php plugin to check hp printers for nagios but im not too sure how to implement it

    http://plextech.co.uk/wp-content/upl...eck_hp2600.txt (Rename to php)

    what do i need to put in the commands.cfg and the printer.cfg to call this php script?

    Thanks in advance
    Last edited by RabbieBurns; 11th November 2009 at 05:50 AM.

  2. #2
    bmike78's Avatar
    Join Date
    Aug 2010
    Location
    Davenport, IA
    Posts
    4
    Thank Post
    0
    Thanked 2 Times in 2 Posts
    Rep Power
    0
    RabbieBurns,

    This looks like a php script that is run via shell to return exit codes. Nagios then interprets these exit codes as:

    0 OK
    1 WARNING
    2 CRITICAL
    anything else as Unknown

    Having written custom checks before, Nagios is just looking for these exit codes to determine if the threshold you're defining is 0,1,2 and based on this return code, it knows what to do and what to display.

    Here are the variables you need to pass:

    function usage($msg)
    {
    print(basename($_SERVER["argv"][0]) . " v" . VERSION . " (" . VERDATE .")\n\n");
    print(basename($_SERVER["argv"][0]) . " -H <host> -c <critspec> -w <warnspec>\n");
    print(" -H <host> Host to check (IP Address)\n");
    print(" -c <critspec> Critical toner threshold (percentage of remaining toner)\n");
    print(" -w <warnspec> Warning toner threshold (percentage of remaining toner\n");

    You'll want to set something up in commands.cfg like so:

    define command{
    command_name check_hp2600
    command_line /usr/bin/php /usr/lib/nagios/plugins/check_hp_2600.php -H '$HOSTADDRESS$' -c 10 -w 20
    }


    As an example, I'm saying 10% toner left is critical, 20% left is warning and your php binary is located in /usr/bin/

    Then you will want to define this check in your printer.cfg file (guessing this is where you have your printer hosts defined.

    # check_hp2600 check
    define service{
    use generic-service
    hostgroup hp2600_printers
    service_description HP 2600 Toner Level
    check_command check_hp2600
    }

    You just need to put all the hp2600 printers in their own hostgroup called hp2600_printers and the check should work. If you have problems, then try running the command from the Nagios server's shell:

    /usr/bin/php /usr/lib/nagios/plugins/check_hp_2600.php -H <ip_addr of printer> -c 10 -w 20

  3. Thanks to bmike78 from:

    RabbieBurns (16th August 2010)

  4. #3
    bmike78's Avatar
    Join Date
    Aug 2010
    Location
    Davenport, IA
    Posts
    4
    Thank Post
    0
    Thanked 2 Times in 2 Posts
    Rep Power
    0
    Forgot to add this... at the top of the php script, it's going to put some temp files here.

    // Directory for temp files with / at the end
    $directory_for_temp_files = "/usr/local/groundwork/nagios/libexec/temp/";

    You may need to change to be a directory that you have in your filesystem...

  5. Thanks to bmike78 from:

    RabbieBurns (16th August 2010)

  6. #4

    RabbieBurns's Avatar
    Join Date
    Apr 2008
    Location
    Sydney
    Posts
    5,532
    Thank Post
    1,341
    Thanked 470 Times in 307 Posts
    Blog Entries
    6
    Rep Power
    200
    Thanks for the reply. I should really have posted my solution back when I got it working, sorry..

    Although we are now phasing out the 2600's anyway...



SHARE:
+ Post New Thread

Similar Threads

  1. firefox plugin
    By browolf in forum Internet Related/Filtering/Firewall
    Replies: 3
    Last Post: 18th September 2009, 09:00 PM
  2. Nagios plugin enable/disable interface
    By plexer in forum Wireless Networks
    Replies: 1
    Last Post: 4th March 2008, 02:54 PM
  3. Joomla Plugin
    By Lee_K_81 in forum Web Development
    Replies: 2
    Last Post: 4th October 2007, 04:23 PM
  4. check_mem plugin for nagios help
    By Geoff in forum *nix
    Replies: 4
    Last Post: 29th June 2007, 04:04 PM
  5. Has anyone tried this Moodle plugin?
    By beeswax in forum Virtual Learning Platforms
    Replies: 1
    Last Post: 14th November 2006, 07:49 PM

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
  •