mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
* Remove legacy index php file * fix routing page missing data * WIP * fix $navbar global usage * remove global use of $locations * ObjectCache again... * move vars.inc.php to init.php for legacy ajax * navbar is more local than I thought before. Fix it. * Fix some sensors tables escaping * restore custom menu functionality, but with blade and docs * cleanup * tidy menu @if checks * Fix up the rest of the global variables and remove print-menubar.php * consolidate some counting in the menu * filter out empty custom port descr types * Fix up custom port groups * Fix up apps menu * Fix services menu when all are ok * Limit cached data to the user it is for * Fix style * A few clean ups * fix pseudowire bug
114 lines
3.0 KiB
PHP
114 lines
3.0 KiB
PHP
<?php
|
|
/*
|
|
* 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
|
|
*/
|
|
|
|
$no_refresh = true;
|
|
|
|
$datas = ['mempool','processor','storage'];
|
|
|
|
$used_sensors = \LibreNMS\Util\ObjectCache::sensors();
|
|
foreach ($used_sensors as $group => $types) {
|
|
foreach ($types as $entry) {
|
|
$datas[] = $entry['class'];
|
|
}
|
|
}
|
|
|
|
$type_text = [
|
|
'overview' => "Overview",
|
|
'temperature' => "Temperature",
|
|
'charge' => "Battery Charge",
|
|
'humidity' => "Humidity",
|
|
'mempool' => "Memory",
|
|
'storage' => "Storage",
|
|
'diskio' => "Disk I/O",
|
|
'processor' => "Processor",
|
|
'voltage' => "Voltage",
|
|
'fanspeed' => "Fanspeed",
|
|
'frequency' => "Frequency",
|
|
'runtime' => "Runtime",
|
|
'current' => "Current",
|
|
'power' => "Power",
|
|
'power_consumed' => "Power Consumed",
|
|
'power_factor' => "Power Factor",
|
|
'dbm' => "dBm",
|
|
'load' => "Load",
|
|
'state' => "State",
|
|
'count' => "Count",
|
|
'signal' => "Signal",
|
|
'snr' => "SNR",
|
|
'pressure' => "Pressure",
|
|
'cooling' => "Cooling",
|
|
'toner' => 'Toner',
|
|
'delay' => 'Delay',
|
|
'quality_factor' => 'Quality factor',
|
|
'chromatic_dispersion' => 'Chromatic Dispersion',
|
|
'ber' => 'Bit Error Rate',
|
|
'eer' => 'Energy Efficiency Ratio',
|
|
'waterflow' => 'Water Flow Rate',
|
|
];
|
|
|
|
$active_metric = basename($vars['metric'] ?? 'processor');
|
|
|
|
if (!$vars['view']) {
|
|
$vars['view'] = "detail";
|
|
}
|
|
|
|
$link_array = ['page' => 'health'];
|
|
|
|
$navbar = '<span style="font-weight: bold;">Health</span> » ';
|
|
$sep = "";
|
|
foreach ($datas as $texttype) {
|
|
$metric = strtolower($texttype);
|
|
$navbar .= $sep;
|
|
if ($active_metric == $metric) {
|
|
$navbar .= '<span class="pagemenu-selected">';
|
|
}
|
|
$navbar .= generate_link($type_text[$metric], $link_array, array('metric'=> $metric, 'view' => $vars['view']));
|
|
if ($active_metric == $metric) {
|
|
$navbar .= '</span>';
|
|
}
|
|
$sep = ' | ';
|
|
}
|
|
unset($sep);
|
|
|
|
if ($vars['view'] == "graphs") {
|
|
$displayoptions = '<span class="pagemenu-selected">';
|
|
}
|
|
|
|
$displayoptions .= generate_link("Graphs", $link_array, ['metric'=> $active_metric, 'view' => "graphs"]);
|
|
|
|
if ($vars['view'] == "graphs") {
|
|
$displayoptions .= '</span>';
|
|
}
|
|
|
|
$displayoptions .= ' | ';
|
|
|
|
if ($vars['view'] != "graphs") {
|
|
$displayoptions .= '<span class="pagemenu-selected">';
|
|
}
|
|
|
|
$displayoptions .= generate_link("No Graphs", $link_array, ['metric'=> $active_metric, 'view' => "detail"]);
|
|
|
|
if ($vars['view'] != "graphs") {
|
|
$displayoptions .= '</span>';
|
|
}
|
|
|
|
if (in_array($active_metric, $datas)) {
|
|
include("includes/html/pages/health/$active_metric.inc.php");
|
|
} else {
|
|
echo("No sensors of type $active_metric found.");
|
|
}
|