From 936e4e2958efef52d4ebb77f7ca78726d70b43ef Mon Sep 17 00:00:00 2001 From: Ryan Wagoner Date: Fri, 16 Feb 2007 16:27:37 +0000 Subject: -use strong tags in xml for required fields, this was done purposely instead of using the required tag as depending on the monitoring mode local/remote these fields may not be required, however on head you can't save package changes if all required fields are not filled out -add support for more ups status conditions --- packages/nut/nut.xml | 24 +++++++++++------------ packages/nut/status_nut.php | 46 ++++++++++++++++++++++++++++++--------------- 2 files changed, 43 insertions(+), 27 deletions(-) diff --git a/packages/nut/nut.xml b/packages/nut/nut.xml index 9cdbec04..d775cec8 100644 --- a/packages/nut/nut.xml +++ b/packages/nut/nut.xml @@ -60,12 +60,12 @@ - Local UPS Name + <strong>Local UPS Name</strong> name input - Local UPS Model + <strong>Local UPS Model</strong> driver select If generic or cable specified in parenthesis you need @@ -350,7 +350,7 @@ - Local UPS Port + <strong>Local UPS Port</strong> port select @@ -361,7 +361,7 @@ - Local UPS Generic Type (optional) + Local UPS Generic Type upstype select @@ -400,7 +400,7 @@ - Local UPS Cable Type (optional) + Local UPS Cable Type cable select @@ -419,37 +419,37 @@ - Local Remote Access Address <br>(ex: 192.168.1.0/24) (optional) + Local Remote Access Address <br>(ex: 192.168.1.0/24) allowaddr input - Local Remote Access User (optional) + Local Remote Access User allowuser input - Local Remote Acces Password (optional) + Local Remote Acces Password allowpass password - Remote UPS Name + <strong>Remote UPS Name</strong> remotename input - Remote UPS Address <br>(ex: 192.168.1.10) + <strong>Remote UPS Address</strong> <br>(ex: 192.168.1.10) remoteaddr input - Remote UPS User + <strong>Remote UPS User</strong> remoteuser input - Remote UPS Password + <strong>Remote UPS Password</strong> remotepass password diff --git a/packages/nut/status_nut.php b/packages/nut/status_nut.php index 42d5979e..2d16c0ec 100644 --- a/packages/nut/status_nut.php +++ b/packages/nut/status_nut.php @@ -38,13 +38,13 @@ function tblrow ($name, $value) { print(<< {$name} - {$value} + {$value}{$symbol} EOD ."\n"); } -function tblrowbar ($name, $value, $red, $yellow, $green) { +function tblrowbar ($name, $value, $symbol, $red, $yellow, $green) { $red = explode('-',$red); $yellow = explode('-',$yellow); $green = explode('-',$green); @@ -71,8 +71,8 @@ function tblrowbar ($name, $value, $red, $yellow, $green) { {$name}
-
-
{$value}%
+
+
{$value}{$symbol}
@@ -136,28 +136,44 @@ include("head.inc"); $status = explode(' ',$ups['ups.status']); foreach($status as $condition) { + if($disp_status) $disp_status .= ', '; switch ($condition) { - case WAIT: - $disp_status .= 'Waiting... '; + case 'WAIT': + $disp_status .= 'Waiting'; break; - case OL: - $disp_status .= 'On Line '; + case 'OL': + $disp_status .= 'On Line'; break; - case OB: - $disp_status .= 'On Battery '; + case 'OB': + $disp_status .= 'On Battery'; break; - case LB: - $disp_status .= 'Battery Low '; + case 'TRIM': + $disp_status .= 'SmartTrim'; break; + case 'BOOST': + $disp_status .= 'SmartBoost'; + break; + case 'OVER': + $disp_status .= 'Overload'; + break; + case 'LB': + $disp_status .= 'Battery Low'; + break; + case 'RB': + $disp_status .= 'Replace Battery'; + break; + case 'CAL': + $disp_status .= 'Calibration'; + break; default: - $disp_status .= $condition.' '; + $disp_status .= $condition; break; } } tblrow('Status:',$disp_status); - tblrowbar('Load:',$ups['ups.load'],'100-80','79-60','59-0'); - tblrowbar('Battery Charge:',$ups['battery.charge'],'0-29','30-79','80-100'); + tblrowbar('Load:',$ups['ups.load'],'%','100-80','79-60','59-0'); + tblrowbar('Battery Charge:',$ups['battery.charge'],'%','0-29','30-79','80-100'); tblrow('Battery Voltage:',$ups['battery.voltage'].'V'); tblrow('Input Voltage:',$ups['input.voltage'].'V'); tblrow('Output Voltage:',$ups['output.voltage'].'V'); -- cgit v1.2.3