diff --git a/html/pages/device.inc.php b/html/pages/device.inc.php
index 1a68f9dbf3..1bd0326842 100644
--- a/html/pages/device.inc.php
+++ b/html/pages/device.inc.php
@@ -57,7 +57,11 @@ if (device_permitted($vars['device']) || $check_device == $vars['device']) {
';
- $health = (dbFetchCell("SELECT COUNT(*) FROM storage WHERE device_id = '".$device['device_id']."'") + dbFetchCell("SELECT COUNT(sensor_id) FROM sensors WHERE device_id = '".$device['device_id']."'") + dbFetchCell("SELECT COUNT(*) FROM mempools WHERE device_id = '".$device['device_id']."'") + dbFetchCell("SELECT COUNT(*) FROM processors WHERE device_id = '".$device['device_id']."'"));
+ $health = dbFetchCell("SELECT COUNT(*) FROM storage WHERE device_id = '" . $device['device_id'] . "'") +
+ dbFetchCell("SELECT COUNT(sensor_id) FROM sensors WHERE device_id = '" . $device['device_id'] . "'") +
+ dbFetchCell("SELECT COUNT(*) FROM mempools WHERE device_id = '" . $device['device_id'] . "'") +
+ dbFetchCell("SELECT COUNT(*) FROM processors WHERE device_id = '" . $device['device_id'] . "'") +
+ count_mib_health($device);
if ($health) {
echo '
diff --git a/html/pages/device/graphs.inc.php b/html/pages/device/graphs.inc.php
index 154cbbfb51..8c8512b50e 100644
--- a/html/pages/device/graphs.inc.php
+++ b/html/pages/device/graphs.inc.php
@@ -22,11 +22,7 @@ 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';
-if (can_ping_device($attribs) === true) {
- $graph_enable['poller']['ping_perf'] = 'device_ping_perf';
-}
+enable_graphs($device, $graph_enable);
$sep = '';
foreach ($graph_enable as $section => $nothing) {
@@ -56,7 +52,6 @@ print_optionbar_end();
$graph_enable = $graph_enable[$vars['group']];
-// foreach ($config['graph_types']['device'] as $graph => $entry)
foreach ($graph_enable as $graph => $entry) {
$graph_array = array();
if ($graph_enable[$graph]) {
diff --git a/html/pages/device/health.inc.php b/html/pages/device/health.inc.php
index 794ff9a8d0..21f41389b2 100644
--- a/html/pages/device/health.inc.php
+++ b/html/pages/device/health.inc.php
@@ -2,8 +2,8 @@
$storage = dbFetchCell('select count(*) from storage WHERE device_id = ?', array($device['device_id']));
$diskio = dbFetchCell('select count(*) from ucd_diskio WHERE device_id = ?', array($device['device_id']));
-$mempools = dbFetchCell('select count(*) from mempools WHERE device_id = ?', array($device['device_id']));
-$processor = dbFetchCell('select count(*) from processors WHERE device_id = ?', array($device['device_id']));
+$mempools = dbFetchCell('select count(*) from mempools WHERE device_id = ?', array($device['device_id'])) + count_mib_mempools($device);
+$processor = dbFetchCell('select count(*) from processors WHERE device_id = ?', array($device['device_id'])) + count_mib_processors($device);
$charge = dbFetchCell("select count(*) from sensors WHERE sensor_class='charge' AND device_id = ?", array($device['device_id']));
$temperatures = dbFetchCell("select count(*) from sensors WHERE sensor_class='temperature' AND device_id = ?", array($device['device_id']));
diff --git a/includes/common.php b/includes/common.php
index 222be702bc..b32b46a263 100644
--- a/includes/common.php
+++ b/includes/common.php
@@ -739,6 +739,67 @@ function round_Nth($val = 0, $round_to) {
}
} // end round_Nth
+function count_mib_mempools($device)
+{
+ if ($device['os'] == 'ruckuswireless') {
+ return 1;
+ }
+ return 0;
+}
+
+function count_mib_processors($device)
+{
+ if ($device['os'] == 'ruckuswireless') {
+ return 1;
+ }
+ return 0;
+}
+
+function count_mib_health($device)
+{
+ return count_mib_mempools($device) + count_mib_processors($device);
+}
+
+/*
+ * @return true if there is a custom graph defined for this type, subtype, and device
+ */
+function is_custom_graph($type, $subtype, $device)
+{
+ if ($device['os'] == 'ruckuswireless' && $type == 'device') {
+ switch ($subtype) {
+ case 'cpumem':
+ case 'mempool':
+ case 'processor':
+ return true;
+ }
+ }
+ return false;
+}
+
+/*
+ * Set section/graph entries in $graph_enable for graphs specific to $os.
+ */
+function enable_os_graphs($os, &$graph_enable)
+{
+ /*
+ foreach (dbFetchRows("SELECT * FROM graph_conditions WHERE graph_type = 'device' AND condition_name = 'os' AND condition_value = ?", array($os)) as $graph) {
+ $graph_enable[$graph['graph_section']][$graph['graph_subtype']] = "device_".$graph['graph_subtype'];
+ }
+ */
+}
+
+/*
+ * For each os-based or global graph relevant to $device, set its section/graph entry in $graph_enable.
+ */
+function enable_graphs($device, &$graph_enable)
+{
+ // 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';
+
+ enable_os_graphs($device['os'], $graph_enable);
+}
+
/**
* Checks if config allows us to ping this device
* $attribs contains an array of all of this devices