Compare commits
19 Commits
11_0_0-7_e
...
master
Author | SHA1 | Date | |
---|---|---|---|
![]() |
848f2bbfc0 | ||
1962b616ec | |||
7e4ab54b55 | |||
32cfcf5ed3 | |||
f58cc8a22f | |||
e13529e660 | |||
abb67327c6 | |||
2465aaab22 | |||
8bdde34a82 | |||
830b29b569 | |||
e235701fe2 | |||
21fed495e6 | |||
4e61b36891 | |||
4743293464 | |||
26bc766e56 | |||
bebf224fe3 | |||
1cdbeaef60 | |||
a768594f0f | |||
30dcc4861f |
34
createlinks
34
createlinks
@@ -2,23 +2,39 @@
|
|||||||
|
|
||||||
use esmith::Build::CreateLinks qw(:all);
|
use esmith::Build::CreateLinks qw(:all);
|
||||||
|
|
||||||
my @events = qw(bootstrap-console-save console-save post-install post-upgrade smeserver-nutUPS-update);
|
my @events = qw(bootstrap-console-save console-save post-install post-upgrade smeserver-nutUPS-update nut-conf);
|
||||||
|
|
||||||
templates2events("/etc/sysconfig/ups", @events);
|
|
||||||
templates2events("/usr/lib/systemd/system/nut-server.service.d/50koozali.conf", @events);
|
|
||||||
templates2events("/usr/lib/systemd/system/nut-monitor.service.d/50koozali.conf", @events);
|
|
||||||
|
|
||||||
foreach (qw(ups.conf upsd.users upsmon.conf upssched.conf))
|
foreach (qw(nut.conf ups.conf upsd.users upsmon.conf upssched.conf))
|
||||||
{
|
{
|
||||||
templates2events("/etc/ups/$_", @events);
|
templates2events("/etc/ups/$_", @events);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (qw(bootstrap-console-save console-save smeserver-nutUPS-update))
|
foreach (qw(bootstrap-console-save console-save smeserver-nutUPS-update nut-conf))
|
||||||
{
|
{
|
||||||
templates2events("/etc/ups/upsd.conf", $_);
|
templates2events("/etc/ups/upsd.conf", $_);
|
||||||
}
|
}
|
||||||
|
|
||||||
my $event="smeserver-nutUPS-update";
|
event_link("nut-config", "post-upgrade" , "04");
|
||||||
safe_symlink("try-restart", "root/etc/e-smith/events/$event/services2adjust/nut");
|
event_link("nut-config-drivers", "post-upgrade", "50");
|
||||||
|
|
||||||
|
my $event= "nut-conf";
|
||||||
|
event_link("nut-config", $event, "04");
|
||||||
|
event_link("nut-config-drivers", $event, "50");
|
||||||
|
event_link("systemd-default", $event, "88");
|
||||||
|
safe_symlink("try-restart", "root/etc/e-smith/events/$event/services2adjust/nut-driver\@ups");
|
||||||
|
safe_symlink("try-restart", "root/etc/e-smith/events/$event/services2adjust/nut-monitor");
|
||||||
|
safe_symlink("try-restart", "root/etc/e-smith/events/$event/services2adjust/nut-server");
|
||||||
|
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/masq");
|
||||||
|
templates2events("/etc/rc.d/init.d/masq", $event);
|
||||||
|
|
||||||
|
|
||||||
|
$event="smeserver-nutUPS-update";
|
||||||
|
safe_symlink("try-restart", "root/etc/e-smith/events/$event/services2adjust/nut-driver\@ups");
|
||||||
|
safe_symlink("try-restart", "root/etc/e-smith/events/$event/services2adjust/nut-monitor");
|
||||||
|
safe_symlink("try-restart", "root/etc/e-smith/events/$event/services2adjust/nut-server");
|
||||||
templates2events("/etc/systemd/system-preset/49-koozali.preset", $event);
|
templates2events("/etc/systemd/system-preset/49-koozali.preset", $event);
|
||||||
event_link("systemd-default", $event, "06");
|
templates2events("/etc/rsyslog.conf", $event);
|
||||||
|
event_link("nut-config", $event, "04");
|
||||||
|
event_link("nut-config-drivers", $event, "50");
|
||||||
|
event_link("systemd-default", $event, "88");
|
||||||
|
@@ -0,0 +1 @@
|
|||||||
|
disabled
|
@@ -0,0 +1 @@
|
|||||||
|
service
|
@@ -0,0 +1 @@
|
|||||||
|
disabled
|
@@ -0,0 +1 @@
|
|||||||
|
service
|
@@ -0,0 +1 @@
|
|||||||
|
disabled
|
@@ -0,0 +1 @@
|
|||||||
|
service
|
1
root/etc/e-smith/db/configuration/defaults/nut/TCPPort
Normal file
1
root/etc/e-smith/db/configuration/defaults/nut/TCPPort
Normal file
@@ -0,0 +1 @@
|
|||||||
|
3493
|
@@ -1 +1 @@
|
|||||||
service
|
configuration
|
||||||
|
22
root/etc/e-smith/db/configuration/migrate/15nutPass
Normal file
22
root/etc/e-smith/db/configuration/migrate/15nutPass
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
use MIME::Base64 qw(encode_base64);
|
||||||
|
|
||||||
|
my $nutrec = $DB->get('nut') || $DB->new_record('nut', {type => 'service'});
|
||||||
|
# migrate old
|
||||||
|
$nutrec->set_prop('PrimaryPass',$DB->get_prop_and_delete('nut', MasterPass)) if (exists $nut{'MasterPass'});
|
||||||
|
$nutrec->set_prop('SecondaryPass',$DB->get_prop_and_delete('nut', SlavePass)) if (exists $nut{'SlavePass'});
|
||||||
|
|
||||||
|
$nutrec->set_prop('PrimaryPass', sprintf("%15.0f", int( (1000000000000000) * rand() ))) if not $nutrec->prop('PrimaryPass');
|
||||||
|
$nutrec->set_prop('SecondaryPass', sprintf("%15.0f", int( (1000000000000000) * rand() ))) if not $nutrec->prop('SecondaryPass');
|
||||||
|
$nutrec->set_prop('AdminPass', sprintf("%15.0f", int( (1000000000000000) * rand() ))) if not $nutrec->prop('AdminPass');
|
||||||
|
|
||||||
|
# if $nut{SlaveUPS} defined we set and the target not existing ClientUPS ; then delete SlaveUPS
|
||||||
|
# set ClientUser as upsslave (was the content before sme11) intended for smooth migration
|
||||||
|
# set ClientPass as $nut{SlavePass}/{SecondaryPass}
|
||||||
|
if ( $nut{'SlaveUPS'} ) {
|
||||||
|
$nutrec->set_prop('ClientUPS',$DB->get_prop_and_delete('nut','SlaveUPS') ) if not $nut{'ClientUPS'};
|
||||||
|
$nutrec->set_prop('ClientUser','upsslave');
|
||||||
|
$nutrec->set_prop('ClientPass',$nutrec->prop('SecondaryPass'));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
22
root/etc/e-smith/db/configuration/migrate/20nutMigrate
Normal file
22
root/etc/e-smith/db/configuration/migrate/20nutMigrate
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
# migrate to SME11
|
||||||
|
# first we get ride of Master=no
|
||||||
|
# if Mode not set then set it according to Master
|
||||||
|
my $mnut = $DB->get('nut') || $DB->new_record('nut', {type => 'service'});
|
||||||
|
my $nutMaster = $DB->get_prop_and_delete ('nut','Master');
|
||||||
|
unless ( ${'nut'}{'Mode'} ) {
|
||||||
|
$mnut>set_prop('Mode','netserver') if $nutMaster eq "yes";
|
||||||
|
}
|
||||||
|
|
||||||
|
# if nut-driver@ups not existing create it
|
||||||
|
my $driverUPS = $DB->get('nut-driver@ups') || $DB->new_record('nut-driver@ups', {type => 'service'});
|
||||||
|
# then migrate to nut-driver@ups (first UPS) the following properties
|
||||||
|
my $mdl = $DB->get_prop_and_delete ('nut','mdl');
|
||||||
|
$driverUPS->set_prop('mdl',$mdl) unless ${'nut-driver@ups'}{'mdl'};
|
||||||
|
my $mfr = $DB->get_prop_and_delete ('nut','mfr');
|
||||||
|
$driverUPS->set_prop('mfr',$mfr) unless ${'nut-driver@ups'}{'mfr'};
|
||||||
|
my $model = $DB->get_prop_and_delete ('nut','Model');
|
||||||
|
$driverUPS->set_prop('Model',$model) unless ${'nut-driver@ups'}{'Model'};
|
||||||
|
my $Type = $DB->get_prop_and_delete ('nut','Type');
|
||||||
|
$driverUPS->set_prop('Type',$model) unless ${'nut-driver@ups'}{'Type'};
|
||||||
|
}
|
@@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
use MIME::Base64 qw(encode_base64);
|
|
||||||
|
|
||||||
my $nutrec = $DB->get('nut') || $DB->new_record('nut', {type => 'service'});
|
|
||||||
$nutrec->set_prop('MasterPass', sprintf("%15.0f", int( (1000000000000000) * rand() ))) if not $nutrec->prop('MasterPass');
|
|
||||||
$nutrec->set_prop('SlavePass', sprintf("%15.0f", int( (1000000000000000) * rand() ))) if not $nutrec->prop('SlavePass');
|
|
||||||
$nutrec->set_prop('AdminPass', sprintf("%15.0f", int( (1000000000000000) * rand() ))) if not $nutrec->prop('AdminPass');
|
|
||||||
}
|
|
52
root/etc/e-smith/events/actions/nut-config
Normal file
52
root/etc/e-smith/events/actions/nut-config
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# this script is called before template-expand
|
||||||
|
# then another script is called to run /usr/libexec/nut-driver-enumerator.sh and start/stop drivers
|
||||||
|
# then traditionnal services2adjust
|
||||||
|
|
||||||
|
# calling this script to configure unit and drivers
|
||||||
|
if [[ $(/sbin/e-smith/config getprop nut status || echo "disabled") == "disabled" ]] ; then
|
||||||
|
# disable server
|
||||||
|
/sbin/e-smith/config setprop nut-server status disabled
|
||||||
|
/sbin/e-smith/config setprop nut access localhost
|
||||||
|
# disable monitor
|
||||||
|
/sbin/e-smith/config setprop nut-monitor status disabled
|
||||||
|
# TODO get_all_by_prop filter nut-driver@ and foreach $UPS disabled
|
||||||
|
#config keys|grep nut-driver
|
||||||
|
for OUTPUT in $(/sbin/e-smith/config keys|grep nut-driver)
|
||||||
|
do
|
||||||
|
/sbin/e-smith/config setprop $OUTPUT status disabled
|
||||||
|
done
|
||||||
|
|
||||||
|
exit 0;
|
||||||
|
fi
|
||||||
|
# nut is enabled
|
||||||
|
|
||||||
|
# we set services depending on Mode
|
||||||
|
Mode=$(/sbin/e-smith/config getprop nut Mode || echo "standalone")
|
||||||
|
if [[ $Mode == "netserver" ]] ; then
|
||||||
|
/sbin/e-smith/config setprop nut-server status enabled
|
||||||
|
/sbin/e-smith/config setprop nut access private
|
||||||
|
elif [[ $Mode == "netclient" ]] ; then
|
||||||
|
/sbin/e-smith/config setprop nut-server status disabled
|
||||||
|
/sbin/e-smith/config setprop nut access localhost
|
||||||
|
else
|
||||||
|
/sbin/e-smith/config setprop nut-server status enabled
|
||||||
|
/sbin/e-smith/config setprop nut access localhost
|
||||||
|
fi
|
||||||
|
# enable nut-monitor
|
||||||
|
/sbin/e-smith/config setprop nut-monitor status enabled
|
||||||
|
|
||||||
|
# get_all_by_prop filter nut-driver@ and foreach $UPS enable.
|
||||||
|
if [[ $Mode == "netclient" ]] ; then
|
||||||
|
for OUTPUT in $(/sbin/e-smith/config keys|grep nut-driver)
|
||||||
|
do
|
||||||
|
/sbin/e-smith/config setprop $OUTPUT status disabled
|
||||||
|
done
|
||||||
|
else
|
||||||
|
for OUTPUT in $(/sbin/e-smith/config keys|grep nut-driver)
|
||||||
|
do
|
||||||
|
/sbin/e-smith/config setprop $OUTPUT status enabled
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
45
root/etc/e-smith/events/actions/nut-config-drivers
Normal file
45
root/etc/e-smith/events/actions/nut-config-drivers
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# another script is called before template-expand to set services
|
||||||
|
# this script is called to run /usr/libexec/nut-driver-enumerator.sh and start/stop drivers
|
||||||
|
# then traditionnal services2adjust
|
||||||
|
|
||||||
|
# enumerate / configure drivers
|
||||||
|
/usr/libexec/nut-driver-enumerator.sh 2>/dev/null
|
||||||
|
|
||||||
|
event=$1
|
||||||
|
|
||||||
|
if [[ $i == "post-upgrade" ]] ; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $i == "bootstrap-console-save" ]] ; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if disabled stop them
|
||||||
|
if [[ $(/sbin/e-smith/config getprop nut status || echo "disabled") == "disabled" ]] ; then
|
||||||
|
# if disabled stop them
|
||||||
|
for OUTPUT in $(/sbin/e-smith/config keys|grep nut-driver)
|
||||||
|
do
|
||||||
|
/usr/bin/systemctl stop $OUTPUT
|
||||||
|
done
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if netclient stop them
|
||||||
|
if [[ $(/sbin/e-smith/config getprop nut Mode || echo "netclient") == "netclient" ]] ; then
|
||||||
|
# if disabled stop them
|
||||||
|
for OUTPUT in $(/sbin/e-smith/config keys|grep nut-driver)
|
||||||
|
do
|
||||||
|
/usr/bin/systemctl stop $OUTPUT 2>/dev/null
|
||||||
|
done
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# if we are there we want to restart / start them
|
||||||
|
for OUTPUT in $(/sbin/e-smith/config keys|grep nut-driver)
|
||||||
|
do
|
||||||
|
/usr/bin/systemctl restart $OUTPUT
|
||||||
|
done
|
5
root/etc/e-smith/templates/etc/etc/rsyslog.conf/32nut
Normal file
5
root/etc/e-smith/templates/etc/etc/rsyslog.conf/32nut
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
#nut / UPS we only use journalctl
|
||||||
|
:programname, isequal, "nut-monitor" stop
|
||||||
|
:programname, isequal, "nut-server" stop
|
||||||
|
:programname, startswith, "nut-driver" stop
|
||||||
|
|
@@ -1 +0,0 @@
|
|||||||
MODEL=upsdrvctl
|
|
@@ -1 +0,0 @@
|
|||||||
SERVER={ $nut{Master} || 'yes' }
|
|
@@ -1,16 +1,26 @@
|
|||||||
# nut UPS specific subservices
|
# nut UPS specific subservices
|
||||||
{
|
{
|
||||||
$nutstatus = $nut{status} || 'disabled';
|
$nutstatus = $nut{status} || 'disabled';
|
||||||
$master = $nut{Master} || 'yes';
|
$mode = $nut{Mode} || 'standalone';
|
||||||
|
my @upses = grep(/^nut-driver\@[a-zA-Z0-9_-]+$/, $DB->keys);
|
||||||
|
|
||||||
if ($nutstatus eq 'enabled') {
|
if ($nutstatus eq 'enabled') {
|
||||||
$OUT .= "enable nut-server.service\n" if ($master eq 'yes');
|
$OUT .= "enable nut-server.service\n" if ($mode ne 'netclient');
|
||||||
$OUT .= "disable nut-server.service\n" unless ($master eq 'yes');
|
$OUT .= "disable nut-server.service\n" unless ($mode eq 'netclient');
|
||||||
$OUT .= "enable nut-monitor.service\n";
|
$OUT .= "enable nut-monitor.service\n";
|
||||||
|
foreach my $ups ( sort {$a cmp $b} @upses )
|
||||||
|
{
|
||||||
|
$OUT .= "enable $ups.service\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$OUT .= "disable nut-server.service\n";
|
$OUT .= "disable nut-server.service\n";
|
||||||
$OUT .= "disable nut-monitor.service\n";
|
$OUT .= "disable nut-monitor.service\n";
|
||||||
|
foreach my $ups ( sort {$a cmp $b} @upses )
|
||||||
|
{
|
||||||
|
$OUT .= "disable $ups.service\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
7
root/etc/e-smith/templates/etc/ups/nut.conf/10MODE
Normal file
7
root/etc/e-smith/templates/etc/ups/nut.conf/10MODE
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# mode could be none|standalone|netserver|netclient
|
||||||
|
MODE={
|
||||||
|
return "none" unless ( ($nut{"status"}||"disabled") eq "enabled");
|
||||||
|
# if Master no => netclient
|
||||||
|
# if Master yes => standalone or netserver
|
||||||
|
$nut{Mode} || "standalone";
|
||||||
|
}
|
@@ -0,0 +1,10 @@
|
|||||||
|
|
||||||
|
# Uncomment this to allow starting the `upsd` data server even if `ups.conf`
|
||||||
|
# has no device sections configured at the moment. This environment variable
|
||||||
|
# overrides the built-in "false" flag in `upsd`, and an optional same-named
|
||||||
|
# default flag that can be set in `upsd.conf`. If you want a data server always
|
||||||
|
# running, even if it initially has nothing to serve (may be live-reloaded
|
||||||
|
# later, when devices become configured), this option is for you.
|
||||||
|
#ALLOW_NO_DEVICE=true
|
||||||
|
#export ALLOW_NO_DEVICE
|
||||||
|
|
@@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
# Uncomment this to allow starting the `upsd` data server even if not all
|
||||||
|
# `LISTEN` directives can be honoured at the moment. This environment variable
|
||||||
|
# overrides the built-in "false" flag in `upsd`, and an optional same-named
|
||||||
|
# default flag that can be set in `upsd.conf`. If you want a data server always
|
||||||
|
# running, even if it would potentially not serve all clients on every uptime,
|
||||||
|
# this option is for you (note you would have to restart `upsd` to pick up the
|
||||||
|
# `LISTEN`ed IP address if it appears later). Probably `LISTEN *` is better.
|
||||||
|
#ALLOW_NOT_ALL_LISTENERS=true
|
||||||
|
#export ALLOW_NOT_ALL_LISTENERS
|
||||||
|
|
@@ -0,0 +1,6 @@
|
|||||||
|
|
||||||
|
# The optional 'UPSD_OPTIONS' allow to set upsd specific command-line options.
|
||||||
|
# It is ignored when 'MODE' above indicates that no upsd should be running.
|
||||||
|
# It may be redundant in comparison to options which can be set in `upsd.conf`.
|
||||||
|
#UPSD_OPTIONS=
|
||||||
|
|
@@ -0,0 +1,6 @@
|
|||||||
|
|
||||||
|
# The optional 'UPSMON_OPTIONS' allow to set upsmon specific command-line options.
|
||||||
|
# It is ignored when 'MODE' above indicates that no upsmon should be running.
|
||||||
|
# It may be redundant in comparison to options which can be set in `upsmon.conf`.
|
||||||
|
#UPSMON_OPTIONS=
|
||||||
|
|
@@ -0,0 +1,9 @@
|
|||||||
|
|
||||||
|
# If the optional 'POWEROFF_WAIT' is configured (to a value that can be handled
|
||||||
|
# by `/bin/sleep` on the current system - typically an integer with the number
|
||||||
|
# of seconds for a delay, but not always limited to that syntax), and the current
|
||||||
|
# system which manages one or more UPS devices would not only command it to shut
|
||||||
|
# down, but also try to avoid the "Power race". Caveats emptor, see NUT FAQ and
|
||||||
|
# other docs for details.
|
||||||
|
#POWEROFF_WAIT=3600
|
||||||
|
|
@@ -0,0 +1,8 @@
|
|||||||
|
|
||||||
|
# The optional 'POWEROFF_QUIET' setting controls if the NUT shutdown integration
|
||||||
|
# scripts or service units would emit messages about their activity (or lack
|
||||||
|
# thereof). By default they may be verbose, to aid post-mortem troubleshooting
|
||||||
|
# via logs or console captures.
|
||||||
|
# Set to `true` to avoid that trove of information, if you consider it noise.
|
||||||
|
#POWEROFF_QUIET=true
|
||||||
|
|
@@ -1,16 +1,28 @@
|
|||||||
{
|
{
|
||||||
my $model = $nut{Model} || "usbhid-ups";
|
my $poll = $nut{pollInterval} || '2';
|
||||||
my $device = $nut{Device} || "/var/lib/ups/hiddev0";
|
if ($poll ne '2') {
|
||||||
my $type = $nut{Type};
|
$OUT .= "pollinterval = $poll\n";
|
||||||
my $mfr = $nut{mfr};
|
}
|
||||||
my $mdl = $nut{mdl};
|
|
||||||
$OUT .= "[UPS]\n";
|
my @upses = grep(/^nut-driver\@[a-zA-Z0-9_-]+$/, $DB->keys);
|
||||||
$OUT .= "\tdriver = $model\n";
|
foreach my $ups ( sort {$a cmp $b} @upses )
|
||||||
if ($model eq 'genericups')
|
{
|
||||||
{
|
my $status = ${"$ups"}{status} || "disabled";
|
||||||
$OUT .= "\tupstype = $type\n" if defined $type;
|
next if $status eq "disabled";
|
||||||
$OUT .= "\tmfr = $mfr\n" if defined $mfr;
|
my ($name )= $ups =~ /^nut-driver\@(.*)$/ ;
|
||||||
$OUT .= "\tmodel = $mdl\n" if defined $mdl;
|
my $model = ${"$ups"}{Model} || "usbhid-ups";
|
||||||
}
|
my $device = ${"$ups"}{Device} || "auto"; #"/var/lib/ups/hiddev0";
|
||||||
$OUT .= "\tport = $device\n";
|
my $type = ${"$ups"}{Type};
|
||||||
|
my $mfr = ${"$ups"}{mfr};
|
||||||
|
my $mdl = ${"$ups"}{mdl};
|
||||||
|
$OUT .= "[$name]\n";
|
||||||
|
$OUT .= "\tdriver = $model\n";
|
||||||
|
if ($model eq 'genericups')
|
||||||
|
{
|
||||||
|
$OUT .= "\tupstype = $type\n" if defined $type;
|
||||||
|
$OUT .= "\tmfr = $mfr\n" if defined $mfr;
|
||||||
|
$OUT .= "\tmodel = $mdl\n" if defined $mdl;
|
||||||
|
}
|
||||||
|
$OUT .= "\tport = $device\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,8 +1,18 @@
|
|||||||
|
[upsprimary]
|
||||||
|
password = { $nut{PrimaryPass} }
|
||||||
|
upsmon primary
|
||||||
|
|
||||||
|
[upssecondary]
|
||||||
|
password = { $nut{SecondaryPass} }
|
||||||
|
upsmon secondary
|
||||||
|
{
|
||||||
|
# we keep those two for backward compatibility pre SME11
|
||||||
|
}
|
||||||
[upsmaster]
|
[upsmaster]
|
||||||
password = { $nut{MasterPass} }
|
password = { $nut{PrimaryPass} }
|
||||||
upsmon master
|
upsmon primary
|
||||||
|
|
||||||
[upsslave]
|
[upsslave]
|
||||||
password = { $nut{SlavePass} }
|
password = { $nut{SecondaryPass} }
|
||||||
upsmon slave
|
upsmon secondary
|
||||||
|
|
||||||
|
@@ -1,7 +1,14 @@
|
|||||||
{
|
{
|
||||||
if ( ($nut{Master} || 'yes') ne 'no' ) {
|
if ( ($nut{Mode} || 'standalone') eq 'netclient' ) {
|
||||||
$OUT = "MONITOR UPS\@localhost 1 upsmaster $nut{MasterPass} master";
|
$OUT = "MONITOR $nut{ClientUPS} 1 $nut{ClientUser} $nut{ClientPass} secondary";
|
||||||
} else {
|
} else {
|
||||||
$OUT = "MONITOR $nut{SlaveUPS} 1 upsslave $nut{SlavePass} slave";
|
my @upses = grep(/^nut-driver\@[a-zA-Z0-9_-]+$/, $DB->keys);
|
||||||
}
|
my $size = scalar(@upses);
|
||||||
|
foreach my $ups ( sort {$a cmp $b} @upses )
|
||||||
|
{
|
||||||
|
my ($upsname) = $ups =~ /^nut-driver\@([a-zA-Z0-9_-]+)$/ ;
|
||||||
|
$OUT .= "MONITOR $upsname\@localhost 1 upsprimary $nut{PrimaryPass} primary";
|
||||||
|
$OUT .= "\n" if --$size >=1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,14 +0,0 @@
|
|||||||
#------------------------------------------------------------
|
|
||||||
# !!DO NOT MODIFY THIS FILE!!
|
|
||||||
#
|
|
||||||
# Manual changes will be lost when this file is regenerated.
|
|
||||||
#
|
|
||||||
# Please read the developer's guide, which is available
|
|
||||||
# at http://www.contribs.org/development/
|
|
||||||
#
|
|
||||||
# Copyright (C) 1999-2006 Mitel Networks Corporation
|
|
||||||
#------------------------------------------------------------
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
ExecStartPre=
|
|
||||||
ExecStartPre=-/usr/bin/systemd-tmpfiles --create /usr/lib/tmpfiles.d/nut-run.conf
|
|
@@ -0,0 +1,4 @@
|
|||||||
|
[Service]
|
||||||
|
ExecStartPre=/sbin/e-smith/service-status %N
|
||||||
|
[Install]
|
||||||
|
WantedBy= sme-server.target
|
@@ -0,0 +1,4 @@
|
|||||||
|
[Service]
|
||||||
|
ExecStartPre=/sbin/e-smith/service-status nut-monitor
|
||||||
|
[Install]
|
||||||
|
WantedBy=sme-server.target
|
@@ -0,0 +1,4 @@
|
|||||||
|
[Service]
|
||||||
|
ExecStartPre=/sbin/e-smith/service-status nut-server
|
||||||
|
[Install]
|
||||||
|
WantedBy=sme-server.target
|
@@ -7,22 +7,12 @@
|
|||||||
#
|
#
|
||||||
use esmith::util;
|
use esmith::util;
|
||||||
use esmith::util::network;
|
use esmith::util::network;
|
||||||
use esmith::ConfigDB;
|
use esmith::ConfigDB::UTF8;
|
||||||
use esmith::HostsDB;
|
|
||||||
use esmith::AccountsDB;
|
|
||||||
use esmith::NetworksDB;
|
|
||||||
use esmith::DomainsDB;
|
|
||||||
|
|
||||||
use constant FALSE => 0;
|
use constant FALSE => 0;
|
||||||
use constant TRUE => 1;
|
use constant TRUE => 1;
|
||||||
|
|
||||||
|
our $cdb;
|
||||||
#The most common ones
|
|
||||||
my $cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
|
|
||||||
#our $adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db");
|
|
||||||
#our $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db");
|
|
||||||
#our $hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db");
|
|
||||||
#our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
|
|
||||||
|
|
||||||
# Validation routines - parameters for each panel
|
# Validation routines - parameters for each panel
|
||||||
|
|
||||||
@@ -49,8 +39,11 @@ my $cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
|
|||||||
{$ret .= 'Validation for status failed';}
|
{$ret .= 'Validation for status failed';}
|
||||||
if (! TRUE) #validate $c->param('Nutmode')
|
if (! TRUE) #validate $c->param('Nutmode')
|
||||||
{$ret .= 'Validation for Nutmode failed';}
|
{$ret .= 'Validation for Nutmode failed';}
|
||||||
|
#do we want the Slave validated ? we should just display read only
|
||||||
if (! TRUE) #validate $c->param('SlaveUPS_Name')
|
if (! TRUE) #validate $c->param('SlaveUPS_Name')
|
||||||
{$ret .= 'Validation for SlaveUPS_Name failed';}
|
{$ret .= 'Validation for SlaveUPS_Name failed';}
|
||||||
|
if (! TRUE) #validate $c->param('ClientUPS_Name')
|
||||||
|
{$ret .= 'Validation for ClientUPS_Name failed';}
|
||||||
if (! TRUE) #validate $c->param('MasterUPS_Name')
|
if (! TRUE) #validate $c->param('MasterUPS_Name')
|
||||||
{$ret .= 'Validation for MasterUPS_Name failed';}
|
{$ret .= 'Validation for MasterUPS_Name failed';}
|
||||||
if (! TRUE) #validate $c->param('UPS_Model')
|
if (! TRUE) #validate $c->param('UPS_Model')
|
||||||
@@ -73,11 +66,15 @@ my $cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
|
|||||||
sub get_data_for_panel_STATUS {
|
sub get_data_for_panel_STATUS {
|
||||||
# Return a hash with the fields required which will be loaded into the shared data
|
# Return a hash with the fields required which will be loaded into the shared data
|
||||||
my $c = shift;
|
my $c = shift;
|
||||||
|
$cdb = esmith::ConfigDB::UTF8->open() || die("Couldn't open config db");
|
||||||
my %ret = (
|
my %ret = (
|
||||||
#'Data1'=>'Data for STATUS', #Example
|
#'Data1'=>'Data for STATUS', #Example
|
||||||
# fields from Inputs in STATUS $fields['STATUS']
|
# fields from Inputs in STATUS $fields['STATUS']
|
||||||
'UPSStatus'=>$c->get_ups_status(),
|
'UPSStatus'=>$c->get_ups_status(),
|
||||||
'ups_data' => $c->get_ups_status_as_hash()
|
'ups_data' => $c->get_ups_status_as_hash(),
|
||||||
|
'Nutmode'=>$cdb->get_prop('nut', 'Mode')||"none",
|
||||||
|
'localip'=>$cdb->get_value('LocalIP'),
|
||||||
|
'SlaveUPS_Pass'=>$cdb->get_prop('nut', 'SecondaryPass'),
|
||||||
);
|
);
|
||||||
return %ret;
|
return %ret;
|
||||||
}
|
}
|
||||||
@@ -85,19 +82,24 @@ my $cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
|
|||||||
sub get_data_for_panel_CONFIG {
|
sub get_data_for_panel_CONFIG {
|
||||||
# Return a hash with the fields required which will be loaded into the shared data
|
# Return a hash with the fields required which will be loaded into the shared data
|
||||||
my $c = shift;
|
my $c = shift;
|
||||||
$cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
|
$cdb = esmith::ConfigDB::UTF8->open() || die("Couldn't open config db");
|
||||||
my %ret = (
|
my %ret = (
|
||||||
'Data1'=>'Data for CONFIG', #Example
|
'Data1'=>'Data for CONFIG', #Example
|
||||||
|
'localip'=>$cdb->get_value('LocalIP'),
|
||||||
# fields from Inputs in CONFIG $fields['CONFIG']
|
# fields from Inputs in CONFIG $fields['CONFIG']
|
||||||
'status'=>$cdb->get_prop('nut', 'status', 'disabled'),
|
'status'=>$cdb->get_prop('nut', 'status') || 'disabled',
|
||||||
'Nutmode'=>$cdb->get_prop('nut', 'mode', 'standalone'),
|
'Nutmode'=>$cdb->get_prop('nut', 'Mode') || 'standalone',
|
||||||
'SlaveUPS_Name'=>$cdb->get_prop('nut', 'SlaveUPS', 'ups@IPaddress'),
|
'ClientUPS_Name'=>$cdb->get_prop('nut', 'ClientUPS'),
|
||||||
'MasterUPS_Name'=>$cdb->get_prop('nut', 'MasterUPS', 'ups@localhost'),
|
'ClientUPS_User'=>$cdb->get_prop('nut', 'ClientUser'),
|
||||||
'UPS_Model'=>$cdb->get_prop('nut', 'Model', 'usbhid-ups'),
|
'ClientUPS_Pass'=>$cdb->get_prop('nut', 'ClientPass'),
|
||||||
'UPS_Device'=>$cdb->get_prop('nut', 'Device', 'auto'),
|
'SlaveUPS_Pass'=>$cdb->get_prop('nut', 'SecondaryPass'),
|
||||||
'UPS_gen_Type'=>$cdb->get_prop('nut', 'Type', ''),
|
'MasterUPS_Name'=>$cdb->get_prop('nut', 'MasterUPS'),
|
||||||
'UPS_gen_Mfr'=>$cdb->get_prop('nut', 'mfr', ''),
|
# nut-driver@ups entry
|
||||||
'UPS_gen_Model'=>$cdb->get_prop('nut', 'mdl', ''),
|
'UPS_Model'=>$cdb->get_prop('nut-driver@ups', 'Model') || 'usbhid-ups',
|
||||||
|
'UPS_Device'=>$cdb->get_prop('nut-driver@ups', 'Device')|| 'auto',
|
||||||
|
'UPS_gen_Type'=>$cdb->get_prop('nut-driver@ups', 'Type'),
|
||||||
|
'UPS_gen_Mfr'=>$cdb->get_prop('nut-driver@ups', 'mfr'),
|
||||||
|
'UPS_gen_Model'=>$cdb->get_prop('nut-driver@ups', 'mdl'),
|
||||||
);
|
);
|
||||||
return %ret;
|
return %ret;
|
||||||
}
|
}
|
||||||
@@ -114,16 +116,16 @@ my $cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
|
|||||||
my $c = shift;
|
my $c = shift;
|
||||||
my $selected = shift; #Parameter is name of selected row.
|
my $selected = shift; #Parameter is name of selected row.
|
||||||
my $is_new_record = shift; #Indicates new record required (defaults)
|
my $is_new_record = shift; #Indicates new record required (defaults)
|
||||||
my %ret = {};
|
my %ret = ();
|
||||||
return $ret;
|
return %ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub get_selected_CONFIG {
|
sub get_selected_CONFIG {
|
||||||
my $c = shift;
|
my $c = shift;
|
||||||
my $selected = shift; #Parameter is name of selected row.
|
my $selected = shift; #Parameter is name of selected row.
|
||||||
my $is_new_record = shift; #Indicates new record required (defaults)
|
my $is_new_record = shift; #Indicates new record required (defaults)
|
||||||
my %ret = {};
|
my %ret = ();
|
||||||
return $ret;
|
return %ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -137,7 +139,7 @@ my $cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
|
|||||||
my $dbkey = 'ChangeThis';
|
my $dbkey = 'ChangeThis';
|
||||||
# To make it write to DB as comment, delete this (regex) string in each if statement "TRUE\) \#copy or perform with value: .* e.g."
|
# 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: UPSStatus e.g. $db->set_prop($dbkey,'UPSStatus',$c->param('UPSStatus'),type=>'service'))
|
if (! TRUE) #copy or perform with value: UPSStatus e.g. $db->set_prop($dbkey,'UPSStatus',$c->param('UPSStatus')))
|
||||||
{$ret .= 'Perform/save failed for UPSStatus';}
|
{$ret .= 'Perform/save failed for UPSStatus';}
|
||||||
if ($ret eq "") {$ret = 'ok';}
|
if ($ret eq "") {$ret = 'ok';}
|
||||||
return $ret;
|
return $ret;
|
||||||
@@ -147,46 +149,54 @@ my $cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
|
|||||||
my $c = shift;
|
my $c = shift;
|
||||||
my $prefix_data = shift; #Data hash as parameter
|
my $prefix_data = shift; #Data hash as parameter
|
||||||
my $ret = "";
|
my $ret = "";
|
||||||
$cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
|
$cdb = esmith::ConfigDB::UTF8->open() || die("Couldn't open config db");
|
||||||
my $db = $cdb; #maybe one of the others
|
my $db = $cdb; #maybe one of the others
|
||||||
my $dbkey = 'nut';
|
my $dbkey = 'nut';
|
||||||
|
my $driverkey = 'nut-driver@ups';
|
||||||
# To make it write to DB as comment, delete this (regex) string in each if statement "TRUE\) \#copy or perform with value: .* e.g."
|
# 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 (!$db->set_prop($dbkey,'status',$c->param('status'),type=>'service'))
|
if (!$db->set_prop($dbkey,'status',$c->param('status')))
|
||||||
{$ret .= 'Perform/save failed for status';}
|
{$ret .= 'Perform/save failed for status';}
|
||||||
if (!$db->set_prop($dbkey,'mode',$c->param('Nutmode'),type=>'service'))
|
if (!$db->set_prop($dbkey,'Mode',$c->param('Nutmode')))
|
||||||
{$ret .= 'Perform/save failed for Nutmode';}
|
{$ret .= 'Perform/save failed for Nutmode';}
|
||||||
if (! $db->set_prop($dbkey,'SlaveUPS',$c->param('SlaveUPS_Name'),type=>'service'))
|
|
||||||
{$ret .= 'Perform/save failed for SlaveUPS_Name';}
|
# let only save info regarding the current mode
|
||||||
if (! $db->set_prop($dbkey,'MasterUPS',$c->param('MasterUPS_Name'),type=>'service'))
|
# if client mode
|
||||||
|
if (! $db->set_prop($dbkey,'ClientUPS',$c->param('ClientUPS_Name')))
|
||||||
|
{$ret .= 'Perform/save failed for ClientUPS_Name';}
|
||||||
|
if (! $db->set_prop($dbkey,'MasterUPS',$c->param('MasterUPS_Name')))
|
||||||
{$ret .= 'Perform/save failed for MasterUPS_Name';}
|
{$ret .= 'Perform/save failed for MasterUPS_Name';}
|
||||||
if (! $db->set_prop($dbkey,'SlavePass',$c->param('SlaveUPS_Pass'),type=>'service'))
|
if (! $db->set_prop($dbkey,'ClientUser',$c->param('ClientUPS_User')))
|
||||||
{$ret .= 'Perform/save failed for SlaveUPS_Pass';}
|
{$ret .= 'Perform/save failed for ClientUPS_USer';}
|
||||||
if (! $db->set_prop($dbkey,'MasterPass',$c->param('MasterUPS_Pass'),type=>'service'))
|
if (! $db->set_prop($dbkey,'ClientPass',$c->param('ClientUPS_Pass')))
|
||||||
{$ret .= 'Perform/save failed for MasterUPS_Pass';}
|
{$ret .= 'Perform/save failed for ClientUPS_Pass';}
|
||||||
if (! $db->set_prop($dbkey,'Model',$c->param('UPS_Model'),type=>'service'))
|
|
||||||
|
# if not client mode
|
||||||
|
if (! $db->set_prop($driverkey,'Model',$c->param('UPS_Model')))
|
||||||
{$ret .= 'Perform/save failed for UPS_Model';}
|
{$ret .= 'Perform/save failed for UPS_Model';}
|
||||||
if (! $db->set_prop($dbkey,'Device',$c->param('UPS_Device'),type=>'service'))
|
if (! $db->set_prop($driverkey,'Device',$c->param('UPS_Device')))
|
||||||
{$ret .= 'Perform/save failed for UPS_Device';}
|
{$ret .= 'Perform/save failed for UPS_Device';}
|
||||||
if (! $db->set_prop($dbkey,'Type',$c->param('UPS_gen_Type'),type=>'service'))
|
if (! $db->set_prop($driverkey,'Type',$c->param('UPS_gen_Type')))
|
||||||
{$ret .= 'Perform/save failed for UPS_gen_Type';}
|
{$ret .= 'Perform/save failed for UPS_gen_Type';}
|
||||||
if (! $db->set_prop($dbkey,'mfr',$c->param('UPS_gen_Mfr'),type=>'service'))
|
if (! $db->set_prop($driverkey,'mfr',$c->param('UPS_gen_Mfr')))
|
||||||
{$ret .= 'Perform/save failed for UPS_gen_Mfr';}
|
{$ret .= 'Perform/save failed for UPS_gen_Mfr';}
|
||||||
if (! $db->set_prop($dbkey,'mdl',$c->param('UPS_gen_Model'),type=>'service'))
|
if (! $db->set_prop($driverkey,'mdl',$c->param('UPS_gen_Model')))
|
||||||
{$ret .= 'Perform/save failed for UPS_gen_Model';}
|
{$ret .= 'Perform/save failed for UPS_gen_Model';}
|
||||||
|
|
||||||
|
#changes from sme10 to sme11
|
||||||
|
# slave/master is changed to secondary/primary (upstream) should bite the bullet rather sooner than latter
|
||||||
|
# we move most properties from nut to nut-driver@UPS, nut-driver@UPS1 (we only handle nut-driver@UPS in panel)
|
||||||
|
# we remove Master property (redundant)
|
||||||
|
# we add mode property, we have 3 modes :
|
||||||
|
# standalone uses primary pass
|
||||||
|
# nethserver uses primary pass
|
||||||
|
# netclient uses secondary pass
|
||||||
|
|
||||||
|
|
||||||
|
#TODO check if still needed :
|
||||||
|
|
||||||
if ($ret eq "") {
|
if ($ret eq "") {
|
||||||
$ret = 'ok';
|
$ret = 'ok';
|
||||||
#and set Master and access properties according to values
|
|
||||||
if ($db->get_prop($dbkey,"mode",'standalone') eq 'netclient'){
|
|
||||||
$db->set_prop($dbkey,'Master','no',type=>'service');
|
|
||||||
} else {
|
|
||||||
$db->set_prop($dbkey,'Master','yes',type=>'service');
|
|
||||||
}
|
|
||||||
if ($db->get_prop($dbkey,"mode",'standalone') eq 'netserver'){
|
|
||||||
$db->set_prop($dbkey,'access','private',type=>'service');
|
|
||||||
} else {
|
|
||||||
$db->set_prop($dbkey,'access','localhost',type=>'service');
|
|
||||||
}
|
|
||||||
#And run signal-event to apply templates for config files and start task.
|
#And run signal-event to apply templates for config files and start task.
|
||||||
my @result = qx{/usr/sbin/e-smith/signal-event smeserver-nutUPS-update};
|
my @result = qx{/usr/sbin/e-smith/signal-event smeserver-nutUPS-update};
|
||||||
if ($? != 0) {
|
if ($? != 0) {
|
||||||
@@ -226,16 +236,17 @@ sub get_model_options {
|
|||||||
|
|
||||||
sub get_ups_status {
|
sub get_ups_status {
|
||||||
my $c = shift;
|
my $c = shift;
|
||||||
$cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
|
$cdb = esmith::ConfigDB::UTF8->open() || die("Couldn't open config db");
|
||||||
my $nutmode = $cdb->get_prop('nut', 'mode','standalone');
|
my $nutmode = $cdb->get_prop('nut', 'Mode') || 'standalone';
|
||||||
if ($cdb->get_prop('nut', 'status', 'disabled') eq 'disabled'){
|
if ($cdb->get_prop('nut', 'status', 'disabled') eq 'disabled'){
|
||||||
return $c->l('nut_status_is_disabled')
|
return $c->l('nut_status_is_disabled')
|
||||||
} elsif ($nutmode eq 'standalone'){
|
} elsif ($nutmode eq 'netclient'){
|
||||||
return $c->get_status_from_device($cdb->get_prop('nut','MasterUPS','ups@localhost'));
|
return $c->get_status_from_device($cdb->get_prop('nut','ClientUPS'));
|
||||||
} elsif ($nutmode eq 'netserver'){
|
|
||||||
return $c->get_status_from_device($cdb->get_prop('nut','MasterUPS','ups@localhost'));
|
|
||||||
} else {
|
} else {
|
||||||
return $c->get_status_from_device($cdb->get_prop('nut','SlaveUPS','apc@192.168.1.99'));
|
# TODO: could enumerate all the upses using
|
||||||
|
# my @upses = grep(/^nut-driver\@[a-zA-Z0-9_-]+$/, $DB->keys);
|
||||||
|
# we will only use the default first one for the moment nut-driver@ups for ups named "ups"
|
||||||
|
return $c->get_status_from_device("ups");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -5,7 +5,7 @@ package SrvMngr::Controller::Nutups;
|
|||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
# heading : System
|
# heading : System
|
||||||
# description : NutUPS configuration
|
# description : NutUPS configuration
|
||||||
# navigation : 4000 700
|
# navigation : 4000 900
|
||||||
#
|
#
|
||||||
# name : nutups, method : get, url : /nutups, ctlact : Nutups#main
|
# name : nutups, method : get, url : /nutups, ctlact : Nutups#main
|
||||||
# name : nutupsu, method : post, url : /nutupsu, ctlact : Nutups#do_update
|
# name : nutupsu, method : post, url : /nutupsu, ctlact : Nutups#do_update
|
||||||
@@ -36,11 +36,7 @@ use Data::Dumper;
|
|||||||
|
|
||||||
use esmith::util;
|
use esmith::util;
|
||||||
use esmith::util::network;
|
use esmith::util::network;
|
||||||
use esmith::ConfigDB;
|
use esmith::ConfigDB::UTF8;
|
||||||
use esmith::AccountsDB;
|
|
||||||
use esmith::NetworksDB;
|
|
||||||
use esmith::HostsDB;
|
|
||||||
use esmith::DomainsDB;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -60,14 +56,7 @@ sub main {
|
|||||||
|
|
||||||
my $c = shift;
|
my $c = shift;
|
||||||
$c->app->log->info( $c->log_req );
|
$c->app->log->info( $c->log_req );
|
||||||
|
my $cdb = esmith::ConfigDB::UTF8->open() || die("Couldn't open config db");
|
||||||
#The most common ones
|
|
||||||
my $cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
|
|
||||||
my $adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db");
|
|
||||||
my $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db");
|
|
||||||
my $hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db");
|
|
||||||
my $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
|
|
||||||
|
|
||||||
my %nut_data = ();
|
my %nut_data = ();
|
||||||
my $title = $c->l('nut_NutUPS_configuration');
|
my $title = $c->l('nut_NutUPS_configuration');
|
||||||
my $modul = '';
|
my $modul = '';
|
||||||
@@ -111,15 +100,8 @@ sub do_update {
|
|||||||
|
|
||||||
my $c = shift;
|
my $c = shift;
|
||||||
$c->app->log->info($c->log_req);
|
$c->app->log->info($c->log_req);
|
||||||
my $modul = '';
|
my $modul = '';
|
||||||
|
my $cdb = esmith::ConfigDB::UTF8->open() || die("Couldn't open config db");
|
||||||
#The most common ones - you might want to comment out any not used.
|
|
||||||
my $cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
|
|
||||||
my $adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db");
|
|
||||||
my $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db");
|
|
||||||
my $hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db");
|
|
||||||
my $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
|
|
||||||
|
|
||||||
my %nut_data = ();
|
my %nut_data = ();
|
||||||
my $title = $c->l('nut_NutUPS_configuration');
|
my $title = $c->l('nut_NutUPS_configuration');
|
||||||
|
|
||||||
@@ -220,14 +202,7 @@ sub do_display {
|
|||||||
|
|
||||||
my ($c,$trt) = @_;
|
my ($c,$trt) = @_;
|
||||||
$c->app->log->info($c->log_req);
|
$c->app->log->info($c->log_req);
|
||||||
|
my $cdb = esmith::ConfigDB::UTF8->open() || die("Couldn't open config db");
|
||||||
#The most common ones - you might want to comment out any not used.
|
|
||||||
my $cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
|
|
||||||
my $adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db");
|
|
||||||
my $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db");
|
|
||||||
my $hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db");
|
|
||||||
my $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
|
|
||||||
|
|
||||||
my %nut_data = ();
|
my %nut_data = ();
|
||||||
my $title = $c->l('nut_NutUPS_configuration');
|
my $title = $c->l('nut_NutUPS_configuration');
|
||||||
my $modul = "";
|
my $modul = "";
|
||||||
|
@@ -1,30 +1,29 @@
|
|||||||
#
|
'nut_APPLY' => 'Apply',
|
||||||
# Generated by SM2Gen version: SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-01-20 16:21:33
|
'nut_ClientUPS_Password' => 'Client UPS password',
|
||||||
#
|
'nut_ClientUPS_Username' => 'Client UPS username',
|
||||||
'nut_UPS_Generic_Model' => 'UPS Generic Model',
|
|
||||||
'nut_UPS_Model' => 'UPS Model',
|
|
||||||
'nut_Manage_Nutups-config_settings:' => 'Manage Nutups-config settings',
|
|
||||||
'nut_Descriptive_paragraph' => 'Descriptive paragraph',
|
|
||||||
'nut_MasterUPS_UPSNAME@IP' => 'UPS name@localhost',
|
|
||||||
'nut_SlaveUPS_UPSNAME@IP' => 'Slave->Master UPSNAME@IP',
|
|
||||||
'nut_MasterUPS_Password' => Local server password',
|
|
||||||
'nut_SlaveUPS_Password' => 'Slaves Password ->Server',
|
|
||||||
'nut_Nut_status' => 'Nut status',
|
|
||||||
'nut_Configure_NutUPS' => 'Configure NutUPS',
|
|
||||||
'nut_CONFIG_panel_action_was_successful' => 'CONFIG panel action was successful',
|
'nut_CONFIG_panel_action_was_successful' => 'CONFIG panel action was successful',
|
||||||
'nut_UPS_Generic_Type' => 'UPS Generic Type',
|
'nut_Configure_NutUPS' => 'Configure NutUPS',
|
||||||
'nut_Status_(from_upsc)' => 'Status (from running upsc)',
|
'nut_Descriptive_paragraph' => 'You can use your UPS connected directly to your server in a standalone mode or you can act as a Primary whereby other servers can also react to the status of your connected UPS, or you can connect to another server as a Secondary and react to the status of the UPS connected to that server.',
|
||||||
'nut_Error_Status_Report' => 'Error Status Report',
|
'nut_Error_Status_Report' => 'Error Status Report',
|
||||||
'nut_if_Net_Server' => 'Net Server details',
|
|
||||||
'nut_if_genericups' => 'Generic UPS details',
|
'nut_if_genericups' => 'Generic UPS details',
|
||||||
'nut_if_Net_Client' => 'Net Client details',
|
'nut_if_Net_Client' => 'Net Client details',
|
||||||
'nut_STATUS_panel_action_was_successful' => 'STATUS panel action was successful',
|
'nut_if_Net_Server' => 'Net Server details',
|
||||||
|
'nut_Manage_Nutups-config_settings:' => 'Manage Nutups configuration settings',
|
||||||
|
'nut_MasterUPS_Password' => 'Local server password',
|
||||||
|
'nut_MasterUPS_UPSNAME@IP' => 'UPS name@localhost',
|
||||||
'nut_Nut_mode' => 'Nut mode',
|
'nut_Nut_mode' => 'Nut mode',
|
||||||
'nut_Status_Report' => 'Status Report',
|
'nut_Nut_status' => 'Nut status',
|
||||||
'nut_NutUPS_configuration' => 'NutUPS configuration',
|
'nut_NutUPS_configuration' => 'NutUPS configuration',
|
||||||
'nut_APPLY' => 'Apply',
|
'nut_Save' => 'Save',
|
||||||
|
'nut_SlaveUPS_Password' => 'Secondary->Primary ->Server',
|
||||||
|
'nut_SlaveUPS_UPSNAME@IP' => 'Secondary->Primary UPSNAME@IP',
|
||||||
|
'nut_SlaveUPS_User' => 'Secondary UPS user',
|
||||||
|
'nut_Status_(from_upsc)' => 'Status (from running upsc)',
|
||||||
|
'nut_Status_of_the_controlled_UPS' => 'Status of the controlled UPS',
|
||||||
|
'nut_STATUS_panel_action_was_successful' => 'STATUS panel action was successful',
|
||||||
|
'nut_Status_Report' => 'Status Report',
|
||||||
'nut_UPS_Device' => 'UPS Device',
|
'nut_UPS_Device' => 'UPS Device',
|
||||||
'nut_UPS_Generic_Manufacturer' => 'UPS Generic Manufacturer',
|
'nut_UPS_Generic_Manufacturer' => 'UPS Generic Manufacturer',
|
||||||
'nut_Status_of_the_controlled_UPS' => 'Status of the controlled UPS',
|
'nut_UPS_Generic_Model' => 'UPS Generic Model',
|
||||||
'nut_Save' => 'Save',
|
'nut_UPS_Generic_Type' => 'UPS Generic Type',
|
||||||
'nut_status_is_disabled' => 'Nut disabled',
|
'nut_UPS_Model' => 'UPS Model',
|
@@ -1,12 +1,16 @@
|
|||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
function toggleUPSClasses() {
|
function toggleUPSClasses() {
|
||||||
var selectedOption = $('#Nutmode_select').val();
|
var selectedOption = $('#Nutmode_select').val();
|
||||||
|
var upsModelValue = $('#UPS_Model_select').val().toLowerCase(); // Get the current value from UPS_Model
|
||||||
$('.masterups').toggle(selectedOption === 'netserver' || selectedOption === 'standalone'); // Show/Hide masterups based on Net Server or Standalone
|
$('.masterups').toggle(selectedOption === 'netserver' || selectedOption === 'standalone'); // Show/Hide masterups based on Net Server or Standalone
|
||||||
|
$('.secondaryups').toggle(selectedOption === 'netserver' ); // Show/Hide Secondary logins for net server
|
||||||
$('.slaveups').toggle(selectedOption === 'netclient'); // Show/Hide slaveups based on Net Client
|
$('.slaveups').toggle(selectedOption === 'netclient'); // Show/Hide slaveups based on Net Client
|
||||||
|
$('.generics').toggle(selectedOption !== 'netclient' && upsModelValue === 'genericups' );
|
||||||
|
|
||||||
// Enable/Disable inputs based on the selected option
|
// Enable/Disable inputs based on the selected option
|
||||||
$('.masterups input').prop('disabled', !(selectedOption === 'netserver' || selectedOption === 'standalone'));
|
$('.masterups input').prop('disabled', !(selectedOption === 'netserver' || selectedOption === 'standalone'));
|
||||||
$('.slaveups input').prop('disabled', selectedOption !== 'netclient');
|
$('.slaveups input').prop('disabled', selectedOption !== 'netclient');
|
||||||
|
$('.generics input').prop('disabled', selectedOption === 'netclient');
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleGenerics() {
|
function toggleGenerics() {
|
||||||
|
@@ -2,123 +2,135 @@
|
|||||||
%# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-01-20 16:21:33
|
%# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-01-20 16:21:33
|
||||||
%#
|
%#
|
||||||
<div id="Nutups-CONFIG" class="partial Nutups-CONFIG">
|
<div id="Nutups-CONFIG" class="partial Nutups-CONFIG">
|
||||||
<script>
|
<script>
|
||||||
window.onload = function() {
|
window.onload = function() {
|
||||||
SelectInput();
|
SelectInput();
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
% if (config->{debug} == 1) {
|
% if (config->{debug} == 1) {
|
||||||
<pre>
|
<pre>
|
||||||
%= dumper $nut_data
|
%= dumper $nut_data
|
||||||
</pre>
|
</pre>
|
||||||
% }
|
% }
|
||||||
% my $btn = l('nut_APPLY');
|
% my $btn = l('nut_APPLY');
|
||||||
%= form_for "nutupsu" => (method => 'POST') => begin
|
%= form_for "nutupsu" => (method => 'POST') => (autocomplete => "off" ) => begin
|
||||||
% param 'trt' => $nut_data->{trt} unless param 'trt';
|
% param 'trt' => $nut_data->{trt} unless param 'trt';
|
||||||
%= hidden_field 'trt' => $nut_data->{trt}
|
%= hidden_field 'trt' => $nut_data->{trt}
|
||||||
%# Inputs etc in here.
|
%# Inputs etc in here.
|
||||||
|
|
||||||
<h2 class='subh2'><%=l('nut_Manage_Nutups-config_settings:')%></h2>
|
<h2 class='subh2'><%=l('nut_Manage_Nutups-config_settings:')%></h2>
|
||||||
|
|
||||||
<p><span class=label>
|
<p><span class=label>
|
||||||
%=l('nut_Nut_status')
|
%=l('nut_Nut_status')
|
||||||
</span><span class=data>
|
</span><span class=data>
|
||||||
%# my @status_options = [['Disabled' => 'disabled'], ['Enabled' => 'enabled']];
|
%# my @status_options = [['Disabled' => 'disabled'], ['Enabled' => 'enabled']];
|
||||||
%# param 'status' => $nut_data->{status} unless param 'status';
|
%# param 'status' => $nut_data->{status} unless param 'status';
|
||||||
|
|
||||||
% my @status_options = selected_field([['Disabled' => 'disabled'], ['Enabled' => 'enabled']], $nut_data->{status});
|
% my @status_options = selected_field([['Disabled' => 'disabled'], ['Enabled' => 'enabled']], $nut_data->{status});
|
||||||
%= select_field 'status' => @status_options, class => 'input', id => 'status_select'
|
%= select_field 'status' => @status_options, class => 'input', id => 'status_select'
|
||||||
<br></span> </p>
|
<br></span> </p>
|
||||||
|
|
||||||
<p><span class=label>
|
<p><span class=label>
|
||||||
%=l('nut_Nut_mode')
|
%=l('nut_Nut_mode')
|
||||||
</span><span class=data>
|
</span><span class=data>
|
||||||
% my @Nutmode_options = [['Standalone' => 'standalone'], ['Net Server' => 'netserver'], ['Net Client ' => 'netclient']];
|
% my @Nutmode_options = [['Standalone' => 'standalone'], ['Net Server' => 'netserver'], ['Net Client ' => 'netclient']];
|
||||||
% param 'Nutmode' => $nut_data->{Nutmode} unless param 'Nutmode';
|
% param 'Nutmode' => $nut_data->{Nutmode} unless param 'Nutmode';
|
||||||
%= select_field 'Nutmode' => @Nutmode_options, class => 'input', id => 'Nutmode_select'
|
%= select_field 'Nutmode' => @Nutmode_options, class => 'input', id => 'Nutmode_select'
|
||||||
<br></span> </p>
|
<br></span> </p>
|
||||||
|
|
||||||
<div class=masterups>
|
<div class=masterups>
|
||||||
<h2 class='subh3'><%=l('nut_if_Net_Server')%></h2>
|
<div class=secondaryups>
|
||||||
|
<h2 class='subh3'><%=l('nut_if_Net_Server')%></h2>
|
||||||
|
<p><span class=label>
|
||||||
|
%=l('nut_MasterUPS_UPSNAME@IP')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'MasterUPS_Name' => $nut_data->{MasterUPS_Name} unless param 'MasterUPS_Name';
|
||||||
|
%= 'ups@'. $nut_data->{'localip'}
|
||||||
|
<br></span></p>
|
||||||
|
|
||||||
<p><span class=label>
|
<p><span class='label'>
|
||||||
%=l('nut_MasterUPS_UPSNAME@IP')
|
%=l('nut_SlaveUPS_User')
|
||||||
</span><span class=data>
|
</span><span class=data>
|
||||||
% param 'MasterUPS_Name' => $nut_data->{MasterUPS_Name} unless param 'MasterUPS_Name';
|
%= 'upssecondary'
|
||||||
%= text_field 'MasterUPS_Name', size => '50', class => 'textinput MasterUPS_Name' , pattern=>'.*' , placeholder=>'ups@localhost'
|
</span></p>
|
||||||
<br></span></p>
|
|
||||||
|
|
||||||
<p><span class='label'>
|
<p><span class='label'>
|
||||||
%=l('nut_MasterUPS_Password')
|
%=l('nut_SlaveUPS_Password')
|
||||||
</span><span class=data>
|
</span><span class=data>
|
||||||
% param 'MasterUPS_Password' => $nut_data->{MasterUPS_Password} unless param 'MasterUPS_Password';
|
<%= $nut_data->{'SlaveUPS_Pass'}%>
|
||||||
%=password_field 'MasterUPS_Password', class => 'pass6 sme-password'
|
</span></p>
|
||||||
</span></p>
|
</div>
|
||||||
|
<div>
|
||||||
|
<h2><%= l ('nut_UPS_Device') %></h2>
|
||||||
|
<p><span class=label>
|
||||||
|
%=l('nut_UPS_Model')
|
||||||
|
</span><span class=data>
|
||||||
|
% my @UPS_Model_options = $c->get_model_options();
|
||||||
|
% param 'UPS_Model' => $nut_data->{UPS_Model} unless param 'UPS_Model';
|
||||||
|
%= select_field 'UPS_Model' => \@UPS_Model_options, class => 'input', id => 'UPS_Model_select'
|
||||||
|
<br></span> </p>
|
||||||
|
|
||||||
<p><span class=label>
|
<p><span class=label>
|
||||||
%=l('nut_UPS_Model')
|
%=l('nut_UPS_Device')
|
||||||
</span><span class=data>
|
</span><span class=data>
|
||||||
% my @UPS_Model_options = $c->get_model_options();
|
% param 'UPS_Device' => $nut_data->{UPS_Device} unless param 'UPS_Device';
|
||||||
% param 'UPS_Model' => $nut_data->{UPS_Model} unless param 'UPS_Model';
|
%= text_field 'UPS_Device', size => '50', class => 'textinput UPS_Device' , pattern=>'.*' , placeholder=>'auto (for usb)'
|
||||||
%= select_field 'UPS_Model' => \@UPS_Model_options, class => 'input', id => 'UPS_Model_select'
|
<br></span></p>
|
||||||
<br></span> </p>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<p><span class=label>
|
<div class=slaveups>
|
||||||
%=l('nut_UPS_Device')
|
<h2 class='subh4'><%=l('nut_if_Net_Client')%></h2>
|
||||||
</span><span class=data>
|
<p><span class=label>
|
||||||
% param 'UPS_Device' => $nut_data->{UPS_Device} unless param 'UPS_Device';
|
%=l('nut_SlaveUPS_UPSNAME@IP')
|
||||||
%= text_field 'UPS_Device', size => '50', class => 'textinput UPS_Device' , pattern=>'.*' , placeholder=>'auto (for usb)'
|
</span><span class=data>
|
||||||
<br></span></p>
|
% param 'ClientUPS_Name' => $nut_data->{ClientUPS_Name} unless param 'ClientUPS_Name';
|
||||||
</div>
|
%= text_field 'ClientUPS_Name', size => '50', class => 'textinput ClientUPS_Name' , pattern=>'.*' , placeholder=>'upsname@IP[:port]'
|
||||||
|
<br></span></p>
|
||||||
|
|
||||||
<div class=slaveups>
|
<p><span class='label'>
|
||||||
<h2 class='subh4'><%=l('nut_if_Net_Client')%></h2>
|
%=l('nut_ClientUPS_Username')
|
||||||
<p><span class=label>
|
</span><span class=data>
|
||||||
%=l('nut_SlaveUPS_UPSNAME@IP')
|
% param 'ClientUPS_User' => $nut_data->{ClientUPS_User} unless param 'ClientUPS_User';
|
||||||
</span><span class=data>
|
%=text_field 'ClientUPS_User', class => 'textinput'
|
||||||
% param 'SlaveUPS_Name' => $nut_data->{SlaveUPS_Name} unless param 'SlaveUPS_Name';
|
</span></p>
|
||||||
%= text_field 'SlaveUPS_Name', size => '50', class => 'textinput SlaveUPS_Name' , pattern=>'.*' , placeholder=>'upsname@IP'
|
|
||||||
<br></span></p>
|
|
||||||
|
|
||||||
<p><span class='label'>
|
<p><span class='label'>
|
||||||
%=l('nut_SlaveUPS_Password')
|
%=l('nut_ClientUPS_Password')
|
||||||
</span><span class=data>
|
</span><span class=data>
|
||||||
% param 'SlaveUPS_Password' => $nut_data->{SlaveUPS_Password} unless param 'SlaveUPS_Password';
|
% param 'ClientUPS_Pass' => $nut_data->{ClientUPS_Pass} unless param 'ClientUPS_Pass';
|
||||||
%=password_field 'SlaveUPS_Password', class => 'pass4 sme-password'
|
%=password_field 'ClientUPS_Pass', class => 'pass4 sme-password', autocomplete => 'off'
|
||||||
</span></p>
|
</span></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class=generics>
|
<div class=generics>
|
||||||
` <h2 class='subh5'><%=l('nut_if_genericups')%></h2>
|
<h2 class='subh5'><%=l('nut_if_genericups')%></h2>
|
||||||
<p><span class=label>
|
<p><span class=label>
|
||||||
%=l('nut_UPS_Generic_Type')
|
%=l('nut_UPS_Generic_Type')
|
||||||
</span><span class=data>
|
</span><span class=data>
|
||||||
% param 'UPS_gen_Type' => $nut_data->{UPS_gen_Type} unless param 'UPS_gen_Type';
|
% param 'UPS_gen_Type' => $nut_data->{UPS_gen_Type} unless param 'UPS_gen_Type';
|
||||||
%= text_field 'UPS_gen_Type', size => '50', class => 'textinput UPS_gen_Type' , pattern=>'.*' , placeholder=>'UPS_gen_Type'
|
%= text_field 'UPS_gen_Type', size => '50', class => 'textinput UPS_gen_Type' , pattern=>'.*' , placeholder=>'UPS_gen_Type'
|
||||||
<br></span></p>
|
<br></span></p>
|
||||||
|
|
||||||
<p><span class=label>
|
<p><span class=label>
|
||||||
%=l('nut_UPS_Generic_Manufacturer')
|
%=l('nut_UPS_Generic_Manufacturer')
|
||||||
</span><span class=data>
|
</span><span class=data>
|
||||||
% param 'UPS_gen_Mfr' => $nut_data->{UPS_gen_Mfr} unless param 'UPS_gen_Mfr';
|
% param 'UPS_gen_Mfr' => $nut_data->{UPS_gen_Mfr} unless param 'UPS_gen_Mfr';
|
||||||
%= text_field 'UPS_gen_Mfr', size => '50', class => 'textinput UPS_gen_Mfr' , pattern=>'.*' , placeholder=>'UPS_gen_Mfr'
|
%= text_field 'UPS_gen_Mfr', size => '50', class => 'textinput UPS_gen_Mfr' , pattern=>'.*' , placeholder=>'UPS_gen_Mfr'
|
||||||
<br></span></p>
|
<br></span></p>
|
||||||
|
|
||||||
<p><span class=label>
|
<p><span class=label>
|
||||||
%=l('nut_UPS_Generic_Model')
|
%=l('nut_UPS_Generic_Model')
|
||||||
</span><span class=data>
|
</span><span class=data>
|
||||||
% param 'UPS_gen_Model' => $nut_data->{UPS_gen_Model} unless param 'UPS_gen_Model';
|
% param 'UPS_gen_Model' => $nut_data->{UPS_gen_Model} unless param 'UPS_gen_Model';
|
||||||
%= text_field 'UPS_gen_Model', size => '50', class => 'textinput UPS_gen_Model' , pattern=>'.*' , placeholder=>'UPS_gen_Model'
|
%= text_field 'UPS_gen_Model', size => '50', class => 'textinput UPS_gen_Model' , pattern=>'.*' , placeholder=>'UPS_gen_Model'
|
||||||
<br></span></p>
|
<br></span></p>
|
||||||
` </div>
|
</div>
|
||||||
|
|
||||||
<span class='data'>
|
<span class='data'>
|
||||||
%= submit_button l('nut_Save'), class => 'action subm12'
|
%= submit_button l('nut_Save'), class => 'action subm12'
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
%# Probably finally by a submit.
|
||||||
|
%end
|
||||||
|
|
||||||
%# Probably finally by a submit.
|
|
||||||
%end
|
|
||||||
</div>
|
</div>
|
@@ -35,6 +35,8 @@
|
|||||||
<p class='paragraph para1'>
|
<p class='paragraph para1'>
|
||||||
%=l('nut_Descriptive_paragraph')
|
%=l('nut_Descriptive_paragraph')
|
||||||
</p>
|
</p>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
<span class=label>
|
<span class=label>
|
||||||
@@ -45,6 +47,35 @@
|
|||||||
</span><br>
|
</span><br>
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
<span class=label>
|
||||||
|
%=l('nut_Nut_mode')
|
||||||
|
</span><span class=data>
|
||||||
|
%= $nut_data->{Nutmode}
|
||||||
|
</span><br>
|
||||||
|
|
||||||
|
% if ($nut_data->{Nutmode} eq "nutserver") {
|
||||||
|
<div class=secondaryups>
|
||||||
|
<p><span class=label>
|
||||||
|
%=l('nut_MasterUPS_UPSNAME@IP')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'MasterUPS_Name' => $nut_data->{MasterUPS_Name} unless param 'MasterUPS_Name';
|
||||||
|
%= 'ups@'. $nut_data->{'localip'}
|
||||||
|
<br></span></p>
|
||||||
|
|
||||||
|
<p><span class='label'>
|
||||||
|
%=l('nut_SlaveUPS_User')
|
||||||
|
</span><span class=data>
|
||||||
|
%= 'upssecondary'
|
||||||
|
</span></p>
|
||||||
|
|
||||||
|
<p><span class='label'>
|
||||||
|
%=l('nut_SlaveUPS_Password')
|
||||||
|
</span><span class=data>
|
||||||
|
<%= $nut_data->{'SlaveUPS_Pass'}%>
|
||||||
|
</span></p>
|
||||||
|
</div>
|
||||||
|
% }
|
||||||
|
|
||||||
%= include 'partials/_nut_UPS_STATUS'
|
%= include 'partials/_nut_UPS_STATUS'
|
||||||
|
|
||||||
%# Probably finally by a submit.
|
%# Probably finally by a submit.
|
||||||
|
@@ -16,7 +16,17 @@
|
|||||||
<h2>Battery Status</h2>
|
<h2>Battery Status</h2>
|
||||||
<table>
|
<table>
|
||||||
<tr><td>Charge:</td><td><%= $nut_data->{'ups_data'}->{'battery.charge'} %>%</td></tr>
|
<tr><td>Charge:</td><td><%= $nut_data->{'ups_data'}->{'battery.charge'} %>%</td></tr>
|
||||||
<tr><td>Runtime:</td><td><%= sprintf("%.2f", $nut_data->{'ups_data'}->{'battery.runtime'} / 60) %> minutes</td></tr>
|
%#<tr><td>Runtime:</td><td><%= sprintf("%.2f", $nut_data->{'ups_data'}->{'battery.runtime'} / 60) %> minutes</td></tr>
|
||||||
|
<td>Runtime:</td>
|
||||||
|
<td>
|
||||||
|
<%
|
||||||
|
my $runtime = $nut_data->{'ups_data'}->{'battery.runtime'};
|
||||||
|
my $runtime_minutes = (defined $runtime && $runtime =~ /^\d+(\.\d+)?$/)
|
||||||
|
? sprintf("%.2f", $runtime / 60)
|
||||||
|
: 'N/A';
|
||||||
|
%>
|
||||||
|
<%= $runtime_minutes %> minutes
|
||||||
|
</td>
|
||||||
<tr><td>Voltage:</td><td><%= $nut_data->{'ups_data'}->{'battery.voltage'} %>V</td></tr>
|
<tr><td>Voltage:</td><td><%= $nut_data->{'ups_data'}->{'battery.voltage'} %>V</td></tr>
|
||||||
<tr><td>Type:</td><td><%= $nut_data->{'ups_data'}->{'battery.type'} %></td></tr>
|
<tr><td>Type:</td><td><%= $nut_data->{'ups_data'}->{'battery.type'} %></td></tr>
|
||||||
</table>
|
</table>
|
||||||
|
@@ -4,7 +4,7 @@ Summary: SME server - nut UPS interaction module
|
|||||||
%define name smeserver-nutUPS
|
%define name smeserver-nutUPS
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
%define version 11.0.0
|
%define version 11.0.0
|
||||||
%define release 7
|
%define release 20
|
||||||
Version: %{version}
|
Version: %{version}
|
||||||
Release: %{release}%{?dist}
|
Release: %{release}%{?dist}
|
||||||
License: GPL
|
License: GPL
|
||||||
@@ -12,7 +12,8 @@ Group: Networking/Daemons
|
|||||||
Source: %{name}-%{version}.tar.xz
|
Source: %{name}-%{version}.tar.xz
|
||||||
|
|
||||||
BuildRoot: /var/tmp/%{name}-%{version}-%{release}-buildroot
|
BuildRoot: /var/tmp/%{name}-%{version}-%{release}-buildroot
|
||||||
Requires: nut nut-client
|
Requires: nut >= 2.8.2
|
||||||
|
Requires: nut-client
|
||||||
Obsoletes: neon <= 0.25.5
|
Obsoletes: neon <= 0.25.5
|
||||||
Requires: smeserver-lib >= 1.15.1-16
|
Requires: smeserver-lib >= 1.15.1-16
|
||||||
BuildArchitectures: noarch
|
BuildArchitectures: noarch
|
||||||
@@ -25,8 +26,49 @@ A module which configures the Network UPS Tools suite for operation with
|
|||||||
the SME server software.
|
the SME server software.
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Jul 07 2025 John Crisp <jcrisp@safeandsoundit.co.uk> 11.0.0-20.sme
|
||||||
|
- Remove errant backticks
|
||||||
|
- Add div to section to enhance formatting in Net Server mode
|
||||||
|
|
||||||
|
* Mon Jul 07 2025 Brian Read <brianr@koozali.org> 11.0.0-19.sme
|
||||||
|
- Changes from JC (thanks) and also make sure descriptions fit in with Master->Primary and Slave->Secondary [SME: 13069]
|
||||||
|
Also write descriptive paragraph as no-one else has!
|
||||||
|
Also also, incorporate newly auditted lex file
|
||||||
|
|
||||||
|
* Fri Jun 13 2025 Brian Read <brianr@koozali.org> 11.0.0-18.sme
|
||||||
|
- Adjust call from Custom to be emtpy hash not hashref [SME: 13042]
|
||||||
|
|
||||||
|
* Fri Jun 13 2025 Brian Read <brianr@koozali.org> 11.0.0-17.sme
|
||||||
|
- Fix return from function in Nutups-custom [SME: 13042]
|
||||||
|
- Check Seconds left for zero before dividing by 60 [SME: 13042]
|
||||||
|
|
||||||
|
* Fri Jun 13 2025 Brian Read <brianr@koozali.org> 11.0.0-16.sme
|
||||||
|
- Change Navigation weighting for SM2 [SME: 12996]
|
||||||
|
|
||||||
|
* Wed Jun 11 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-15.sme
|
||||||
|
- open db flat file using UTF8 [SME: 13035]
|
||||||
|
|
||||||
|
* Mon Jun 02 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-14.sme
|
||||||
|
- fix typo preventing netserver enabling [SME: 13021]
|
||||||
|
|
||||||
|
* Wed May 28 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-13.sme
|
||||||
|
- filter out nut* services from syslog (use journalctl) [SME: 13013]
|
||||||
|
|
||||||
|
* Sat May 24 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-11.sme
|
||||||
|
- fix issue with standalone and netserver mode [SME: 13012]
|
||||||
|
|
||||||
|
* Sun May 18 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-10.sme
|
||||||
|
- add pollinterval setting [SME: 13006]
|
||||||
|
- update config for Nut 2.8.2 [SME: 12657]
|
||||||
|
|
||||||
|
* Tue Mar 18 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-9.sme
|
||||||
|
- update config for Nut 2.8.2 [SME: 12657]
|
||||||
|
|
||||||
|
* Wed Mar 05 2025 Brian Read <brianr@koozali.org> 11.0.0-8.sme
|
||||||
|
- typo in lex file [SME: 12949]
|
||||||
|
|
||||||
* Mon Mar 03 2025 Brian Read <brianr@koozali.org> 11.0.0-7.sme
|
* Mon Mar 03 2025 Brian Read <brianr@koozali.org> 11.0.0-7.sme
|
||||||
- Enhance UPS Status screen [SME: ]
|
- Enhance UPS Status screen [SME: i12949]
|
||||||
|
|
||||||
* Mon Mar 03 2025 Brian Read <brianr@koozali.org> 11.0.0-6.sme
|
* Mon Mar 03 2025 Brian Read <brianr@koozali.org> 11.0.0-6.sme
|
||||||
- Add in SM2 NutUPS configuration and status panel [SME: 12949]
|
- Add in SM2 NutUPS configuration and status panel [SME: 12949]
|
||||||
@@ -97,9 +139,9 @@ the SME server software.
|
|||||||
|
|
||||||
* Thu Jan 22 2015 stephane de Labrusse <stephdl@de-labrusse.fr> 2.4.0-3.sme
|
* Thu Jan 22 2015 stephane de Labrusse <stephdl@de-labrusse.fr> 2.4.0-3.sme
|
||||||
- Remove obsolete directives {ACL,ACCEPT,REJECT} and switch to LISTEN
|
- Remove obsolete directives {ACL,ACCEPT,REJECT} and switch to LISTEN
|
||||||
- in /etc/ups/upsd.conf
|
in /etc/ups/upsd.conf
|
||||||
- Allow NUT in /etc/hosts.allow and in /etc/services [SME: 8793]
|
- Allow NUT in /etc/hosts.allow and in /etc/services [SME: 8793]
|
||||||
- Code change from Daniel B.<daniel@firewall-services.com>
|
Code change from Daniel B.<daniel@firewall-services.com>
|
||||||
|
|
||||||
* Thu Jan 31 2013 Shad L. Lords <slords@mail.com> 2.4.0-2.sme
|
* Thu Jan 31 2013 Shad L. Lords <slords@mail.com> 2.4.0-2.sme
|
||||||
- Obsolete el5 packages that used to be required [SME: 7273]
|
- Obsolete el5 packages that used to be required [SME: 7273]
|
||||||
|
Reference in New Issue
Block a user