Page 1 of 1
check_website_speed
Posted: Tue Oct 09, 2012 10:49 am
by Melingo
hello,
i add a service that use the check_website_speed command '
i check the command on the nagios server (from the libexec folder) and it work great ,
on the new service i get always a null response .
what could be the problem ?
Re: check_website_speed
Posted: Tue Oct 09, 2012 11:28 am
by lmiltchev
Did you follow the steps outlined in
this document while adding the service?
Run the command in the command line, logged in as nagios user, and show us the output.
Also, show the output of the following command:
Re: check_website_speed
Posted: Wed Oct 10, 2012 4:04 am
by Melingo
thank for the replay
i checked again the command and i need to add "php" word
to the command at first .
But now i have another issue ,
i can't get performance graph for this command
it is possible and what should i do ?
Re: check_website_speed
Posted: Wed Oct 10, 2012 10:45 am
by scottwilkerson
Are you using this plugin?
http://exchange.nagios.org/directory/Pl ... ed/details
If so, I made a modified version I believe should work (untested)..
You will have to unzip to install it
check_website_speed.zip
Re: check_website_speed
Posted: Tue Oct 23, 2012 5:58 am
by Melingo
thank you very much it's working

Re: check_website_speed
Posted: Tue Oct 23, 2012 6:26 am
by gshergill
Hi everyone,
Sorry to jump onto your thread like this, but this isn't working for me.
I added the command via web interface;
Code: Select all
define command {
command_name check_website_speed
command_line php /usr/local/nagios/libexec/check_website_speed.php "$ARG1$" $ARG2$ $ARG3$
}
And the service;
Code: Select all
define service {
host_name hostname
service_description Google Website
use generic-service
display_name Google Website
check_command check_website_speed!google.com!3!5!!!!!
notifications_enabled 0
register 1
}
Web interface shows OK, but status information;
Left clicking, the service shows the following;
Code: Select all
<?
/*
* (c) 2009 by Michael Bladowski ([email protected])
* GPLv2, no warranty of any kind given.
*/
$url = $argv[1];
$warning = $argv[2];
$error = $argv[3];
$url = preg_replace('/\\s*/','',$url);
$warning = preg_replace('/\\s*/','',$warning);
$error = preg_replace('/\\s*/','',$error);
function microtime_float()
{
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}
$time_start = microtime_float();
$bla = file_get_contents($url);
$time_end = microtime_float();
$time = $time_end - $time_start;
print "Response Time: $time ";
if ($time<$warning) {
print "OK
This is, I believe, the check_website_speed.php plugin information.
Any idea what I'm doing wrong please?
Thank you.
Kind Regards,
Gary Shergill
EDIT: This shows website speed - Does it mean if the website is down it will come back with a critical error? Thanks
Re: check_website_speed
Posted: Tue Oct 23, 2012 7:17 pm
by scottwilkerson
try updating the first line of /usr/local/nagios/libexec/check_website_speed.php
to
<?php
Re: check_website_speed
Posted: Wed Oct 24, 2012 4:32 am
by gshergill
Hi scottwilkerson,
Thank you, that worked perfectly.
Was just wondering, if I enter a totally random website address, it still comes back with a positive result (even though the website doesn't exist).
Does this mean the plugin command hasn't been correctly entered by me? Or is this expected?
Thank you.
Kind Regards,
Gary Shergill
Re: check_website_speed
Posted: Wed Oct 24, 2012 10:54 am
by lmiltchev
That's to be expected - this script is only "based on time".
Re: check_website_speed
Posted: Thu Oct 25, 2012 3:47 am
by gshergill
Hi lmiltchev,
Thank you for the reply.
Kind Regards,
Gary Shergill