Email alerts dont work one my cloud

I’ve this problem in the past but thought i would re visit it.

I have two my cloud drives. Both running the latest FW. Conenct to the same LAN, same router.

One my cloud can send out auto email alersts e.g network link down, reboot alert etc.

Whereas the second one shows this in the user.log after a reboot

Mar 21 18:24:36 nas2 : System ready
Mar 21 18:24:38 nas2 logger: WD NAS: Email alerts REST API failed to return Success
Mar 21 18:24:38 nas2 : Check if new firmware is available
Mar 21 18:24:38 nas2 getNewFirmwareUpgrade.sh: begin script: immediate send_alert
Mar 21 18:24:39 nas2 getNewFirmwareUpgrade.sh: http://support.wdc.com/nas/list.asp?devtype=sq&devfw=04.01.03-421&devlang=eng&devsn=&auto=0

Note that i CAN send a test email form the dashboard, that works…

If i also try to send an alert email manually by using the command below, i get the same error messge about the REST APT in the user.log. The same command sends the email alert fine on my other my cloud… This is bugging the **bleep** out of me

/usr/local/sbin/sendAlert.sh 2001

Any ideas?

Hi alirz1, have you tried doing a system only restore? 

@alirz1 

Have you installed anything from the v4 repo?

Try:

ln -s /var/www/rest-api/lib/pear/includes /usr/share/pear

I only installed/updated rsync from FOX_exe’s repo. However i have done that on both my my cloud drives. My second my cloud drive has alot more stuff running on it from the v4 repo e.g. transmission, flexget etc and that one sends emails fine.

For some reason i dont think its related to V4 repo packages. The emails were working at at some point few days they stopped working. I had this issue long time ago on v3 firmware also. I never figured out the cause or the fix. The recent update to Fw4 had fixed it, but its broken again…

Note… I am running rsync daemon on the drive, could that be it…hmmmmm im gonna try stopping that and see

i tried creating that symlink but same result.

Thanks

EDIT: Stopping Rsync daemoen didnt resolve the issue. Im glad it didnt because that would have made no sense !!!

in any case heres the full user.log. The log on both drives is the same, except for the REST API line

Mar 22 17:23:41 nas2 shutdown[7985]: shutting down for system reboot
Mar 22 17:25:59 nas2 S15mountDataVolume.sh: begin script: start
Mar 22 17:26:06 nas2 _: pkg: kernel-mindspeed-sequoia
Mar 22 17:26:07 nas2 _: pkg: wd-nas
Mar 22 17:26:07 nas2 [wd-nas.preinst] 03/22/15 21:26:07: test
Mar 22 17:26:09 nas2 [wd-nas.preinst] 03/22/15 21:26:09: test
Mar 22 17:26:09 nas2 [wd-nas.preinst] 03/22/15 21:26:09: done.
Mar 22 17:26:10 nas2 [wd-nas.postinst] 03/22/15 21:26:10: test context=test
Mar 22 17:26:10 nas2 [wd-nas.postinst] 03/22/15 21:26:10: done.
Mar 22 17:26:10 nas2 _: pkg: networking-general
Mar 22 17:26:10 nas2 _: pkg: wifi
Mar 22 17:26:11 nas2 _: pkg: apache-php-webdav
Mar 22 17:26:11 nas2 _: pkg: date-time
Mar 22 17:26:11 nas2 _: pkg: alerts
Mar 22 17:26:12 nas2 [alerts.preinst] 03/22/15 21:26:12: test
Mar 22 17:26:12 nas2 [alerts.preinst] 03/22/15 21:26:12: test()
Mar 22 17:26:12 nas2 [alerts.preinst] 03/22/15 21:26:12: done.
Mar 22 17:26:12 nas2 [alerts.postinst] 03/22/15 21:26:12: test context=test
Mar 22 17:26:12 nas2 [alerts.postinst] 03/22/15 21:26:12: PASSED: setup test for ///CacheVolume/.wd-alert
Mar 22 17:26:12 nas2 [alerts.postinst] 03/22/15 21:26:12: setup test for alerts: PASSED
Mar 22 17:26:12 nas2 [alerts.postinst] 03/22/15 21:26:12: done.
Mar 22 17:26:12 nas2 _: pkg: drive-lib
Mar 22 17:26:13 nas2 _: pkg: data-volume-config
Mar 22 17:26:13 nas2 _: pkg: upnp-nas
Mar 22 17:26:13 nas2 _: pkg: smb-file
Mar 22 17:26:14 nas2 _: pkg: dlna-server-twonky
Mar 22 17:26:14 nas2 _: pkg: itunes
Mar 22 17:26:14 nas2 _: pkg: admin-rest-api
Mar 22 17:26:14 nas2 _: pkg: nas-safepoint
Mar 22 17:26:15 nas2 _: pkg: ui
Mar 22 17:26:15 nas2 _: pkg: afp
Mar 22 17:26:15 nas2 _: pkg: ftp
Mar 22 17:26:17 nas2 S99wdInitFinalize: begin script: start
Mar 22 17:26:18 nas2 S99wdInitFinalize: currentRootDevice is set to /dev/md1
Mar 22 17:26:18 nas2 S99wdInitFinalize: currentRootDevice = /dev/md1
Mar 22 17:26:18 nas2 logger: hostname=nas2
Mar 22 17:26:18 nas2 S99wdInitFinalize: Running final checks… (version 04.01.03-421 on /dev/md1)
Mar 22 17:26:18 nas2 S99wdInitFinalize: #-------------------------------------------#
Mar 22 17:26:18 nas2 S99wdInitFinalize: System restart: current version is 04.01.03-421
Mar 22 17:26:18 nas2 S99wdInitFinalize: #-------------------------------------------#
Mar 22 17:26:18 nas2 S99wdInitFinalize: Rotate logs
Mar 22 17:26:19 nas2 _: run pkg bootup scripts:
Mar 22 17:26:19 nas2 [bootscript_001_networking-general] 03/22/15 21:26:19: ( boot-system ) begin
Mar 22 17:26:19 nas2 logger: hostname=nas2
Mar 22 17:26:19 nas2 [bootscript_001_networking-general] 03/22/15 21:26:19: done.
Mar 22 17:26:19 nas2 [bootscript_005_wd-nas] 03/22/15 21:26:19: ( boot-system ) begin
Mar 22 17:26:21 nas2 [bootscript_005_wd-nas] 03/22/15 21:26:21: done.
Mar 22 17:26:21 nas2 [bootscript_035_nas-safepoint] 03/22/15 21:26:21: ( boot-system ) begin
Mar 22 17:26:21 nas2 [bootscript_035_nas-safepoint] 03/22/15 21:26:21: done.
Mar 22 17:26:21 nas2 [bootscript_055_dlna-server-twonky] 03/22/15 21:26:21: ( boot-system ) begin
Mar 22 17:26:21 nas2 [bootscript_055_dlna-server-twonky] 03/22/15 21:26:21: done.
Mar 22 17:26:21 nas2 [bootscript_085_wd-lib] 03/22/15 21:26:21: ( boot-system ) begin
Mar 22 17:26:21 nas2 [bootscript_085_wd-lib] 03/22/15 21:26:21: pkg wd-lib () system boot…
Mar 22 17:26:21 nas2 [bootscript_085_wd-lib] 03/22/15 21:26:21: done
Mar 22 17:26:21 nas2 [bootscript_999_admin-rest-api] 03/22/15 21:26:21: ( boot-system ) begin
Mar 22 17:26:25 nas2 [bootscript_999_admin-rest-api] 03/22/15 21:26:25: done.
Mar 22 17:26:25 nas2 [bootscript_999_alerts] 03/22/15 21:26:25: ( boot-system ) begin
Mar 22 17:26:25 nas2 [bootscript_999_alerts] 03/22/15 21:26:25: system boot…
Mar 22 17:26:25 nas2 [bootscript_999_alerts] 03/22/15 21:26:25: done
Mar 22 17:26:33 nas2 logger: /usr/local/sbin/monitorio.sh: waiting for system to become ready…
Mar 22 17:26:38 nas2 logger: /usr/local/sbin/monitorio.sh: waiting for system to become ready…
Mar 22 17:26:42 nas2 logger: Starting Communication Manager
Mar 22 17:26:43 nas2 logger: /usr/local/sbin/monitorio.sh: waiting for system to become ready…
Mar 22 17:26:48 nas2 logger: /usr/local/sbin/monitorio.sh: waiting for system to become ready…
Mar 22 17:26:54 nas2 logger: /usr/local/sbin/monitorio.sh: waiting for system to become ready…
Mar 22 17:27:02 nas2 logger: /usr/local/sbin/monitorio.sh: waiting for system to become ready…
Mar 22 17:27:03 nas2 : System ready
Mar 22 17:27:06 nas2 logger: WD NAS: Email alerts REST API failed to return Success
Mar 22 17:27:06 nas2 : Check if new firmware is available
Mar 22 17:27:06 nas2 getNewFirmwareUpgrade.sh: begin script: immediate send_alert
Mar 22 17:27:06 nas2 getNewFirmwareUpgrade.sh: http://support.wdc.com/nas/list.asp?devtype=sq&devfw=04.01.03-421&devlang=eng&devsn=&auto=0
Mar 22 17:27:07 nas2 logger: Tally daemon not installed, exiting tally function

@alirz1,

Something then must have gone lady gaga haha. Try check below:

  1. Truncate the alert db (you should not see any errors or results):

    sqlite3 /CacheVolume/.wd-alert/wd-alert.db “delete from alerthistory”;

 2) Insert a new restart code (you should not see any errors results):

sqlite3 /CacheVolume/.wd-alert/wd-alert.db "INSERT INTO alerthistory (alert_code) VALUES (2001)";

 3) Clear the notification barrier so it will be recreated:

rm -f /CacheVolume/alert_notify_time;

 4) Trigger the API:

curl --data format=xml http://localhost/api/1.0/rest/alert_notify;

 If all goes well you should see below (of course your email too):

<?xml version="1.0" encoding="utf-8"?>
<alert_notify>
  <alert_notify_status>Success</alert_notify_status>
</alert_notify>

This is what i got after cleaning the db etc…

nas2:~# sqlite3 /CacheVolume/.wd-alert/wd-alert.db “delete from alerthistory”;
nas2:~# sqlite3 /CacheVolume/.wd-alert/wd-alert.db “INSERT INTO alerthistory (alert_code) VALUES (2001)”;
nas2:~# rm -f /CacheVolume/alert_notify_time;
nas2:~# curl --data format=xml http://localhost/api/1.0/rest/alert\_notify;

<?xml version="1.0" encoding="utf-8"?> 401 401 Request is not allowed nas2:~#

Your returned 401 was from the core api not the email api. Just curious, did you off your remote access?

Just to check:

cat this file (don’t share them here): /var/www/rest-api/config/dynamicconfig.ini

then compare with: /tmp/dynamicconfig.ini

They are usually the same copy. Try make sure it has REMOTEACCESS=“TRUE”.

Then reran the alert commands from my previous post.

Else if you want me to check, open your port 22, pm me your ip and temporary pass.

1 Like

I also forgot to mentioned to restart your apache2 after creating the symlink.

WOW you hit the nail right on the head! Yes i do keep remote access OFF on that drive on purpose.

So to test, i enabled remote access ( just turned it on didnt link any account or anything). Rebooted the drive and BOOM i got the email alert. I find it odd that disabling remote access breaks email alerts…

Anyways now i know the cause of this, thanks to you :slight_smile:

Glad it helps. Yeah weird, it checks for both remote access is on and localhost ip is 127.0.0.1 from the remote addr accessing the api. The localhost is acceptable for security but what happens when the drive overheats while remote access is off? Just watch out for the red leds :angry: