[Nut-upsuser] NOTIFYMSG as content of email

Simon Wilson simon at simonandkate.net
Sun Nov 27 03:01:14 GMT 2022


Hi, new NUT user here, so please bear with me.

I have setup my Eaton 5SX, and am trying to do a simple notification  
email, without going to the more complex upssched examples.

I have a simple notification command listed in upsmon.conf, and have  
added +EXEC to the NOTIFYFLAGs:

NOTIFYCMD /etc/ups/notifycmd.sh
NOTIFYFLAG ONLINE     SYSLOG+EXEC
NOTIFYFLAG ONBATT     SYSLOG+EXEC

...the script passes the variables to msmtp to send an email on an event:

#!/bin/bash
EMAIL='simon at simonandkate.net'
echo -e "Subject: UPS ALERT: $NOTIFYTYPE\n\nUPS: $UPSNAME\r\nAlert  
type: $NOTIFYTYPE" | msmtp $EMAIL

That results in an email saying (e.g.):

Subject: UPS ALERT: ONBATT
UPS: eaton5sx at localhost
Alert type: ONBATT

I'd like it to read per the NOTIFYMSG content in upsmon.conf, e.g.:

Subject: UPS ALERT: UPS eaton5sx is on battery
UPS: eaton5sx at localhost
Alert type: UPS eaton5sx is on battery


...but I can't work out how to read the NOTIFYMSG into the script  
instead of NOTIFYTYPE. How do I do that?

Simon.

-- 
Simon Wilson
M: 0400 12 11 16




More information about the Nut-upsuser mailing list