maxhoesel.nut_netclient
maxhoesel.nut_netclient
This guide helps you install NUT and upsmon on a target system so that it can monitor a remote UPS over the network in netclient mode.
Requirements
- A host with one of the following operating systems:
- Ubuntu 18.04 LTS or newer
- Debian 9 or newer
- You need become privileges on the host.
Role Variables
NOTE: For more details about upsmon.conf settings and their meanings, check here.
nut_netclient_monitors
- A list of UPS systems to keep an eye on.
- Each entry should include:
system
: The UPS to monitor (Format:<upsname>[@<hostname>[:<port>]]
)powervalue
: Number of power sources that this UPS provides to the host (usually 1)username
: Remote monitor user’s namepassword
: Remote monitor user’s passwordtype
: The type of UPS connection, eithermaster
orslave
- Example:
nut_netclient_monitors: - system: "[email protected]" powervalue: 1 username: monitor password: a-secure-password type: slave - system: "[email protected]" powervalue: 1 username: monitor password: a-different-password type: slave
- Required: Yes
- Default:
undefined
nut_netclient_notifymsg_<type>
- Custom notification messages for different types of alerts.
- Valid message types can be found in the upsmon manual (under NOTIFYMSG).
- Example:
nut_netclient_notifymsg_online: UPS %s is back online nut_netclient_notifymsg_lowbatt: UPS %s is now on low battery
nut_netclient_notifyflag_<type>
- Set notification flags for specific events.
- Valid types and flags can be found in the upsmon manual.
- Example:
nut_netclient_notifyflag_online: SYSLOG nut_netclient_notifymsg_lowbatt: SYSLOG+WALL+EXEC
All variables below start with the prefix nut_netclient_
:
Name | Summary | Required | Default |
---|---|---|---|
deadtime |
Time to declare the UPS "dead" in seconds | No | 15 |
finaldelay |
Time between last shutdown warning and command in seconds | No | 5 |
hostsync |
Timeout for master and slaves during shutdown in seconds | No | 15 |
minsupplies |
Minimum supplies needed to keep running | No | 1 |
nocommwarntime |
Time between communication error warnings in seconds | No | 300 |
notifycmd |
Command to send messages | No | undefined |
pollfreq |
Time between UPS checks in seconds | No | 5 |
pollfreqalert |
Time between UPS checks when on battery power in seconds | No | 5 |
powerdownflag |
Flag file created by upsmon during shutdown | No | /etc/killpower |
rbwarntime |
Time to send battery replacement messages in seconds | No | 43200 |
run_as_user |
Run the monitor as a different user | No | undefined |
shutdowncmd |
Command to execute when shutting down the system (must be in quotes if it contains spaces) | No | "/sbin/shutdown -h +0" |
certpath |
Path to a certificate file or database | No | undefined |
certident |
Certificate identifier to retrieve (if using NSS) | No | undefined |
certhost |
Host directives (if using NSS) | No | undefined |
certverify |
Whether to verify SSL certificates (0 or 1) | No | undefined |
forcessl |
Whether to force SSL connections (0 or 1) | No | undefined |
Example Playbook
- hosts: all
become: yes
tasks:
- name: Run nut_netclient
include_role:
name: maxhoesel.nut_netclient
vars:
nut_netclient_monitors:
- system: "[email protected]"
powervalue: 1
username: monitor
password: a-secure-password
type: slave
Testing
This role uses tox and molecule for testing purposes. Make sure you have the following installed:
- python3-tox
- Docker
To run the tests, execute test.sh
in the root directory of this role. You can see and run specific tests with tox -l
.
Installa
ansible-galaxy install maxhoesel.nut_netclient
Licenza
gpl-3.0
Download
11.9k
Proprietario
Junior Automation and Infrastructure Engineer, Bachelor in CompSci. I write Ansible content and DevOps-related tools, mostly in Rust