mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Added options for fping to retry and timeout
This commit is contained in:
@@ -41,6 +41,8 @@ $config['own_hostname'] = "localhost";
|
||||
|
||||
$config['rrdtool'] = "/usr/bin/rrdtool";
|
||||
$config['fping'] = "/usr/bin/fping";
|
||||
$config['fping_options']['retries'] = 3;
|
||||
$config['fping_options']['timeout'] = 500;
|
||||
$config['fping6'] = "/usr/bin/fping6";
|
||||
$config['snmpwalk'] = "/usr/bin/snmpwalk";
|
||||
$config['snmpget'] = "/usr/bin/snmpget";
|
||||
|
@@ -463,13 +463,20 @@ function isPingable($hostname,$device_id = FALSE)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$status = shell_exec($config['fping'] . " -e $hostname 2>/dev/null");
|
||||
$fping_params = '';
|
||||
if(is_numeric($config['fping_options']['retries']) || $config['fping_options']['retries'] > 1) {
|
||||
$fping_params .= ' -r ' . $config['fping_options']['retries'];
|
||||
}
|
||||
if(is_numeric($config['fping_options']['timeout']) || $config['fping_options']['timeout'] > 1) {
|
||||
$fping_params .= ' -t ' . $config['fping_options']['timeout'];
|
||||
}
|
||||
$status = shell_exec($config['fping'] . "$fping_params -e $hostname 2>/dev/null");
|
||||
$response = array();
|
||||
if (strstr($status, "alive"))
|
||||
{
|
||||
$response['result'] = TRUE;
|
||||
} else {
|
||||
$status = shell_exec($config['fping6'] . " -e $hostname 2>/dev/null");
|
||||
$status = shell_exec($config['fping6'] . "$fping_params -e $hostname 2>/dev/null");
|
||||
if (strstr($status, "alive"))
|
||||
{
|
||||
$response['result'] = TRUE;
|
||||
|
Reference in New Issue
Block a user