Make nut ups monitoring work

This commit is contained in:
Daniel A. Maierhofer
2018-03-03 15:36:17 +01:00
parent 2fc852685a
commit 31f238b92a
20 changed files with 154 additions and 102 deletions

View File

@@ -0,0 +1,5 @@
# {{ ansible_managed }}
# /etc/nut/nut.conf
MODE=netserver

View File

@@ -0,0 +1,8 @@
# {{ ansible_managed }}
# /etc/default/nut
START_UPSD=yes
UPSD_OPTIONS=""
START_UPSMON=yes
UPSMON_OPTIONS=""

View File

@@ -0,0 +1,8 @@
# {{ ansible_managed }}
# /etc/nut/ups.conf
[{{ ups_type }}]
driver = {{ ups_drv }}
port = {{ ups_port }}
desc = {{ ups_desc }}

View File

@@ -0,0 +1,6 @@
# {{ ansible_managed }}
# /etc/nut/upsd.conf
LISTEN 127.0.0.1 3493
LISTEN ::1 3493

View File

@@ -0,0 +1,12 @@
# {{ ansible_managed }}
# /etc/nut/upsd.users
[master]
password = {{ ups_master_pw }}
upsmon master
{% if ups_slave_pw -%}
[slave]
password = {{ ups_slave_pw }}
upsmon slave
{% endif %}

View File

@@ -0,0 +1,7 @@
# {{ ansible_managed }}
# /etc/nut/upsmon.conf
MONITOR {{ ups_type }}@localhost 1 master {{ ups_master_pw }} master
NOTIFYCMD /sbin/upssched
NOTIFYFLAG ONBATT SYSLOG+WALL+EXEC

View File

@@ -0,0 +1,10 @@
# {{ ansible_managed }}
# /etc/nut/upssched.conf
CMDSCRIPT /etc/nut/upssched/upsscript
PIPEFN /etc/nut/upssched/upssched.pipe
LOCKFN /etc/nut/upssched/upssched.lock
AT ONBATT * START-TIMER onbatt 120
AT ONLINE * CANCEL-TIMER onbatt
AT LOWBATT * EXEC lowbatt

View File

@@ -0,0 +1,14 @@
# {{ ansible_managed }}
# /etc/nut/upssched/upsscript
#! /bin/sh
case $1 in
onbatt)
ssh
;;
lowbatt)
/sbin/upssched fsd;;
*)
echo "wrong Parameter";;
esac