diff --git a/Targets/Nutups/Nutups-Custom.pm b/Targets/Nutups/Nutups-Custom.pm index 090d007..1b443b3 100644 --- a/Targets/Nutups/Nutups-Custom.pm +++ b/Targets/Nutups/Nutups-Custom.pm @@ -147,10 +147,10 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); my $prefix_data = shift; #Data hash as parameter my $ret = ""; my $db = $cdb; #maybe one of the others - my $dbkey = 'ChangeThis'; + my $dbkey = 'nut'; # To make it write to DB as comment, delete this (regex) string in each if statement "TRUE\) \#copy or perform with value: .* e.g." - if (! TRUE) #copy or perform with value: status e.g. $db->set_prop($dbkey,'status',$c->param('status'),type=>'service')) + if (!$db->set_prop($dbkey,'status',$c->param('status'),type=>'service')) {$ret .= 'Perform/save failed for status';} if (! TRUE) #copy or perform with value: Nutmode e.g. $db->set_prop($dbkey,'Nutmode',$c->param('Nutmode'),type=>'service')) {$ret .= 'Perform/save failed for Nutmode';} @@ -191,11 +191,11 @@ sub get_model_options { return ['Error occurred']; } - # Remove "/usr/sbin" from the front of each line - s{^/usr/sbin}{} for @output; + # Remove "/usr/sbin/" from the front of each line + s{^/usr/sbin/}{} for @output; # Trim whitespace from each element and return the array chomp(@output); # Remove newline characters from each line - return ["fred","Art"] #@output; # Return the array of modified output lines + return @output; # Return the array of modified output lines } -1; \ No newline at end of file +1; diff --git a/Targets/Nutups/spec.nutUPS b/Targets/Nutups/spec.nutUPS new file mode 100644 index 0000000..e103f91 --- /dev/null +++ b/Targets/Nutups/spec.nutUPS @@ -0,0 +1,27 @@ +main page = status +config page: +-nut status : enable/disabled + + nut mode : standalone|netserver|netclient + if netclient mode + +ask for SlaveUPS "UPSNAME@IP" and SlavePass "" +set Master as no when saving + + if standalone or netserver + +either use default value for NUT device, or allow to set them +${nut-driver@UPS }{Model} usbhid-ups you can use a drop-down listing all the device rpm -ql nut|grep /usr/sbin +${nut-driver@UPS }{Device} auto +only if Model genericups: +${nut-driver@UPS }{Type} +${nut-driver@UPS }{mfr} +${nut-driver@UPS }{mdl} +on saving set nut{Master} to yes if mode standalone or netserver +if mode=netserver set nut{access} to private otherwise set as localhost +run signal-event nut-conf + +if enabled the status page could return upsc UPS@localhost, or if slave upsc UPSNAME@IP +if netclient set nut-monitor status to enabled and set status disabled to nut-server and all existing nut-driver@* ( we can set multiple via cli, so a loop would be great there) +if standalone|netserver then enable all nut related service if nut enabled +if nut disabled then set all related services to disabled