4 Commits

Author SHA1 Message Date
2465aaab22 * 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]
2025-05-28 00:28:41 -04:00
8bdde34a82 * Wed May 28 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-12.sme
- fix [SME: ]
2025-05-28 00:24:11 -04:00
830b29b569 * Sat May 24 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-11.sme
- fix issue with standalone and netserver mode [SME: 13012]
2025-05-24 16:09:49 -04:00
e235701fe2 * 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]
2025-05-18 01:01:00 -04:00
7 changed files with 37 additions and 15 deletions

View File

@@ -34,6 +34,7 @@ safe_symlink("try-restart", "root/etc/e-smith/events/$event/services2adjust/nut-
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/rsyslog.conf", $event);
event_link("nut-config", $event, "4");
event_link("nut-config-drivers", $event, "50");
event_link("systemd-default", $event, "88");

View 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

View File

@@ -3,5 +3,5 @@ MODE={
return "none" unless ( ($nut{"status"}||"disabled") eq "enabled");
# if Master no => netclient
# if Master yes => standalone or netserver
$nut{mode} || "standalone";
$nut{Mode} || "standalone";
}

View File

@@ -1,16 +1,20 @@
{
my $poll = $nut{pollInterval} || '2';
if ($poll ne '2') {
$OUT .= "pollinterval = $poll\n";
}
my @upses = grep(/^nut-driver\@[a-zA-Z0-9_-]+$/, $DB->keys);
foreach my $ups ( sort {$a cmp $b} @upses )
{
my $nnut = ${$ups};
my $status = $nnut{status} || "disabled";
my $status = ${"$ups"}{status} || "disabled";
next if $status eq "disabled";
my ($name )= $ups =~ /^nut-driver\@(.*)$/ ;
my $model = $nnut{Model} || "usbhid-ups";
my $device = $nnut{Device} || "auto"; #"/var/lib/ups/hiddev0";
my $type = $nnut{Type};
my $mfr = $nnut{mfr};
my $mdl = $nnut{mdl};
my $model = ${"$ups"}{Model} || "usbhid-ups";
my $device = ${"$ups"}{Device} || "auto"; #"/var/lib/ups/hiddev0";
my $type = ${"$ups"}{Type};
my $mfr = ${"$ups"}{mfr};
my $mdl = ${"$ups"}{mdl};
$OUT .= "[$name]\n";
$OUT .= "\tdriver = $model\n";
if ($model eq 'genericups')

View File

@@ -253,7 +253,10 @@ sub get_ups_status {
} elsif ($nutmode eq 'netclient'){
return $c->get_status_from_device($cdb->get_prop('nut','ClientUPS'));
} else {
return $c->get_status_from_device($cdb->get_prop('nut','MasterUPS'));
# 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");
}
}

View File

@@ -1,13 +1,16 @@
$(document).ready(function() {
function toggleUPSClasses() {
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
$('.secondaryups').toggle(selectedOption === 'netserver' ); // Show/Hide Secondary logins for net server
$('.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
$('.masterups input').prop('disabled', !(selectedOption === 'netserver' || selectedOption === 'standalone'));
$('.slaveups input').prop('disabled', selectedOption !== 'netclient');
$('.generics input').prop('disabled', selectedOption === 'netclient');
}
function toggleGenerics() {

View File

@@ -4,7 +4,7 @@ Summary: SME server - nut UPS interaction module
%define name smeserver-nutUPS
Name: %{name}
%define version 11.0.0
%define release 9
%define release 13
Version: %{version}
Release: %{release}%{?dist}
License: GPL
@@ -26,12 +26,18 @@ A module which configures the Network UPS Tools suite for operation with
the SME server software.
%changelog
* 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]
TODO review master/slave mode
TODO convert master/slave to primary/secondary
TODO convert to new config data + migrate
TODO event and action
* Wed Mar 05 2025 Brian Read <brianr@koozali.org> 11.0.0-8.sme
- typo in lex file [SME: 12949]