Montoring a domain and response time with Nagios

Hello all,

I would like to monitor domains and the response time from those domains with nagios. How could I do this with Nagios? Would it be a configuration with HTTP?

Thanks for the help…

Hi Geo

You could write a script that uses plain old “wget” to pull the webpage off the server, and time it from start to finish. Wget has an option to download everything from a URL, including any linked images, flash etc, so it emulates the user experience as they wait for the whole page to load. You can also throttle the bandwidth at which the page is downloaded to a specific limit if you so wish.

HTH

/S

I have started to play around with “wget” a bit and have got a working command that will test the download time. How would I take the writen skript and use that in a service check with nagios. This has always confused me, how one would use or combine a skript in a nagios command check. What would such a command look like? And how would you tell nagios to run the skript every time nagios ran the service check to compare the time of the download from the webpage with the preset threshold?

[EDIT: I have written a sricpt using “wget” for the service check…]

Hi Geo

[blockquote]
I have started to play around with “wget” a bit and have got a working command that will test the download time.
[/blockquote]
Nice one.
[blockquote]
How would I take the writen skript and use that in a service check with nagios. This has always confused me, how one would use or combine a skript in a nagios command check. What would such a command look like?
[/blockquote]
You will need to add the script into a command object in your command.cfg file, perhaps something like

# 'check_www_loadtime' command definition
define command{
        command_name    check_www_loadtime
        command_line    /path/to/myscript -u $ARG1$ -w $ARG2$ -c $ARG3$
        }

[blockquote]And how would you tell nagios to run the skript every time nagios ran the service check to compare the time of the download from the webpage with the preset threshold?[/blockquote]
…then you reference the command object in the service object definition as per normal, for example:

define service{
        use                     generic-service
        host_name          mywebserver
        service_description     Webpage Load Time
        check_command           check_www_loadtime!www.myurl.com!200!500
....
        }

Obviously I’ve no idea how you’ve created your script (bash? perl?) but assume for simplicity that it accepts three arguments, one (-u) for the URL you are timing, and a warning (-w) and critical (-c) value. The arguments are passed from the service description to the command object in the order that they are delimited (by the ! character - i.e, value after the first ‘!’ is $ARG1$, after the second is $ARG2$ and so on) so you end up running “myscript” with arguments -u www.myurl.com -w 200 -c 500. Nagios will call that every time the service check is required by your check schedule. Your script then needs to return an exit code back to nagios in the range 0-4 in order for it to tell nagios what the state of the check is i.e. exit code 0 = OK, exit code 1 = warning, and so forth.

Hopefully that should sort you out, although if you’ve just gone “Eh? Arguments? Exit Codes? Burble…” and you are using perl, then have a peek at the little scriptette about halfway down the replies here - should be enough there to unpick and re-use. If its a bash script though, can’t really proffer any useful advice as I don’t know how, mebey someone else will chime in if req’d…

Anyway, HTH

/S