Compare commits
7 Commits
11_0_0-11_
...
11_0_0-18_
Author | SHA1 | Date | |
---|---|---|---|
7e4ab54b55 | |||
32cfcf5ed3 | |||
f58cc8a22f | |||
e13529e660 | |||
abb67327c6 | |||
2465aaab22 | |||
8bdde34a82 |
@@ -15,11 +15,11 @@ foreach (qw(bootstrap-console-save console-save smeserver-nutUPS-update nut-conf
|
||||
templates2events("/etc/ups/upsd.conf", $_);
|
||||
}
|
||||
|
||||
event_link("nut-config", "post-upgrade" , "4");
|
||||
event_link("nut-config", "post-upgrade" , "04");
|
||||
event_link("nut-config-drivers", "post-upgrade", "50");
|
||||
|
||||
my $event= "nut-conf";
|
||||
event_link("nut-config", $event, "4");
|
||||
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");
|
||||
@@ -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);
|
||||
event_link("nut-config", $event, "4");
|
||||
templates2events("/etc/rsyslog.conf", $event);
|
||||
event_link("nut-config", $event, "04");
|
||||
event_link("nut-config-drivers", $event, "50");
|
||||
event_link("systemd-default", $event, "88");
|
||||
|
@@ -23,7 +23,7 @@ fi
|
||||
# nut is enabled
|
||||
|
||||
# we set services depending on Mode
|
||||
Mode=$(/sbin/e-smith/config getprop nut Mode || echo "standelone")
|
||||
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
|
||||
|
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
|
||||
|
@@ -7,22 +7,12 @@
|
||||
#
|
||||
use esmith::util;
|
||||
use esmith::util::network;
|
||||
use esmith::ConfigDB;
|
||||
use esmith::HostsDB;
|
||||
use esmith::AccountsDB;
|
||||
use esmith::NetworksDB;
|
||||
use esmith::DomainsDB;
|
||||
use esmith::ConfigDB::UTF8;
|
||||
|
||||
use constant FALSE => 0;
|
||||
use constant TRUE => 1;
|
||||
|
||||
|
||||
#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");
|
||||
our $cdb;
|
||||
|
||||
# Validation routines - parameters for each panel
|
||||
|
||||
@@ -76,7 +66,7 @@ my $cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
|
||||
sub get_data_for_panel_STATUS {
|
||||
# Return a hash with the fields required which will be loaded into the shared data
|
||||
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 = (
|
||||
#'Data1'=>'Data for STATUS', #Example
|
||||
# fields from Inputs in STATUS $fields['STATUS']
|
||||
@@ -92,7 +82,7 @@ my $cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
|
||||
sub get_data_for_panel_CONFIG {
|
||||
# Return a hash with the fields required which will be loaded into the shared data
|
||||
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 = (
|
||||
'Data1'=>'Data for CONFIG', #Example
|
||||
'localip'=>$cdb->get_value('LocalIP'),
|
||||
@@ -126,16 +116,16 @@ my $cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
|
||||
my $c = shift;
|
||||
my $selected = shift; #Parameter is name of selected row.
|
||||
my $is_new_record = shift; #Indicates new record required (defaults)
|
||||
my %ret = {};
|
||||
return $ret;
|
||||
my %ret = ();
|
||||
return %ret;
|
||||
}
|
||||
|
||||
sub get_selected_CONFIG {
|
||||
my $c = shift;
|
||||
my $selected = shift; #Parameter is name of selected row.
|
||||
my $is_new_record = shift; #Indicates new record required (defaults)
|
||||
my %ret = {};
|
||||
return $ret;
|
||||
my %ret = ();
|
||||
return %ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -159,7 +149,7 @@ my $cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
|
||||
my $c = shift;
|
||||
my $prefix_data = shift; #Data hash as parameter
|
||||
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 $dbkey = 'nut';
|
||||
my $driverkey = 'nut-driver@ups';
|
||||
@@ -246,7 +236,7 @@ sub get_model_options {
|
||||
|
||||
sub get_ups_status {
|
||||
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';
|
||||
if ($cdb->get_prop('nut', 'status', 'disabled') eq 'disabled'){
|
||||
return $c->l('nut_status_is_disabled')
|
||||
@@ -289,4 +279,4 @@ sub get_status_from_device {
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
1;
|
@@ -5,7 +5,7 @@ package SrvMngr::Controller::Nutups;
|
||||
#----------------------------------------------------------------------
|
||||
# heading : System
|
||||
# description : NutUPS configuration
|
||||
# navigation : 4000 700
|
||||
# navigation : 4000 900
|
||||
#
|
||||
# name : nutups, method : get, url : /nutups, ctlact : Nutups#main
|
||||
# name : nutupsu, method : post, url : /nutupsu, ctlact : Nutups#do_update
|
||||
@@ -36,11 +36,7 @@ use Data::Dumper;
|
||||
|
||||
use esmith::util;
|
||||
use esmith::util::network;
|
||||
use esmith::ConfigDB;
|
||||
use esmith::AccountsDB;
|
||||
use esmith::NetworksDB;
|
||||
use esmith::HostsDB;
|
||||
use esmith::DomainsDB;
|
||||
use esmith::ConfigDB::UTF8;
|
||||
|
||||
|
||||
|
||||
@@ -60,14 +56,7 @@ sub main {
|
||||
|
||||
my $c = shift;
|
||||
$c->app->log->info( $c->log_req );
|
||||
|
||||
#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 $cdb = esmith::ConfigDB::UTF8->open() || die("Couldn't open config db");
|
||||
my %nut_data = ();
|
||||
my $title = $c->l('nut_NutUPS_configuration');
|
||||
my $modul = '';
|
||||
@@ -111,15 +100,8 @@ sub do_update {
|
||||
|
||||
my $c = shift;
|
||||
$c->app->log->info($c->log_req);
|
||||
my $modul = '';
|
||||
|
||||
#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 $modul = '';
|
||||
my $cdb = esmith::ConfigDB::UTF8->open() || die("Couldn't open config db");
|
||||
my %nut_data = ();
|
||||
my $title = $c->l('nut_NutUPS_configuration');
|
||||
|
||||
@@ -220,14 +202,7 @@ sub do_display {
|
||||
|
||||
my ($c,$trt) = @_;
|
||||
$c->app->log->info($c->log_req);
|
||||
|
||||
#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 $cdb = esmith::ConfigDB::UTF8->open() || die("Couldn't open config db");
|
||||
my %nut_data = ();
|
||||
my $title = $c->l('nut_NutUPS_configuration');
|
||||
my $modul = "";
|
||||
@@ -309,4 +284,4 @@ sub do_display {
|
||||
);
|
||||
$c->render(template => "nutups");
|
||||
}
|
||||
1;
|
||||
1;
|
||||
|
@@ -16,7 +16,17 @@
|
||||
<h2>Battery Status</h2>
|
||||
<table>
|
||||
<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>Type:</td><td><%= $nut_data->{'ups_data'}->{'battery.type'} %></td></tr>
|
||||
</table>
|
||||
|
@@ -4,7 +4,7 @@ Summary: SME server - nut UPS interaction module
|
||||
%define name smeserver-nutUPS
|
||||
Name: %{name}
|
||||
%define version 11.0.0
|
||||
%define release 11
|
||||
%define release 18
|
||||
Version: %{version}
|
||||
Release: %{release}%{?dist}
|
||||
License: GPL
|
||||
@@ -26,6 +26,25 @@ A module which configures the Network UPS Tools suite for operation with
|
||||
the SME server software.
|
||||
|
||||
%changelog
|
||||
* 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]
|
||||
|
||||
@@ -111,9 +130,9 @@ the SME server software.
|
||||
|
||||
* 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
|
||||
- in /etc/ups/upsd.conf
|
||||
in /etc/ups/upsd.conf
|
||||
- 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
|
||||
- Obsolete el5 packages that used to be required [SME: 7273]
|
||||
|
Reference in New Issue
Block a user