Skip to content
Permalink
Browse files

Parameterize ups istance name and user

In some slave scenarios UPS, master UPS could not be a NethServer: in those cases, the user (`upsmon`) and the ups' istance name (`UPS`) hardcoded into this template could no work.
We can parameterize "MONITOR" directive to use `nut-server` props and easily change the user and the ups' istance name.
  • Loading branch information...
nrauso committed May 23, 2019
1 parent bd0d19c commit 4d39f6b8a16a5cb31ae5cb4a8d2bc3aed265f31a
Showing with 3 additions and 1 deletion.
  1. +3 −1 root/etc/e-smith/templates/etc/ups/upsmon.conf/20access
@@ -1,6 +1,8 @@
{
my $ip = '';
my $mode = '';
my $user = ${'nut-server'}{'User'} || 'upsmon';
my $ups = ${'nut-server'}{'Ups'} || 'UPS';
my $pass = ${'nut-server'}{'Password'} || ' ';
my $status = ${'nut-server'}{'status'} || 'disabled';
if ($status eq 'enabled') {
@@ -11,5 +13,5 @@
$mode = 'slave';
}

$OUT.="MONITOR UPS\@$ip 1 upsmon $pass $mode";
$OUT.="MONITOR $ups\@$ip 1 $user $pass $mode";
}

0 comments on commit 4d39f6b

Please sign in to comment.
You can’t perform that action at this time.