Added ping response graphs and some small updates

This commit is contained in:
laf
2014-09-30 19:13:50 +01:00
parent 6a1ebd9db4
commit 9a178363a0
5 changed files with 64 additions and 8 deletions
+15 -5
View File
@@ -459,23 +459,33 @@ function isSNMPable($device)
}
}
function isPingable($hostname)
function isPingable($hostname,$device_id)
{
global $config;
$status = shell_exec($config['fping'] . " $hostname 2>/dev/null");
$status = shell_exec($config['fping'] . " -e $hostname 2>/dev/null");
if (strstr($status, "alive"))
{
return TRUE;
if(is_numeric($device_id) && !empty($device_id))
{
preg_match('/(\d+\.*\d*) (ms)/', $status, $time);
$response['last_ping_timetaken'] = $time[1];
$response['result'] = TRUE;
}
else
{
$response['result'] = TRUE;
}
} else {
$status = shell_exec($config['fping6'] . " $hostname 2>/dev/null");
if (strstr($status, "alive"))
{
return TRUE;
$response['result'] = TRUE;
} else {
return FALSE;
$response['result'] = FALSE;
}
}
return($response);
}
function is_odd($number)