2010-02-09 16:36:06 +00:00
|
|
|
<?php
|
2017-12-24 22:18:48 +02:00
|
|
|
/*
|
|
|
|
* LibreNMS
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by the
|
|
|
|
* Free Software Foundation, either version 3 of the License, or (at your
|
|
|
|
* option) any later version. Please see LICENSE.txt at the top level of
|
|
|
|
* the source code distribution for details.
|
|
|
|
*
|
|
|
|
* @package LibreNMS
|
|
|
|
* @subpackage webui
|
|
|
|
* @link http://librenms.org
|
|
|
|
* @copyright 2017 LibreNMS
|
|
|
|
* @author LibreNMS Contributors
|
|
|
|
*/
|
2010-02-09 16:36:06 +00:00
|
|
|
|
2014-01-13 10:05:19 +00:00
|
|
|
$datas = array('mempool','processor','storage');
|
2016-08-18 20:28:22 -05:00
|
|
|
if ($used_sensors['temperature']) {
|
|
|
|
$datas[] = 'temperature';
|
|
|
|
}
|
|
|
|
if ($used_sensors['charge']) {
|
|
|
|
$datas[] = 'charge';
|
|
|
|
}
|
|
|
|
if ($used_sensors['humidity']) {
|
|
|
|
$datas[] = 'humidity';
|
|
|
|
}
|
|
|
|
if ($used_sensors['fanspeed']) {
|
|
|
|
$datas[] = 'fanspeed';
|
|
|
|
}
|
|
|
|
if ($used_sensors['voltage']) {
|
|
|
|
$datas[] = 'voltage';
|
|
|
|
}
|
|
|
|
if ($used_sensors['frequency']) {
|
|
|
|
$datas[] = 'frequency';
|
|
|
|
}
|
2016-09-19 11:04:02 -04:00
|
|
|
if ($used_sensors['runtime']) {
|
|
|
|
$datas[] = 'runtime';
|
|
|
|
}
|
2016-08-18 20:28:22 -05:00
|
|
|
if ($used_sensors['current']) {
|
|
|
|
$datas[] = 'current';
|
|
|
|
}
|
|
|
|
if ($used_sensors['power']) {
|
|
|
|
$datas[] = 'power';
|
|
|
|
}
|
|
|
|
if ($used_sensors['dbm']) {
|
|
|
|
$datas[] = 'dbm';
|
|
|
|
}
|
|
|
|
if ($used_sensors['load']) {
|
|
|
|
$datas[] = 'load';
|
|
|
|
}
|
|
|
|
if ($used_sensors['state']) {
|
|
|
|
$datas[] = 'state';
|
|
|
|
}
|
|
|
|
if ($used_sensors['signal']) {
|
|
|
|
$datas[] = 'signal';
|
|
|
|
}
|
2017-05-23 16:28:45 +01:00
|
|
|
if ($used_sensors['snr']) {
|
|
|
|
$datas[] = 'snr';
|
|
|
|
}
|
2017-09-29 21:13:27 +01:00
|
|
|
if ($used_sensors['pressure']) {
|
|
|
|
$datas[] = 'pressure';
|
|
|
|
}
|
|
|
|
if ($used_sensors['cooling']) {
|
|
|
|
$datas[] = 'cooling';
|
|
|
|
}
|
2017-10-31 20:31:56 +00:00
|
|
|
if ($used_sensors['toner']) {
|
|
|
|
$datas[] = 'toner';
|
|
|
|
}
|
2017-12-13 03:27:10 +01:00
|
|
|
if ($used_sensors['delay']) {
|
|
|
|
$datas[] = 'delay';
|
|
|
|
}
|
|
|
|
if ($used_sensors['quality_factor']) {
|
|
|
|
$datas[] = 'quality_factor';
|
|
|
|
}
|
|
|
|
if ($used_sensors['chromatic_dispersion']) {
|
|
|
|
$datas[] = 'chromatic_dispersion';
|
|
|
|
}
|
|
|
|
if ($used_sensors['ber']) {
|
|
|
|
$datas[] = 'ber';
|
|
|
|
}
|
2011-04-09 14:22:43 +00:00
|
|
|
|
|
|
|
$type_text['overview'] = "Overview";
|
|
|
|
$type_text['temperature'] = "Temperature";
|
2015-02-25 15:54:37 -07:00
|
|
|
$type_text['charge'] = "Battery Charge";
|
2011-04-09 14:22:43 +00:00
|
|
|
$type_text['humidity'] = "Humidity";
|
|
|
|
$type_text['mempool'] = "Memory";
|
2015-06-02 19:42:08 +02:00
|
|
|
$type_text['storage'] = "Storage";
|
2011-04-09 14:22:43 +00:00
|
|
|
$type_text['diskio'] = "Disk I/O";
|
|
|
|
$type_text['processor'] = "Processor";
|
2011-04-13 14:12:57 +00:00
|
|
|
$type_text['voltage'] = "Voltage";
|
2011-04-09 14:22:43 +00:00
|
|
|
$type_text['fanspeed'] = "Fanspeed";
|
|
|
|
$type_text['frequency'] = "Frequency";
|
2016-09-19 11:04:02 -04:00
|
|
|
$type_text['runtime'] = "Runtime";
|
2011-04-09 14:22:43 +00:00
|
|
|
$type_text['current'] = "Current";
|
2011-04-20 09:59:48 +00:00
|
|
|
$type_text['power'] = "Power";
|
2011-09-23 13:54:40 +00:00
|
|
|
$type_text['toner'] = "Toner";
|
2015-06-02 19:06:15 +02:00
|
|
|
$type_text['dbm'] = "dBm";
|
2015-06-11 20:52:12 +02:00
|
|
|
$type_text['load'] = "Load";
|
2016-02-27 02:35:28 +01:00
|
|
|
$type_text['state'] = "State";
|
2016-03-22 10:37:07 -04:00
|
|
|
$type_text['signal'] = "Signal";
|
2017-05-23 16:28:45 +01:00
|
|
|
$type_text['snr'] = "SNR";
|
2017-09-29 21:13:27 +01:00
|
|
|
$type_text['pressure'] = "Pressure";
|
|
|
|
$type_text['cooling'] = "Cooling";
|
2017-10-31 20:31:56 +00:00
|
|
|
$type_text['toner'] = 'Toner';
|
2017-12-13 03:27:10 +01:00
|
|
|
$type_text['delay'] = 'Delay';
|
|
|
|
$type_text['quality_factor'] = 'Quality factor';
|
|
|
|
$type_text['chromatic_dispersion'] = 'Chromatic Dispersion';
|
|
|
|
$type_text['ber'] = 'Bit Error Rate';
|
2010-04-11 13:45:19 +00:00
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
if (!$vars['metric']) {
|
|
|
|
$vars['metric'] = "processor";
|
|
|
|
}
|
|
|
|
if (!$vars['view']) {
|
|
|
|
$vars['view'] = "detail";
|
|
|
|
}
|
2011-09-18 13:11:04 +00:00
|
|
|
|
|
|
|
$link_array = array('page' => 'health');
|
2010-06-12 12:07:16 +00:00
|
|
|
|
2017-12-24 22:18:48 +02:00
|
|
|
$navbar = '<span style="font-weight: bold;">Health</span> » ';
|
2010-03-06 01:32:41 +00:00
|
|
|
$sep = "";
|
2015-07-13 20:10:26 +02:00
|
|
|
foreach ($datas as $texttype) {
|
|
|
|
$metric = strtolower($texttype);
|
2017-12-24 22:18:48 +02:00
|
|
|
$navbar .= $sep;
|
2015-07-13 20:10:26 +02:00
|
|
|
if ($vars['metric'] == $metric) {
|
2017-12-24 22:18:48 +02:00
|
|
|
$navbar .= '<span class="pagemenu-selected">';
|
2015-07-13 20:10:26 +02:00
|
|
|
}
|
2017-12-24 22:18:48 +02:00
|
|
|
$navbar .= generate_link($type_text[$metric], $link_array, array('metric'=> $metric, 'view' => $vars['view']));
|
2015-07-13 20:10:26 +02:00
|
|
|
if ($vars['metric'] == $metric) {
|
2017-12-24 22:18:48 +02:00
|
|
|
$navbar .= '</span>';
|
2015-07-13 20:10:26 +02:00
|
|
|
}
|
|
|
|
$sep = ' | ';
|
2010-02-11 01:48:55 +00:00
|
|
|
}
|
2016-08-18 20:28:22 -05:00
|
|
|
unset($sep);
|
2010-02-11 01:48:55 +00:00
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
if ($vars['view'] == "graphs") {
|
2017-12-24 22:18:48 +02:00
|
|
|
$displayoptions = '<span class="pagemenu-selected">';
|
2010-06-12 14:18:56 +00:00
|
|
|
}
|
2017-12-24 22:18:48 +02:00
|
|
|
|
|
|
|
$displayoptions .= generate_link("Graphs", $link_array, array('metric'=> $vars['metric'], 'view' => "graphs"));
|
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
if ($vars['view'] == "graphs") {
|
2017-12-24 22:18:48 +02:00
|
|
|
$displayoptions .= '</span>';
|
2011-03-17 00:09:20 +00:00
|
|
|
}
|
|
|
|
|
2017-12-24 22:18:48 +02:00
|
|
|
$displayoptions .= ' | ';
|
2011-03-17 00:09:20 +00:00
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
if ($vars['view'] != "graphs") {
|
2017-12-24 22:18:48 +02:00
|
|
|
$displayoptions .= '<span class="pagemenu-selected">';
|
2010-06-12 14:18:56 +00:00
|
|
|
}
|
2011-03-17 00:09:20 +00:00
|
|
|
|
2017-12-24 22:18:48 +02:00
|
|
|
$displayoptions .= generate_link("No Graphs", $link_array, array('metric'=> $vars['metric'], 'view' => "detail"));
|
2010-02-11 01:48:55 +00:00
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
if ($vars['view'] != "graphs") {
|
2017-12-24 22:18:48 +02:00
|
|
|
$displayoptions .= '</span>';
|
2011-04-09 12:35:24 +00:00
|
|
|
}
|
2010-02-11 01:48:55 +00:00
|
|
|
|
2016-08-18 20:28:22 -05:00
|
|
|
if (in_array($vars['metric'], array_keys($used_sensors))
|
2015-07-13 20:10:26 +02:00
|
|
|
|| $vars['metric'] == 'processor'
|
|
|
|
|| $vars['metric'] == 'storage'
|
|
|
|
|| $vars['metric'] == 'toner'
|
|
|
|
|| $vars['metric'] == 'mempool') {
|
|
|
|
include('pages/health/'.$vars['metric'].'.inc.php');
|
2016-08-18 20:28:22 -05:00
|
|
|
} else {
|
2015-07-13 20:10:26 +02:00
|
|
|
echo("No sensors of type " . $vars['metric'] . " found.");
|
2010-02-09 16:36:06 +00:00
|
|
|
}
|