Pantke, Cale wrote:

I have a link that looks like this http://hostnae:8080/login.jsp (I edited
the actual link on purpose) and I need to monitor that it is sending data
correctly when looking at it. I used the check_http command like this. status:/var/www# /opt/nagios/libexec/check_http -H 10.3.8.41 -u
http://hostnae:8080/login.jsp
HTTP CRITICAL: HTTP/1.1 500 Internal Server Error

However I know that when I go to that in a browser it pops up fine. Anyone
know of a solution to this? Is there a special plugin or command I can do
for a .jsp file? I looked for a plugin and I could only find "webinject"
which doesn't seem to work with Nagios.

You might want to try something like the attached Python script. It uses the lynx browser to get the page and search for a magic phrase. It's just a sketch but should give you an overview of another feasible approach to do HTTP checking.

Regards

--
Thibault GENESSAY
ALIADIS
www.aliadis.fr
Tel.  0870 723 724
Fax 04 72 13 90 40
#!/usr/bin/python
import sys
import os

def main(argc, argv):
    # set a 'magic' phrase to find in the page (static, command-line
    # defined, ...)
    magic = 'Welcome to the official Nagios'
    # parse the command line and extract the argument of the -H option
    # ...
    url = 'www.nagios.org'
    # ask lynx to get the page
    stdout = os.popen('lynx -dump '+url)
    for line in stdout:
        if magic in line:
            print "HTTP OK - Website up and running"
            return 0
    print "HTTP CRITICAL - Wooops, website screwed up"
    return 2

if __name__ == '__main__':
    retcode = 3
    try:
        retcode = main(len(sys.argv), sys.argv)
        if retcode < 0 or retcode > 3:
            retcode = 3
    except Exception, err:
        print "PYTHON ERROR - "+str(err)
        retcode = 2
    sys.exit(retcode)
else:
    print "Not an importable module. Please run 'check_http_lynx.py' from the 
command line"
    sys.exit(3)
    

Reply via email to