Changing check_http.c

Andrew Davis nccomp at gmail.com
Tue Apr 21 22:14:24 CEST 2009


My checkcommands.cfg has an "check_http" entry that looks like this:

    # 'check_http' command definition
    define command{
            command_name    check_http
            command_line    $USER1$/check_http -I $HOSTADDRESS$ $ARG1$
            }


My services.cfg has a correlating entry that looks like this:

    ## HTTP - alternate URL suffix
    define service {
            host_name                       server
            service_description             HTTP
            check_command                   check_http!-p 9090 -u /proteus
            ~
            action_url                     
    /nagios/pnp/index.php?host=$HOSTNAME$&srv=$SERVICEDESC$
    }


When I run this at the command line, I see:

    /usr/local/nagios/libexec/check_http -I server -p 9090 -u /proteus
    HTTP OK - HTTP/1.1 301 Moved Permanently - 0.002 second response
    time |time=0.002480s;;;0.000000 size=577B;;;0


So far, so good, but what I really want to see is the URL in the output. 
Obviously, looking at the test, I can combine the server name, port, and 
URL suffix to figure out the URL. Unfortunately, while I'm good at shell 
scripting and perl, I'm not a C guy and the http test (check_http) is 
written in C. Anyone know what I would change in check_http.c to have 
the output show something like this:

/usr/local/nagios/libexec/check_http -I server -p 9090 -u /proteus
HTTP OK - HTTP/1.1 301 Moved Permanently *http://server:9090/proteus* - 
0.002 second response time |time=0.002480s;;;0.000000 size=577B;;;0

Its one thing to be told that my website is down, but when I'm runnng 
multiple copies of Apache, Tomcat, and custom apps and hosting perhaps 
20 different URL's and port combinations, it would be a LOT more 
convenient if Nagios showed me which URL was failing in the output of 
the test.

-- 


  A. Davis
  Email:     nccomp at gmail.com

  "There is no limit to what a man can accomplish
   if he doesn't care who gets the credit." - Ronald Reagan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20090421/164a4ca4/attachment.html>
-------------- next part --------------
------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
-------------- next part --------------
_______________________________________________
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