From d9fcbc2048041285690cc28159753acdb0bbb7a3 Mon Sep 17 00:00:00 2001 From: SunStroke74 Date: Mon, 10 Nov 2014 23:48:31 +0500 Subject: [PATCH] Network Ups Tool monitoring widget Discussion at https://forum.pfsense.org/index.php?topic=80981.0 --- usr/local/www/widgets/widgets/ups.widget.php | 190 +++++++++++++++++++ 1 file changed, 190 insertions(+) create mode 100644 usr/local/www/widgets/widgets/ups.widget.php diff --git a/usr/local/www/widgets/widgets/ups.widget.php b/usr/local/www/widgets/widgets/ups.widget.php new file mode 100644 index 00000000000..316a2c948d2 --- /dev/null +++ b/usr/local/www/widgets/widgets/ups.widget.php @@ -0,0 +1,190 @@ + + + + + + + + + +
MonitoringModelStatus
+ + + 0) ? true : false; + if ($running) { + $handle = popen($cmd, 'r'); + if ($handle) { + $read = fread($handle, 4096); + pclose($handle); + $lines = explode("\n", $read); + if (count($lines) == 1) { + $condition = "ERROR:Data stale!"; + } else { + $ups = array(); + foreach ($lines as $line) { + $line = explode(':', $line); + $ups[$line[0]] = trim($line[1]); + } + } + } + } elseif (isset($nut_config)) { + if ($nut_config['monitor'] == "snmp") { + $condition = "NUT enabled but service not running!\nSNMP UPS may be unreachable."; + } else { + $condition = "NUT enabled but service not running!"; + } + } else { + $condition = "No NUT installed!"; + } + if (isset($condition)) { + echo $condition; + ?> + ERROR
+ + + + + 0) { + $cell23 = array("Battery Voltage" , $ups['battery.voltage']." V"); + } elseif ($ups['ups.temperature'] > 0) { + $cell23 = array("Battery Temp" , $ups['ups.temperature']."°C"); + } else { + $cell23 = array("" , ""); + } + ?> + + + + Battery Charge + Time Remain + + + + + left barred bargray barright bar
+ + + + + + + + + Load + Input Voltage + Output Voltage + + + + left barred bargray barright bar
+ + + + + +