2010-02-07 14:17:02 +00:00
|
|
|
<?php
|
2009-05-11 13:58:05 +00:00
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
$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']));
|
2015-07-01 08:14:23 +10:00
|
|
|
$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);
|
2010-07-07 14:34:44 +00:00
|
|
|
|
2015-02-25 15:54:37 -07:00
|
|
|
$charge = dbFetchCell("select count(*) from sensors WHERE sensor_class='charge' AND device_id = ?", array($device['device_id']));
|
2011-05-15 15:29:47 +00:00
|
|
|
$temperatures = dbFetchCell("select count(*) from sensors WHERE sensor_class='temperature' AND device_id = ?", array($device['device_id']));
|
|
|
|
$humidity = dbFetchCell("select count(*) from sensors WHERE sensor_class='humidity' AND device_id = ?", array($device['device_id']));
|
|
|
|
$fans = dbFetchCell("select count(*) from sensors WHERE sensor_class='fanspeed' AND device_id = ?", array($device['device_id']));
|
|
|
|
$volts = dbFetchCell("select count(*) from sensors WHERE sensor_class='voltage' AND device_id = ?", array($device['device_id']));
|
|
|
|
$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']));
|
2015-06-11 20:31:45 +02:00
|
|
|
$dBm = dbFetchCell("select count(*) from sensors WHERE sensor_class='dBm' AND device_id = ?", array($device['device_id']));
|
2015-05-19 01:04:17 +01:00
|
|
|
$states = dbFetchCell("select count(*) from sensors WHERE sensor_class='state' AND device_id = ?", array($device['device_id']));
|
2015-06-11 20:31:45 +02:00
|
|
|
$load = dbFetchCell("select count(*) from sensors WHERE sensor_class='load' AND device_id = ?", array($device['device_id']));
|
2016-03-22 10:37:07 -04:00
|
|
|
$signal = dbFetchCell("select count(*) from sensors WHERE sensor_class='signal' AND device_id = ?", array($device['device_id']));
|
2011-04-20 09:59:48 +00:00
|
|
|
|
2011-04-30 22:20:11 +00:00
|
|
|
unset($datas);
|
2010-06-12 16:48:53 +00:00
|
|
|
$datas[] = 'overview';
|
2015-07-13 20:10:26 +02:00
|
|
|
if ($processor) {
|
|
|
|
$datas[] = 'processor';
|
|
|
|
}
|
2011-09-19 09:02:25 +00:00
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
if ($mempools) {
|
|
|
|
$datas[] = 'mempool';
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($storage) {
|
|
|
|
$datas[] = 'storage';
|
|
|
|
}
|
2010-01-09 02:05:47 +00:00
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
if ($diskio) {
|
|
|
|
$datas[] = 'diskio';
|
|
|
|
}
|
2011-04-30 22:20:11 +00:00
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
if ($charge) {
|
|
|
|
$datas[] = 'charge';
|
|
|
|
}
|
2010-02-24 21:44:32 +00:00
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
if ($temperatures) {
|
|
|
|
$datas[] = 'temperature';
|
|
|
|
}
|
2010-06-12 16:48:53 +00:00
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
if ($humidity) {
|
|
|
|
$datas[] = 'humidity';
|
2010-01-09 02:05:47 +00:00
|
|
|
}
|
2009-08-07 16:10:52 +00:00
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
if ($fans) {
|
|
|
|
$datas[] = 'fanspeed';
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($volts) {
|
|
|
|
$datas[] = 'voltage';
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($freqs) {
|
|
|
|
$datas[] = 'frequency';
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($current) {
|
|
|
|
$datas[] = 'current';
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($power) {
|
|
|
|
$datas[] = 'power';
|
|
|
|
}
|
2009-05-11 13:58:05 +00:00
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
if ($dBm) {
|
|
|
|
$datas[] = 'dbm';
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($states) {
|
|
|
|
$datas[] = 'state';
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($load) {
|
|
|
|
$datas[] = 'load';
|
|
|
|
}
|
2012-04-26 16:32:34 +00:00
|
|
|
|
2016-03-22 10:37:07 -04:00
|
|
|
if ($signal) {
|
|
|
|
$datas[] = 'signal';
|
|
|
|
}
|
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
$type_text['overview'] = 'Overview';
|
|
|
|
$type_text['charge'] = 'Battery Charge';
|
|
|
|
$type_text['temperature'] = 'Temperature';
|
|
|
|
$type_text['humidity'] = 'Humidity';
|
|
|
|
$type_text['mempool'] = 'Memory';
|
|
|
|
$type_text['storage'] = 'Disk Usage';
|
|
|
|
$type_text['diskio'] = 'Disk I/O';
|
|
|
|
$type_text['processor'] = 'Processor';
|
|
|
|
$type_text['voltage'] = 'Voltage';
|
|
|
|
$type_text['fanspeed'] = 'Fanspeed';
|
|
|
|
$type_text['frequency'] = 'Frequency';
|
|
|
|
$type_text['current'] = 'Current';
|
|
|
|
$type_text['power'] = 'Power';
|
|
|
|
$type_text['dbm'] = 'dBm';
|
|
|
|
$type_text['state'] = 'State';
|
|
|
|
$type_text['load'] = 'Load';
|
2016-03-22 10:37:07 -04:00
|
|
|
$type_text['signal'] = 'Signal';
|
2015-07-13 20:10:26 +02:00
|
|
|
|
|
|
|
$link_array = array(
|
|
|
|
'page' => 'device',
|
|
|
|
'device' => $device['device_id'],
|
|
|
|
'tab' => 'health',
|
|
|
|
);
|
2012-04-26 16:32:34 +00:00
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
print_optionbar_start();
|
|
|
|
|
|
|
|
echo "<span style='font-weight: bold;'>Health</span> » ";
|
2012-04-06 13:56:23 +00:00
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
if (!$vars['metric']) {
|
|
|
|
$vars['metric'] = 'overview';
|
|
|
|
}
|
|
|
|
|
|
|
|
unset($sep);
|
|
|
|
foreach ($datas as $type) {
|
|
|
|
echo $sep;
|
|
|
|
|
|
|
|
if ($vars['metric'] == $type) {
|
|
|
|
echo '<span class="pagemenu-selected">';
|
|
|
|
}
|
|
|
|
|
|
|
|
echo generate_link($type_text[$type], $link_array, array('metric' => $type));
|
|
|
|
if ($vars['metric'] == $type) {
|
|
|
|
echo '</span>';
|
2010-06-12 16:48:53 +00:00
|
|
|
}
|
2015-07-13 20:10:26 +02:00
|
|
|
|
|
|
|
$sep = ' | ';
|
2010-02-24 21:44:32 +00:00
|
|
|
}
|
2009-05-11 13:58:05 +00:00
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
print_optionbar_end();
|
|
|
|
|
|
|
|
if (is_file('pages/device/health/'.mres($vars['metric']).'.inc.php')) {
|
|
|
|
include 'pages/device/health/'.mres($vars['metric']).'.inc.php';
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
foreach ($datas as $type) {
|
|
|
|
if ($type != 'overview') {
|
|
|
|
$graph_title = $type_text[$type];
|
|
|
|
$graph_array['type'] = 'device_'.$type;
|
|
|
|
|
|
|
|
include 'includes/print-device-graph.php';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-10-18 14:27:21 +00:00
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
$pagetitle[] = 'Health';
|