aboutsummaryrefslogtreecommitdiffstats
path: root/config/nut/nut.inc
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2014-12-26 10:13:10 -0200
committerRenato Botelho <garga@FreeBSD.org>2014-12-26 10:13:10 -0200
commitf1e4be204011e1d8e3bf884bebbf13ce85018ecd (patch)
tree6efa1ec2c0b1893d8861a256a246459ad853aaa7 /config/nut/nut.inc
parentf6997abd704fdd082e5215ff23e3f36bb03727aa (diff)
parent5dad2a3d4ad07cdf28ab32a5429173d335894916 (diff)
downloadpfsense-packages-f1e4be204011e1d8e3bf884bebbf13ce85018ecd.tar.gz
pfsense-packages-f1e4be204011e1d8e3bf884bebbf13ce85018ecd.tar.bz2
pfsense-packages-f1e4be204011e1d8e3bf884bebbf13ce85018ecd.zip
Merge pull request #730 from SunStroke74/patch-1
Diffstat (limited to 'config/nut/nut.inc')
-rw-r--r--config/nut/nut.inc18
1 files changed, 18 insertions, 0 deletions
diff --git a/config/nut/nut.inc b/config/nut/nut.inc
index 5a61d41a..aa0bbe13 100644
--- a/config/nut/nut.inc
+++ b/config/nut/nut.inc
@@ -185,6 +185,7 @@
$remoteuser = nut_config('remoteuser');
$remotepass = nut_config('remotepass');
$shutdownflag = (nut_config('powerdown') == 'on') ? '-p' : '-h';
+ $custom_upsmonconf = str_replace(";", "\n", nut_config('custom_upsmonconf'));
if(!($remotename && $remoteaddr && $remoteuser && $remotepass))
return false;
@@ -195,6 +196,7 @@ MONITOR {$remotename}@{$remoteaddr} 1 {$remoteuser} {$remotepass} slave
MINSUPPLIES 1
SHUTDOWNCMD "/sbin/shutdown {$shutdownflag} +0"
POWERDOWNFLAG /etc/killpower
+{$custom_upsmonconf}
EOD;
$stop = <<<EOD
@@ -233,6 +235,10 @@ EOD;
$allowuser = nut_config('allowuser');
$allowpass = nut_config('allowpass');
$shutdownflag = (nut_config('powerdown') == 'on') ? '-p' : '-h';
+ $custom_upsconf = str_replace(";", "\n", nut_config('custom_upsconf'));
+ $custom_upsdconf = str_replace(";", "\n", nut_config('custom_upsdconf'));
+ $custom_upsdusers = str_replace(";", "\n", nut_config('custom_upsdusers'));
+ $custom_upsmonconf = str_replace(";", "\n", nut_config('custom_upsmonconf'));
if(!($name && $driver && $port))
@@ -265,10 +271,12 @@ EOD;
$ups_conf .= "cable={$cable}\n";
if($upstype)
$ups_conf .= "upstype={$upstype}\n";
+ $ups_conf .= "{$custom_upsconf}";
/* upsd.conf */
$upsd_conf = "LISTEN 127.0.0.1\n";
$upsd_conf .= "LISTEN ::1\n";
+ $upsd_conf .= "{$custom_upsdconf}";
$password = uniqid("nut");
/* upsd.users */
@@ -280,6 +288,7 @@ EOD;
$upsd_users .= "password = $allowpass\n";
$upsd_users .= "upsmon master\n";
}
+ $upsd_users .= "{$custom_upsdusers}";
if ($pfs_version == "2.1")
$upsdrvctl = "/usr/local/libexec/nut/upsdrvctl";
@@ -292,6 +301,7 @@ MONITOR {$name}@localhost 1 monuser {$password} master
MINSUPPLIES 1
SHUTDOWNCMD "/sbin/shutdown {$shutdownflag} +0"
POWERDOWNFLAG /etc/killpower
+{$custom_upsmonconf}
EOD;
$stop = <<<EOD
@@ -366,6 +376,10 @@ EOD;
$snmpdisabletransfer = (nut_config('snmpdisabletransfer') == 'on');
$allowuser = nut_config('allowuser');
$allowpass = nut_config('allowpass');
+ $custom_upsconf = str_replace(";", "\n", nut_config('custom_upsconf'));
+ $custom_upsdconf = str_replace(";", "\n", nut_config('custom_upsdconf'));
+ $custom_upsdusers = str_replace(";", "\n", nut_config('custom_upsdusers'));
+ $custom_upsmonconf = str_replace(";", "\n", nut_config('custom_upsmonconf'));
if(!($name && $driver && $port))
return false;
@@ -386,10 +400,12 @@ EOD;
$ups_conf .= "pollfreq={$snmpfreq}\n";
if($snmpdisabletransfer)
$ups_conf .= "notransferoids=true\n";
+ $ups_conf .= "{$custom_upsconf}";
/* upsd.conf */
$upsd_conf = "LISTEN 127.0.0.1\n";
$upsd_conf .= "LISTEN ::1\n";
+ $upsd_conf .= "{$custom_upsdconf}";
$password = uniqid("nut");
/* upsd.users */
@@ -401,6 +417,7 @@ EOD;
$upsd_users .= "password = $allowpass\n";
$upsd_users .= "upsmon master\n";
}
+ $upsd_users .= "{$custom_upsdusers}";
if ($pfs_version == "2.1")
$upsdrvctl = "/usr/local/libexec/nut/upsdrvctl";
@@ -413,6 +430,7 @@ MONITOR {$name}@localhost 1 monuser {$password} master
MINSUPPLIES 1
SHUTDOWNCMD "/sbin/shutdown {$shutdownflag} +0"
POWERDOWNFLAG /etc/killpower
+{$custom_upsmonconf}
EOD;
$stop = <<<EOD