hakayova
2026-Jan-10 21:21 UTC
[Nut-upsuser] help requested for setting up email notification of UPS events
Dear list, I apologize for my lack of expertise in troubleshooting this problem. I am trying to setup email notification to myself in the event of several UPS events. I did read and follow the documentation at https://networkupstools.org/docs/user-manual.chunked/Advanced_usage_scheduling_notes.html. I have a working UPS setup on my NAS, which runs FreeBSD14.3. It can communicate with the UPS, and both nut and upsd services are running as expected. I made the following changes in the upsmon.conf to enable email notification to myself: NOTIFYCMD /usr/local/bin/mailme NOTIFYFLAG ONLINE SYSLOG+WALL+EXEC NOTIFYFLAG ONBATT 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 This is the script /usr/local/bin/mailme: #!/usr/bin/env sh echo "$*" | /usr/bin/mail -s "Notification for UPS event" myemail at example.com Documentations recommends restarting upsmon after these changes; however upsmon is a client and it is not running as a service at least in my setting. I did reload and restarted nut and upsd services without errors after making these changes. Moreover, I tested my script by executing it from command line and received an email with the correct subject and empty content as expected. However, a power outage simulation by plugging the UPS off did not trigger an email notification. What am I missing? Any pointers will be greatly appreciated. Hakayova
Greg Troxel
2026-Jan-10 23:23 UTC
[Nut-upsuser] help requested for setting up email notification of UPS events
hakayova via Nut-upsuser <nut-upsuser at alioth-lists.debian.net> writes:> I have a working UPS setup on my NAS, which runs FreeBSD14.3. It can > communicate with the UPS, and both nut and upsd services are running > as expected. I made the following changes in the upsmon.conf to enable > email notification to myself: > > NOTIFYCMD /usr/local/bin/mailme > NOTIFYFLAG ONLINE SYSLOG+WALL+EXEC > NOTIFYFLAG ONBATT 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 > > This is the script /usr/local/bin/mailme: > > #!/usr/bin/env sh > > echo "$*" | /usr/bin/mail -s "Notification for UPS event" myemail at example.com- check that the script is 755 or 555 permissions - become the nut user with su, /bin/sh, and clear out the environment. Set PATH to dafault. Then /usr/local/bin/mailme foo bar baz and see what happens - read /var/log/messages and /var/log/maillog, or however you spell those logs on your system