librenms/html/pages/health.inc.php

101 lines
2.2 KiB
PHP

<?php
$datas = array('processor','mempool','storage');
if ($used_sensors['temperature']) $datas[] = 'temperature';
if ($used_sensors['humidity']) $datas[] = 'humidity';
if ($used_sensors['fanspeed']) $datas[] = 'fanspeed';
if ($used_sensors['voltage']) $datas[] = 'voltage';
if ($used_sensors['frequency']) $datas[] = 'frequency';
if ($used_sensors['current']) $datas[] = 'current';
if ($used_sensors['power']) $datas[] = 'power';
$type_text['overview'] = "Overview";
$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";
if (!$_GET['opta']) { $_GET['opta'] = "processor"; }
if (!$_GET['optb']) { $_GET['optb'] = "nographs"; }
print_optionbar_start('', '');
$sep = "";
foreach ($datas as $texttype)
{
$type = strtolower($texttype);
echo($sep);
if ($_GET['opta'] == $type)
{
echo("<span class='pagemenu-selected'>");
}
echo('<a href="health/' . $type . ($_GET['optb'] ? '/' . $_GET['optb'] : ''). '/">' . $type_text[$type] .'</a>');
if ($_GET['opta'] == $type) { echo("</span>"); }
$sep = ' | ';
}
unset ($sep);
echo('<div style="float: right;">');
if ($_GET['optb'] == "graphs")
{
echo('<span class="pagemenu-selected">');
}
echo('<a href="health/'. $_GET['opta'].'/graphs/"> Graphs</a>');
if ($_GET['optb'] == "graphs")
{
echo('</span>');
}
echo(' | ');
if ($_GET['optb'] == "nographs")
{
echo('<span class="pagemenu-selected">');
}
echo('<a href="health/'. $_GET['opta'].'/nographs/"> No Graphs</a>');
if ($_GET['optb'] == "nographs")
{
echo('</span>');
}
echo('</div>');
print_optionbar_end();
switch ($_GET['opta'])
{
case 'processor':
case 'mempool':
case 'storage':
case 'temperature':
case 'humidity':
case 'voltage':
case 'fanspeed':
case 'frequency':
case 'current':
case 'power':
include('pages/health/'.$_GET['opta'].'.inc.php');
break;
default:
include('pages/health/temperature.inc.php'); # FIXME perhaps an error message instead?
break;
}
?>