Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/filipnet/ups-telegram-notify
Notification of the status of an Uninterruptible Power Supply by Telegram
https://github.com/filipnet/ups-telegram-notify
notification nut script shell-script state telegram uninterruptible-power-supply ups
Last synced: 14 days ago
JSON representation
Notification of the status of an Uninterruptible Power Supply by Telegram
- Host: GitHub
- URL: https://github.com/filipnet/ups-telegram-notify
- Owner: filipnet
- License: bsd-3-clause
- Created: 2023-05-16T13:00:10.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-06-28T11:11:23.000Z (7 months ago)
- Last Synced: 2024-06-29T11:58:31.916Z (7 months ago)
- Topics: notification, nut, script, shell-script, state, telegram, uninterruptible-power-supply, ups
- Language: Shell
- Homepage:
- Size: 31.3 KB
- Stars: 8
- Watchers: 2
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ups-telegram-notify
Notification of the status of an Uninterruptible Power Supply by Telegram
In the event of a power failure, you may want to be notified in order to check systems that are not protected. It is also interesting to know whether there has been a prolonged power failure and whether measures have been initiated in the form of shutdowns. To realise this via the messanger Telegram, this Linux script solution can be used.## REQUIREMENT DEPENDENCIES
Debian: ```apt-get install nut```
Redhat: ```dnf install nut -y```
## NUT CONFIGURATION EXAMPLE
### /etc/nut/ups.conf
```
[eaton]
driver = usbhid-ups
port = auto
vendorid = 0463
pollfreq = 30
```
### /etc/nut/nut.conf
```
MODE=netserver
LISTEN 0.0.0.0 3493
LISTEN ::1 3493
```
### /etc/nut/upsd.user
```
[upsmon]
password = supersecretpassword
upsmon master
actions = SET
instcmds = ALL
```
### /etc/nut/upsmon.conf
```
MONITOR [email protected] 1 upsmon supersecretpassword master
POWERDOWNFLAG /etc/killpower
SHUTDOWNCMD "/sbin/shutdown -h now"
```
### Enable and starting service
```
sudo systemctl enable nut-server.service && sudo systemctl start nut-server.service
sudo systemctl enable nut-monitor.service && sudo systemctl start nut-monitor.service
sudo systemctl status nut-server.service
sudo systemctl status nut-monitor.service
netstat -tulpen |grep 3493
```## DOWNLOAD AND INSTALLATION
Download von Notification Script von Github-Repository
```
cd /etc/nut
wget https://raw.githubusercontent.com/filipnet/ups-telegram-notify/main/notifycmd.sh
chmod +x notifycmd.sh
```## CONFIGURATION
Don´t forget to change the first lines ```GROUP_ID```and ```BOT_TOKEN``` Parameters inside the script.
Open file ```/etc/nut/upsmon.conf```with your favorite editor (vim/nano) and add the following lines to the end of the config file.
```
# Email script for NOTIFYCMD
NOTIFYCMD "/etc/nut/notifycmd.sh"# Notification events
NOTIFYFLAG ONLINE SYSLOG+WALL+EXEC
NOTIFYFLAG ONBATT SYSLOG+WALL+EXEC
NOTIFYFLAG LOWBATT SYSLOG+WALL+EXEC
NOTIFYFLAG FSD SYSLOG+WALL+EXEC
NOTIFYFLAG COMMOK SYSLOG+WALL+EXEC
NOTIFYFLAG COMMBAD SYSLOG+WALL+EXEC
NOTIFYFLAG SHUTDOWN SYSLOG+WALL+EXEC
NOTIFYFLAG REPLBATT SYSLOG+WALL+EXEC
NOTIFYFLAG NOCOMM SYSLOG+WALL+EXEC
NOTIFYFLAG NOPARENT SYSLOG+WALL+EXEC
```Restart nut services to take affect
```
sudo systemctl restart nut-server.service
sudo systemctl restart nut-driver.service
sudo systemctl restart nut-monitor.service
```
## TEST / DRY-RUNExecute the script:
```
cd /etc/nut/
./notifycmd.sh
```
## LICENSEups-telegram-notify and all individual scripts are under the BSD 3-Clause license unless explicitly noted otherwise. Please refer to the LICENSE