Email notification about UPS power supply

Got a suggestion for future Synology products? Suggest it here!
We'll forward your idea to our RD department.

Re: Notification email needs more settings !

Postby BertBigB » Mon Feb 27, 2012 4:04 pm

+ 1 more, I would like the functionality to setup what type of notifications will be send and at what stage (succes or failure or both)
BertBigB
Beginner
Beginner
 
Posts: 20
Joined: Tue Nov 14, 2006 12:11 am

Re: Notification email needs more settings !

Postby HarryPotter » Mon Feb 27, 2012 7:21 pm

Goog news, it is implemented in DSM 4.0 ! :)
*Please do not Private Message me for support questions; leave it on the forum so all members can learn. Thanks!*

DS712+ / DSM 4.2 3211 / 2 x HD204UI (RAID0) / LMS 7.7.2-007
DS110+ / DSM 4.2 3211 / HD154UI
DS408 / DSM 4.0 2228 / 3 x ST31000340AS (RAID0) + 1 x HDS721010KLA330
DS207+ / DSM 3.1.1636 / ST31000340AS + WD5000KS
DS-106x / DSM 4.0 2228 (from DS108j) /

2 Squeezebox 3 + Boom
Rapsody N35

APC Smart UPS SUA750i
User avatar
HarryPotter
Honorary Moderator
Honorary Moderator
 
Posts: 12397
Joined: Mon Oct 23, 2006 12:48 pm
Location: Switzerland

Re: Notification email needs more settings !

Postby Metrik » Mon Feb 27, 2012 11:35 pm

How about notification when DiskStation is running on UPS battery due to a power outage? And notification when power is back to normal? Is that in 4.0?

The messages gets written to the System Log, but they aren't included for notifications. I would find it very useful.
User avatar
Metrik
Beginner
Beginner
 
Posts: 22
Joined: Sun Feb 19, 2012 11:20 pm

Re: Notification email needs more settings !

Postby HarryPotter » Tue Feb 28, 2012 12:52 am

Editable notifications about power supply (in DSM 4.0 Beta)

Power supply recovered
Power supply failed
UPS connected
UPS disconnected

Probably the first 2 are about the ones you are looking for.

EDIT: I tested this and didnt get an email, so I was wrong and can say that "device" on battery" is missing. Power supply recovered and failed seem to be available for multi supply models only.
*Please do not Private Message me for support questions; leave it on the forum so all members can learn. Thanks!*

DS712+ / DSM 4.2 3211 / 2 x HD204UI (RAID0) / LMS 7.7.2-007
DS110+ / DSM 4.2 3211 / HD154UI
DS408 / DSM 4.0 2228 / 3 x ST31000340AS (RAID0) + 1 x HDS721010KLA330
DS207+ / DSM 3.1.1636 / ST31000340AS + WD5000KS
DS-106x / DSM 4.0 2228 (from DS108j) /

2 Squeezebox 3 + Boom
Rapsody N35

APC Smart UPS SUA750i
User avatar
HarryPotter
Honorary Moderator
Honorary Moderator
 
Posts: 12397
Joined: Mon Oct 23, 2006 12:48 pm
Location: Switzerland

Re: Notification email needs more settings !

Postby Metrik » Tue Feb 28, 2012 11:56 am

HarryPotter wrote:Power supply recovered and failed seem to be available for multi supply models only.


That is a shame. My 212j isn't supported then. The messages are there, in the System Log, so it would be rather easy to implement on the single supply models too. Must be a marketing decision, I guess.

Here's the System Log from my 212j, using DSM 3.2 and running off of an APC BackUPS CS 350, where I pulled the mains and re-engaged it an hour or so later:

    00:05:22 Server back online.
    -
    23:50:40 Server going to Safe Shutdown.
    22:47:36 Server is on battery.

Having a notification of a power outage in my house emailed to me (at work), would be absolutely awesome. We have (as many have) installations in the house depending on power, most importantly pumps that pumps heated water through the house floors and radiators. With instant notification, I could order a repair the same day instead of having to wait till the next day.
User avatar
Metrik
Beginner
Beginner
 
Posts: 22
Joined: Sun Feb 19, 2012 11:20 pm

Re: Email notification about UPS power supply

Postby nicko_mv » Wed Mar 07, 2012 10:42 am

I emailed Synology support about this some time ago - they indicated that in the release version of 4.0 they would have more notification options..

Has this been included in the new notification options?
nicko_mv
Student
Student
 
Posts: 66
Joined: Wed Mar 07, 2012 10:27 am

Re: Email notification about UPS power supply

Postby HarryPotter » Wed Mar 07, 2012 12:10 pm

nicko_mv wrote:Has this been included in the new notification options?

No, unfortunately this option hasnot been added.
*Please do not Private Message me for support questions; leave it on the forum so all members can learn. Thanks!*

DS712+ / DSM 4.2 3211 / 2 x HD204UI (RAID0) / LMS 7.7.2-007
DS110+ / DSM 4.2 3211 / HD154UI
DS408 / DSM 4.0 2228 / 3 x ST31000340AS (RAID0) + 1 x HDS721010KLA330
DS207+ / DSM 3.1.1636 / ST31000340AS + WD5000KS
DS-106x / DSM 4.0 2228 (from DS108j) /

2 Squeezebox 3 + Boom
Rapsody N35

APC Smart UPS SUA750i
User avatar
HarryPotter
Honorary Moderator
Honorary Moderator
 
Posts: 12397
Joined: Mon Oct 23, 2006 12:48 pm
Location: Switzerland

Re: Email notification about UPS power supply

Postby nicko_mv » Wed Mar 07, 2012 12:15 pm

HarryPotter wrote:
nicko_mv wrote:Has this been included in the new notification options?

No, unfortunately this option hasnot been added.


HarryPotter - Are you using the APC SMX750 (LCD version) with your diskstation? Does it work OK?
nicko_mv
Student
Student
 
Posts: 66
Joined: Wed Mar 07, 2012 10:27 am

Re: Email notification about UPS power supply

Postby HarryPotter » Wed Mar 07, 2012 12:24 pm

nicko_mv wrote:HarryPotter - Are you using the APC SMX750 (LCD version) with your diskstation? Does it work OK?

No, I have a APC SUA750i and that one works fine
*Please do not Private Message me for support questions; leave it on the forum so all members can learn. Thanks!*

DS712+ / DSM 4.2 3211 / 2 x HD204UI (RAID0) / LMS 7.7.2-007
DS110+ / DSM 4.2 3211 / HD154UI
DS408 / DSM 4.0 2228 / 3 x ST31000340AS (RAID0) + 1 x HDS721010KLA330
DS207+ / DSM 3.1.1636 / ST31000340AS + WD5000KS
DS-106x / DSM 4.0 2228 (from DS108j) /

2 Squeezebox 3 + Boom
Rapsody N35

APC Smart UPS SUA750i
User avatar
HarryPotter
Honorary Moderator
Honorary Moderator
 
Posts: 12397
Joined: Mon Oct 23, 2006 12:48 pm
Location: Switzerland

Re: Email notification about UPS power supply

Postby quietsy » Wed Mar 21, 2012 11:53 pm

Here is how to add email notifications for the following events:
UPS is on battery
UPS is back online
UPS is on low battery
UPS forced shutdown
NAS is back to normal

Before making any changes, it's recommended to make a copy of the original files!

Edit /usr/syno/etc/ups/upssched.conf and add the following red line at the end:
AT ONLINE * EXECUTE online
AT ONBATT * EXECUTE onbatt
AT ONLINE * CANCEL-TIMER fsd
AT LOWBATT * EXECUTE lowbatt
AT NOCOMM * EXECUTE nocomm
AT FSD * EXECUTE fsd

Run the following command to make a copy of the file (more on that below):
cp /usr/syno/etc/ups/upssched.conf /usr/syno/etc/ups/upssched.conf.OK

Add the following lines to the end of /usr/syno/synoman/webman/texts/enu/mails (this is for mails in English):
Code: Select all


[UPSDown]
Subject: UPS is down! %HOSTNAME% is on Battery.

UPS is down! %HOSTNAME% on Battery.


[UPSUp]
Subject: UPS is up! %HOSTNAME% is back to normal.

UPS is up! %HOSTNAME% is back to normal.


[UPSOnLineBoot]
Subject: %HOSTNAME% is now active.

%HOSTNAME% is now active.


[UPSLow]
Subject: UPS is low on battery or lost communication! %HOSTNAME% is in SafeMode.

UPS is low on battery or lost communication! %HOSTNAME% is in SafeMode.


[UPSFSD]
Subject: UPS is in Forced Shutdown state! %HOSTNAME% is in SafeMode.

UPS is in Forced Shutdown state! %HOSTNAME% is in SafeMode.



Add the following in red to the beginning of /usr/syno/bin/synoups :
echo "Usage: `basename $0` { online | onbatt | lowbatt | nocomm | fsd }"

And add the following in red to /usr/syno/bin/synoups a little above the end:

UPSSendMsg() {
St=`UPSStatusGet`
if [ "$St" = "OL" ]; then
echo "UPS is On-Line"
return
fi
if [ "$St" = "OB" ]; then
echo "UPS is On-Battery"
/usr/syno/bin/synomail UPSDown
SYSLOG "UPS on battery."
return
fi
}


case "$1" in
online)
/usr/syno/bin/synomail UPSUp
UPSRestart
;;
onbatt)
UPSSendMsg $1
;;

lowbatt | nocomm)
/usr/syno/bin/synomail UPSLow
UPSSafeMode $1
;;
fsd)
/usr/syno/bin/synomail UPSFSD
touch /usr/syno/ups_post_fsd

/usr/syno/sbin/upsmon -c fsd
UPSSafeMode $1
;;
esac

Create the file /usr/syno/etc.defaults/rc.d/S99UPSMail.sh which is used to restore upssched.conf after restart so it won't go back to default, it also contains a sleep of 360 seconds which is needed to send the "NAS is back to normal" notification but you can play with it.
And the contents of /usr/syno/etc.defaults/rc.d/S99UPSMail.sh :

Code: Select all
#!/bin/sh

if [ "$1" = "start" ]
then
cp -p /usr/syno/etc/ups/upssched.conf.OK /usr/syno/etc/ups/upssched.conf

if [ -e /usr/syno/ups_post_fsd ]
then
rm -rf /usr/syno/ups_post_fsd
sleep 360
/usr/syno/bin/synomail UPSOnLineBoot
fi
fi


And lastly, set it to execute:
chmod +x /usr/syno/etc.defaults/rc.d/S99UPSMail.sh
Last edited by quietsy on Sat Apr 14, 2012 1:05 am, edited 3 times in total.
DS411 - 4 x Seagate 2TB 5900RPM
DS110j - 1 x Seagate 750GB 7200RPM
APC Smart UPS 750VA
IPux ICS2330 Cam
quietsy
Experienced
Experienced
 
Posts: 106
Joined: Tue Oct 11, 2011 12:47 am

Re: Email notification about UPS power supply

Postby nicko_mv » Thu Mar 22, 2012 9:29 am

Thanks very much! This is a great help.

Just to clarify the different events...

UPS is on Battery - AC has failed
UPS is back online - AC restored before NAS has shut down
NAS is back to Normal - AC Restored after NAS has shut down due to AC fail, and has started up successfully

Is that right or have I misunderstood?
Thanks
nicko_mv
Student
Student
 
Posts: 66
Joined: Wed Mar 07, 2012 10:27 am

Re: Email notification about UPS power supply

Postby quietsy » Thu Mar 22, 2012 9:53 am

You are correct.
When the UPS is on battery, you have to wait about a minute before getting the email, I guess there is a process that polls the UPS every minute or two for status.
When the UPS is back on AC, the notification is sent immediately.
I didn't test the low battery and forced shutdown since only the email itself has been added so it should work.

And its only been tested on DSM 4.0.
DS411 - 4 x Seagate 2TB 5900RPM
DS110j - 1 x Seagate 750GB 7200RPM
APC Smart UPS 750VA
IPux ICS2330 Cam
quietsy
Experienced
Experienced
 
Posts: 106
Joined: Tue Oct 11, 2011 12:47 am

Re: Email notification about UPS power supply

Postby Metrik » Thu Mar 22, 2012 7:04 pm

Thank you quietsy. A very helpful post and very easy to follow your excellent guide. It works fine on my DS 212j with DSM 4.0. I guess at the next update, this little modification will be overwritten. Hopefully it won't mess up an update.
User avatar
Metrik
Beginner
Beginner
 
Posts: 22
Joined: Sun Feb 19, 2012 11:20 pm

Re: Email notification about UPS power supply

Postby quietsy » Thu Mar 22, 2012 7:28 pm

Glad I could help.

You are right about having to re-do these changes after every DSM update (better do it manually and not copy the files because there might be changes to them on the DSM update), but at least I have the peace of mind knowing that if anything happens, I get notified right away.
DS411 - 4 x Seagate 2TB 5900RPM
DS110j - 1 x Seagate 750GB 7200RPM
APC Smart UPS 750VA
IPux ICS2330 Cam
quietsy
Experienced
Experienced
 
Posts: 106
Joined: Tue Oct 11, 2011 12:47 am

Re: Email notification about UPS power supply

Postby nicko_mv » Thu Mar 22, 2012 7:32 pm

Ive been on synology's back about this for some time, but to no avail - and I know others have as well. I wonder why they just dont include support for this from the get-go?
nicko_mv
Student
Student
 
Posts: 66
Joined: Wed Mar 07, 2012 10:27 am

PreviousNext

Return to Feature Requests & Product Improvement Suggestions

Who is online

Users browsing this forum: Kobold and 8 guests