Abilitare le notifiche via mail in Nut UPS: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
|||
| Line 35: | Line 35: | ||
* Riavviare Nut | * Riavviare Nut | ||
sudo invoke-rc.d nut restart | |||
* È possibile usare upssched se si vogliono mandare gli alter solo dopo un tot tempo (VEdi Riferimenti) | |||
* '''NOTA:''' È possibile usare upssched se si vogliono mandare gli alter solo dopo un tot tempo (VEdi Riferimenti) | |||
==Riferimenti== | ==Riferimenti== | ||
*[http://www.interphero.com/?p=139 Make your UPS email you with NUT | Interphero Miscellany] | *[http://www.interphero.com/?p=139 Make your UPS email you with NUT | Interphero Miscellany] | ||
*[http://articles.techrepublic.com.com/5100-10878_11-6040972.html Customize UPS-related alerts in NUT] | *[http://articles.techrepublic.com.com/5100-10878_11-6040972.html Customize UPS-related alerts in NUT] | ||
Revision as of 14:59, 9 September 2010
- Installare mail
sudo aptitude install mailx
- Cambiare la descrizione dell'utente Nut
sudo usermod -c "Nut UPS ${HOSTNAME}" nut
- Abilitare le notifiche e definire il comando da eseguire:
cat | sudo tee -a /etc/nut/upsmon.conf > /dev/null <<EOFile NOTIFYCMD /usr/local/bin/nut-notify NOTIFYFLAG ONLINE SYSLOG+WALL+EXEC NOTIFYFLAG ONBATT SYSLOG+WALL+EXEC NOTIFYFLAG LOWBATT 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 FSD SYSLOG+WALL+EXEC EOFile
- Creare lo script di notifica
cat | sudo tee /usr/local/bin/nut-notify > /dev/null << EOFile
#!/bin/sh
echo "$*" | mail -s "${HOSTNAME} UPS Notice" gal-alert@rvmgroup.it
EOFile
sudo chmod +x /usr/local/bin/nut-notify
- Riavviare Nut
sudo invoke-rc.d nut restart
- NOTA: È possibile usare upssched se si vogliono mandare gli alter solo dopo un tot tempo (VEdi Riferimenti)