mirror of
https://github.com/stylersnico/librenms.git
synced 2026-08-02 00:32:09 +02:00
Updated ping rrd response to include fping6 response
This commit is contained in:
+7
-11
@@ -466,18 +466,9 @@ function isPingable($hostname,$device_id)
|
|||||||
$status = shell_exec($config['fping'] . " -e $hostname 2>/dev/null");
|
$status = shell_exec($config['fping'] . " -e $hostname 2>/dev/null");
|
||||||
if (strstr($status, "alive"))
|
if (strstr($status, "alive"))
|
||||||
{
|
{
|
||||||
if(is_numeric($device_id) && !empty($device_id))
|
$response['result'] = TRUE;
|
||||||
{
|
|
||||||
preg_match('/(\d+\.*\d*) (ms)/', $status, $time);
|
|
||||||
$response['last_ping_timetaken'] = $time[1];
|
|
||||||
$response['result'] = TRUE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$response['result'] = TRUE;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
$status = shell_exec($config['fping6'] . " $hostname 2>/dev/null");
|
$status = shell_exec($config['fping6'] . " -e $hostname 2>/dev/null");
|
||||||
if (strstr($status, "alive"))
|
if (strstr($status, "alive"))
|
||||||
{
|
{
|
||||||
$response['result'] = TRUE;
|
$response['result'] = TRUE;
|
||||||
@@ -485,6 +476,11 @@ function isPingable($hostname,$device_id)
|
|||||||
$response['result'] = FALSE;
|
$response['result'] = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(is_numeric($device_id) && !empty($device_id))
|
||||||
|
{
|
||||||
|
preg_match('/(\d+\.*\d*) (ms)/', $status, $time);
|
||||||
|
$response['last_ping_timetaken'] = $time[1];
|
||||||
|
}
|
||||||
return($response);
|
return($response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user