From fe8453b40461242c151e7ffacb4b433a8a6b5288 Mon Sep 17 00:00:00 2001 From: Mike Rostermund Date: Thu, 11 Jun 2015 20:29:14 +0200 Subject: [PATCH 1/4] Fix use of check_valid_sensors for load sensors --- includes/discovery/load.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/discovery/load.inc.php b/includes/discovery/load.inc.php index 234d75c93..f9f22eb5f 100644 --- a/includes/discovery/load.inc.php +++ b/includes/discovery/load.inc.php @@ -8,7 +8,7 @@ include("includes/include-dir.inc.php"); if ($debug) { print_r($valid['sensor']['load']); } -check_valid_sensors($device, 'load', $valid['load']); +check_valid_sensors($device, 'load', $valid['sensor']); echo("\n"); From cd3c56863b113a9bc84abe6c6df7618dba5288f1 Mon Sep 17 00:00:00 2001 From: Mike Rostermund Date: Thu, 11 Jun 2015 20:31:45 +0200 Subject: [PATCH 2/4] Added a load tab on device->health --- html/includes/graphs/device/load.inc.php | 9 +++++++++ html/includes/graphs/sensor/load.inc.php | 23 +++++++++++++++++++++++ html/pages/device/health.inc.php | 5 ++++- html/pages/device/health/load.inc.php | 9 +++++++++ 4 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 html/includes/graphs/device/load.inc.php create mode 100644 html/includes/graphs/sensor/load.inc.php create mode 100644 html/pages/device/health/load.inc.php diff --git a/html/includes/graphs/device/load.inc.php b/html/includes/graphs/device/load.inc.php new file mode 100644 index 000000000..a8b27356c --- /dev/null +++ b/html/includes/graphs/device/load.inc.php @@ -0,0 +1,9 @@ + diff --git a/html/includes/graphs/sensor/load.inc.php b/html/includes/graphs/sensor/load.inc.php new file mode 100644 index 000000000..79d051e5c --- /dev/null +++ b/html/includes/graphs/sensor/load.inc.php @@ -0,0 +1,23 @@ + diff --git a/html/pages/device/health.inc.php b/html/pages/device/health.inc.php index ec31f0d73..2ad89eb6d 100644 --- a/html/pages/device/health.inc.php +++ b/html/pages/device/health.inc.php @@ -13,8 +13,9 @@ $volts = dbFetchCell("select count(*) from sensors WHERE sensor_class='vo $current = dbFetchCell("select count(*) from sensors WHERE sensor_class='current' AND device_id = ?", array($device['device_id'])); $freqs = dbFetchCell("select count(*) from sensors WHERE sensor_class='frequency' AND device_id = ?", array($device['device_id'])); $power = dbFetchCell("select count(*) from sensors WHERE sensor_class='power' AND device_id = ?", array($device['device_id'])); -$dBm = dbFetchCell("select count(*) from sensors WHERE sensor_class='dBm' AND device_id = ?", array($device['device_id'])); +$dBm = dbFetchCell("select count(*) from sensors WHERE sensor_class='dBm' AND device_id = ?", array($device['device_id'])); $states = dbFetchCell("select count(*) from sensors WHERE sensor_class='state' AND device_id = ?", array($device['device_id'])); +$load = dbFetchCell("select count(*) from sensors WHERE sensor_class='load' AND device_id = ?", array($device['device_id'])); unset($datas); $datas[] = 'overview'; @@ -32,6 +33,7 @@ if ($current) { $datas[] = 'current'; } if ($power) { $datas[] = 'power'; } if ($dBm) { $datas[] = 'dbm'; } if ($states) { $datas[] = 'state'; } +if ($load) { $datas[] = 'load'; } $type_text['overview'] = "Overview"; $type_text['charge'] = "Battery Charge"; @@ -48,6 +50,7 @@ $type_text['current'] = "Current"; $type_text['power'] = "Power"; $type_text['dbm'] = "dBm"; $type_text['state'] = "State"; +$type_text['load'] = "Load"; $link_array = array('page' => 'device', 'device' => $device['device_id'], diff --git a/html/pages/device/health/load.inc.php b/html/pages/device/health/load.inc.php new file mode 100644 index 000000000..399237aae --- /dev/null +++ b/html/pages/device/health/load.inc.php @@ -0,0 +1,9 @@ + From 4536bd24fb90a7180c6bd7a2a19d1e36718faa67 Mon Sep 17 00:00:00 2001 From: Mike Rostermund Date: Thu, 11 Jun 2015 20:52:12 +0200 Subject: [PATCH 3/4] Added health->load page and added it to the list of tabs on /health/ --- html/pages/health.inc.php | 2 ++ html/pages/health/load.inc.php | 9 +++++++++ 2 files changed, 11 insertions(+) create mode 100644 html/pages/health/load.inc.php diff --git a/html/pages/health.inc.php b/html/pages/health.inc.php index 6d4427fb3..3b06d4db6 100644 --- a/html/pages/health.inc.php +++ b/html/pages/health.inc.php @@ -10,6 +10,7 @@ if ($used_sensors['frequency']) $datas[] = 'frequency'; if ($used_sensors['current']) $datas[] = 'current'; if ($used_sensors['power']) $datas[] = 'power'; if ($used_sensors['dbm']) $datas[] = 'dbm'; +if ($used_sensors['load']) $datas[] = 'load'; // FIXME generalize -> static-config ? $type_text['overview'] = "Overview"; @@ -27,6 +28,7 @@ $type_text['current'] = "Current"; $type_text['power'] = "Power"; $type_text['toner'] = "Toner"; $type_text['dbm'] = "dBm"; +$type_text['load'] = "Load"; if (!$vars['metric']) { $vars['metric'] = "processor"; } if (!$vars['view']) { $vars['view'] = "detail"; } diff --git a/html/pages/health/load.inc.php b/html/pages/health/load.inc.php new file mode 100644 index 000000000..d9257519d --- /dev/null +++ b/html/pages/health/load.inc.php @@ -0,0 +1,9 @@ + From 81611babd395a4b3f36002c8efbdffb56af7a6a9 Mon Sep 17 00:00:00 2001 From: Mike Rostermund Date: Thu, 11 Jun 2015 20:59:35 +0200 Subject: [PATCH 4/4] Remove grey area from load graph --- html/includes/graphs/sensor/load.inc.php | 1 - 1 file changed, 1 deletion(-) diff --git a/html/includes/graphs/sensor/load.inc.php b/html/includes/graphs/sensor/load.inc.php index 79d051e5c..095f0eb2e 100644 --- a/html/includes/graphs/sensor/load.inc.php +++ b/html/includes/graphs/sensor/load.inc.php @@ -11,7 +11,6 @@ $rrd_options .= " DEF:sensor=$rrd_filename:sensor:AVERAGE"; $rrd_options .= " DEF:sensor_max=$rrd_filename:sensor:MAX"; $rrd_options .= " DEF:sensor_min=$rrd_filename:sensor:MIN"; $rrd_options .= " CDEF:sensorcold=sensor_min,20,LT,sensor,UNKN,IF"; -$rrd_options .= " AREA:sensor_max#c5c5c5"; $rrd_options .= " AREA:sensor_min#ffffffff"; $rrd_options .= " LINE1:sensor#cc0000:'" . rrdtool_escape($sensor['sensor_descr'],28)."'"; $rrd_options .= " GPRINT:sensor:LAST:%3.0lf%%";