belgotux.nut_client
nut-client
Role to install nut client to monitor a remote nut-server for local-server Also install this script as dependance :
Role dependancies
No need dependancies anymore
Role Variables
The role can work as it with the default configuration.
Needed
notifynut_methodcan be [mail|pushbullet|telegram|pushover|sms] (defaultmail)notifynut_mailtomail adresse or alias to send notification (default root)nut_modecan be [netclient|netserver] netserver is for the server that is attached to UPS by USB for IP card (default netclient)nut_typecan be [slave|master]. Master when the server is attached to UPS by USB. Slave when the server need to connect to another server (default master)nut_ups_nameyour ups namenut_ups_ipyour ups server ipnut_ups_portnut port (default 3493)nut_usernut user to monitor the upsnut_passwordnut password to monitor the ups
Notification
Common
notifynut_logfile(default/var/log/nutNotify/nutNotify.log)notifynut_flagfile(default/var/log/nutNotify/nutShutdown.flag)notifynut_curlBin(default/usr/bin/curl)notifynut_mailBin(default/usr/bin/mail)notifynut_subjectDefaultSuject use by all methods if not override (default"$HOSTNAME UPS event $argument on $ups@$server !")notifynut_bodyDefaultMessage use by all methods if not override (default"UPS event $argument on $ups at $(date +'%d-%m-%y %H:%M:%S')")
Need one method at least
notifynut_mailfromMail sendernotifynut_mailtoMail recipientnotifynut_sms_providerBetamax/Dellmont provider with sms API like jumblo.comnotifynut_sms_usernameUsernamenotifynut_sms_passwordPasswordnotifynut_sms_numberGSM number international format +32xxxxxxxxnotifynut_pushbullet_accessTokenPushbullet token like o.xxxxxxxxxxxxxxxxxxxxxxxxxxxxnotifynut_pushbullet_providerApiProvider API (default"https://api.pushbullet.com/v2/pushes")notifynut_pushbullet_subjectShort subject for pushbullet (default"UPS event $argument")notifynut_telegram_accessTokenTelegram tokennotifynut_telegram_chatIDTelegram chat IDnotifynut_telegram_providerApiTelegram API to change if you use your own server (default"https://api.telegram.org")notifynut_telegram_subjectShort subject for pushbullet (default"UPS event $argument")notifynut_pushover_appTokenPushover Application tokennotifynut_pushover_userkeyPushover User keynotifynut_pushover_providerApiProvider API (default"https://api.pushover.net/1/messages.json")notifynut_pushover_subjectShort subject for pushover (default"UPS event $argument")
Doing different notification method in case of event
notifynut_method_onlineone method or a list of method in this format(telegram mail)(default same value of$methodDefault)notifynut_method_onbattidemnotifynut_method_lowbattidemnotifynut_method_fsdidemnotifynut_method_shutdownidemnotifynut_method_commidemnotifynut_method_serveronlineidem
Example Playbook
For clients
- hosts: [homeservers]
remote_user: root
roles:
- role: basic
- role: nut-client
vars:
nut_mode: netclient
nut_type: slave
notifynut_method: pushbullet
notifynut_pushbullet_accessToken: o.xxxxx
#if you don't want notification from clients i.e.
notifynut_method: none
notifynut_method_comm: telegram
notifynut_method_serveronline: mail
For the ups server :
- hosts: [upsserver]
remote_user: root
roles:
- role: basic
- role: nut-client
vars:
nut_mode: netserver
notifynut_method: telegram
notifynut_mailfrom: "NUT $HOSTNAME <[email protected]>"
notifynut_mailto: "[email protected]"
notifynut_telegram_accessToken: xxx
notifynut_telegram_chatID: xxx
# all notifications for the server and special for online i.e.
notifynut_method: telegram
notifynut_method_online: (telegram mail)
License
Author Information
Belgotux MonLinux
Link
See this article about nut UPS notifications for more informations (in french)
Install
ansible-galaxy install belgotux.nut_clientLicense
gpl-3.0
Downloads
58
Owner
