mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-28 08:02:41 +02:00
Removed ping + performance graphs and tab if skip ping check
This commit is contained in:
@@ -758,3 +758,19 @@ function round_Nth($val = 0, $round_to) {
|
||||
}
|
||||
} // end round_Nth
|
||||
|
||||
/**
|
||||
* Checks if config allows us to ping this device
|
||||
* $attribs contains an array of all of this devices
|
||||
* attributes
|
||||
* @param array $attribs Device attributes
|
||||
* @return bool
|
||||
**/
|
||||
function can_ping_device($attribs) {
|
||||
global $config;
|
||||
if ($config['icmp_check'] === true && $attribs['override_icmp_disable'] != "true") {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
} // end can_ping_device
|
||||
|
||||
@@ -487,13 +487,11 @@ function isSNMPable($device) {
|
||||
*
|
||||
* @return bool TRUE if the host responded to at least one ping request, FALSE otherwise.
|
||||
*/
|
||||
function isPingable($hostname, $address_family = AF_INET, $device_id = FALSE) {
|
||||
function isPingable($hostname, $address_family = AF_INET, $device_id = FALSE, $attribs = false) {
|
||||
global $config;
|
||||
|
||||
$tmp_device = array('device_id'=>$device_id);
|
||||
$response = array();
|
||||
if ($config['icmp_check'] === true && get_dev_attrib($tmp_device,'override_icmp_disable') != "true") {
|
||||
|
||||
if (can_ping_device($attribs) === true) {
|
||||
$fping_params = '';
|
||||
if(is_numeric($config['fping_options']['retries']) || $config['fping_options']['retries'] > 1) {
|
||||
$fping_params .= ' -r ' . $config['fping_options']['retries'];
|
||||
|
||||
@@ -155,7 +155,7 @@ function poll_device($device, $options) {
|
||||
|
||||
$address_family = snmpTransportToAddressFamily($device['transport']);
|
||||
|
||||
$ping_response = isPingable($device['hostname'], $address_family, $device['device_id']);
|
||||
$ping_response = isPingable($device['hostname'], $address_family, $device['device_id'], $attribs);
|
||||
|
||||
$device_perf = $ping_response['db'];
|
||||
$device_perf['device_id'] = $device['device_id'];
|
||||
@@ -265,23 +265,27 @@ function poll_device($device, $options) {
|
||||
}
|
||||
|
||||
// Ping response rrd
|
||||
$ping_rrd = $config['rrd_dir'].'/'.$device['hostname'].'/ping-perf.rrd';
|
||||
if (!is_file($ping_rrd)) {
|
||||
rrdtool_create($ping_rrd, 'DS:ping:GAUGE:600:0:65535 '.$config['rrd_rra']);
|
||||
}
|
||||
if (can_ping_device($attribs) === true) {
|
||||
$ping_rrd = $config['rrd_dir'].'/'.$device['hostname'].'/ping-perf.rrd';
|
||||
if (!is_file($ping_rrd)) {
|
||||
rrdtool_create($ping_rrd, 'DS:ping:GAUGE:600:0:65535 '.$config['rrd_rra']);
|
||||
}
|
||||
|
||||
if (!empty($ping_time)) {
|
||||
$fields = array(
|
||||
'ping' => $ping_time,
|
||||
);
|
||||
if (!empty($ping_time)) {
|
||||
$fields = array(
|
||||
'ping' => $ping_time,
|
||||
);
|
||||
|
||||
rrdtool_update($ping_rrd, $fields);
|
||||
}
|
||||
|
||||
$update_array['last_ping'] = array('NOW()');
|
||||
$update_array['last_ping_timetaken'] = $ping_time;
|
||||
|
||||
rrdtool_update($ping_rrd, $fields);
|
||||
}
|
||||
|
||||
$update_array['last_polled'] = array('NOW()');
|
||||
$update_array['last_polled_timetaken'] = $device_time;
|
||||
$update_array['last_ping'] = array('NOW()');
|
||||
$update_array['last_ping_timetaken'] = $ping_time;
|
||||
|
||||
// echo("$device_end - $device_start; $device_time $device_run");
|
||||
echo "Polled in $device_time seconds\n";
|
||||
|
||||
Reference in New Issue
Block a user