diff --git a/html/pages/device.inc.php b/html/pages/device.inc.php
index d5ccd5212..688a18900 100644
--- a/html/pages/device.inc.php
+++ b/html/pages/device.inc.php
@@ -353,11 +353,13 @@ if (device_permitted($vars['device']) || $check_device == $vars['device']) {
';
}
- echo '
-
-
Performance
-
- ';
+ if (can_ping_device($attribs) === true) {
+ echo '
+
+
Performance
+
+ ';
+ }
echo '
diff --git a/html/pages/device/graphs.inc.php b/html/pages/device/graphs.inc.php
index e4bd13d84..154cbbfb5 100644
--- a/html/pages/device/graphs.inc.php
+++ b/html/pages/device/graphs.inc.php
@@ -24,7 +24,9 @@ foreach (dbFetchRows('SELECT * FROM device_graphs WHERE device_id = ? ORDER BY g
// These are standard graphs we should have for all systems
$graph_enable['poller']['poller_perf'] = 'device_poller_perf';
-$graph_enable['poller']['ping_perf'] = 'device_ping_perf';
+if (can_ping_device($attribs) === true) {
+ $graph_enable['poller']['ping_perf'] = 'device_ping_perf';
+}
$sep = '';
foreach ($graph_enable as $section => $nothing) {
diff --git a/includes/common.php b/includes/common.php
index bcef46da0..248285600 100644
--- a/includes/common.php
+++ b/includes/common.php
@@ -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
diff --git a/includes/functions.php b/includes/functions.php
index 319adb074..d87d38536 100644
--- a/includes/functions.php
+++ b/includes/functions.php
@@ -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'];
diff --git a/includes/polling/functions.inc.php b/includes/polling/functions.inc.php
index bbdad009c..ca28abc79 100644
--- a/includes/polling/functions.inc.php
+++ b/includes/polling/functions.inc.php
@@ -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";