Email Notificationis not Working

72 views
Skip to first unread message

jog...@googlemail.com

unread,
Jan 30, 2017, 12:26:41 PM1/30/17
to nagrestconf-users

Hi everyone great work on Synagios! I dont get email Notification working. First of all I’m no Linux Crack. Im on DSM 6.0.2-8451 Update 9 on my RS815+. I have installed 0.14.5. I have installed Syology Mail Server Package 1.6.1-0484 und Mail Station Package. I configured the Syology Mail Server with am SMTP Relay with the Checks on “Ignore LAN authentication” and “localhost” is my hostname Port is 25. In Mail Station I can connect to localhost port 25 and sent E-mails.

 

While installing Synagios I followed instructions put in an E-mail address an Checked everything twice.


This is my notify-host-by-email:

/usr/bin/printf "mail from: nagios@localhost\r\nrcpt to: %b\r\nDATA\r\nSubject: %b\nFrom: nagios@diskstation\nTo: %b\n\n%b\n.\n" "$CONTACTEMAIL$" "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" "$CONTACTEMAIL$" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\nAdditional Info:\n\n$HOSTOUTPUT$\n\n$NOTIFICATIONAUTHOR$\n\t$NOTIFICATIONCOMMENT$\n" | /usr/local/bin/mailsender 127.0.0.1 –


This is my notify-service-by-email


/usr/bin/printf "mail from: nagios@localhost\r\nrcpt to: %b\r\nDATA\r\nSubject: %b\nFrom: nagios@diskstation\nTo: %b\n\n%b\n.\n" "$CONTACTEMAIL$" "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" "$CONTACTEMAIL$" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n\n$NOTIFICATIONAUTHOR$\n\t$NOTIFICATIONCOMMENT$\n" | /usr/local/bin/mailsender 127.0.0.1 –


Still I don’t get e-mail notification working.


When typing this over SSH

chroot /volume1/@appstore/Synagios/nagios-chroot/ /bin/bash


I get

chroot: cannot change root directory to ‘/volume1/@appstore/Synagios/nagios-chroot/’: Operation not permitted



I think to determine the general functionality of the email notification I need to this try out on a command line level. But I don’t know how.

Mark Clarkson

unread,
Jan 31, 2017, 6:28:56 AM1/31/17
to nagrestc...@googlegroups.com
On Mon, 2017-01-30 at 09:26 -0800, jogun83 via nagrestconf-users wrote:

When typing this over SSH

chroot /volume1/@appstore/Synagios/nagios-chroot/ /bin/bash


I get

chroot: cannot change root directory to ‘/volume1/@appstore/Synagios/nagios-chroot/’: Operation not permitted


Hi! You are probably the 'admin' user and you need to be 'root'. Do:

sudo su

... and then you will be able to do the 'chroot' and debug properly. Cheers! Mark

Mark Clarkson

unread,
Jan 31, 2017, 10:43:09 AM1/31/17
to nagrestconf-users
Hi Again!

Someone else has reported problems. So please check the mailsender binary, do:

  sudo chroot /volume1/@appstore/Synagios/nagios-chroot/ /bin/bash

Then type

  mailsender

which should produce the output:

  mailsender <host | ipaddr> <file name>

Type 'exit'. If it worked, you got the above output, then continue debugging! :(

If the mailsender binary didn't work then compile a new mailsender from scratch with:

  sudo chroot /volume1/@appstore/Synagios/nagios-chroot/ /bin/bash

  cd


  gcc -static -o /usr/local/bin/mailsender mailsender.c

Don't worry about the warning! Then retry running mailsender as previously. This time it should work.

jog...@googlemail.com

unread,
Jan 31, 2017, 10:59:27 AM1/31/17
to nagrestconf-users

Hey Thx for the quick reply
unfortunately It’s not going very far;

login as: admin
admin@nas's password:
admin@nas:~$ sudo -i
Password:


root@nas:~# sudo chroot /volume1/@appstore/Synagios/nagios-chroot/ /bin/bash
bash: warning: setlocale: LC_ALL: cannot change locale (en_US.utf8)


root@nas:/# chroot /volume1/@appstore/Synagios/nagios-chroot/ /bin/bash
chroot: cannot change root directory to /volume1/@appstore/Synagios/nagios-chroot/: No such file


Like I said I’m no Linux Pro :-(

Mark Clarkson

unread,
Jan 31, 2017, 11:09:10 AM1/31/17
to nagrestconf-users
Hey, no worries. I'm gonna try it out later and make sure the package is not broken, so you could hold tight and wait for me to test it out and make sure simple things aren't broken. You got the x86 package right?

You did it pretty much right anyway, just that it doesn't tell you that it's in the chroot. When it output 'bash: warning: setlocale: LC_ALL: cannot change locale (en_US.utf8)', you were in the chroot. type 'exit' to get out.

jog...@googlemail.com

unread,
Jan 31, 2017, 11:29:45 AM1/31/17
to nagrestconf-users
Yes, synagios_0.14.5_jessie_x86.spk. And I managed to get out of chroot.

Mark Clarkson

unread,
Jan 31, 2017, 4:19:05 PM1/31/17
to nagrestconf-users
On Tuesday, 31 January 2017 16:29:45 UTC, jogun83 wrote:
Yes, synagios_0.14.5_jessie_x86.spk. And I managed to get out of chroot.

It was not your fault. The mailsender binary in synagios_0.14.5_jessie_x86.spk is broken.
I need to repack it...

So sorry about that. Very annoying!

You can wait for a new package (I'm gonna try to do it tonight) or do the following (and not have to worry about configuring it all again):

ssh to your diskstation then:


  sudo chroot /volume1/@appstore/Synagios/nagios-chroot/ /bin/bash

  cd

  wget -O mailsender.c https://gist.github.com/mclarkson/200a3ce77a308f294947de0ee290c1f8/raw/

  apt-get update && apt-get -y install build-essential


  gcc -static -o /usr/local/bin/mailsender mailsender.c

  exit

Then the mailsender binary will work, and nagios should start sending emails. The above steps were tried by another user and it worked for them so should be good for you too.

Mark Clarkson

unread,
Jan 31, 2017, 5:32:41 PM1/31/17
to nagrestconf-users
On Tuesday, 31 January 2017 16:29:45 UTC, jog...@googlemail.com wrote:
Yes, synagios_0.14.5_jessie_x86.spk. And I managed to get out of chroot.

FYI: There's a new 0.14.6 x86 package on sourceforge. The only change is the mailsender binary.

jog...@googlemail.com

unread,
Feb 1, 2017, 5:46:46 AM2/1/17
to nagrestconf-users

Hey, Thx for the quick work. I think I go with the deinstallation and reinstallation of the new package.

Hope that fixes my issue.


I’ll get back to you with the result.

jog...@googlemail.com

unread,
Feb 1, 2017, 6:04:39 AM2/1/17
to nagrestconf-users

Hey Mark. I dared myself using the SSH commandos and it worked imediately !!!!!! Thx for that great package and the great support!!!

Mark Clarkson

unread,
Feb 1, 2017, 6:49:01 AM2/1/17
to nagrestconf-users
On Wednesday, 1 February 2017 11:04:39 UTC, jogun83 wrote:

Hey Mark. I dared myself using the SSH commandos and it worked imediately !!!!!! Thx for that great package and the great support!!!


That's great! You're welcome. Many thanks for reporting and sticking with it! :)

jog...@googlemail.com

unread,
Feb 4, 2017, 3:48:16 AM2/4/17
to nagrestconf-users

Hey Marc, everything is working fine in my Synagios. But after a while I figured out that the Nagios Timezone is wrong, since installation of mailsender
login as: admin

admin@nas's password:

admin@nas:~$ date

Sat Feb  4 09:40:45 CET 2017

admin@nas:~$ sudo -i

Password:

root@nas:~# sudo chroot /volume1/@appstore/Synagios/nagios-chroot/ /bin/bash

bash: warning: setlocale: LC_ALL: cannot change locale (en_US.utf8)

root@nas:/# date

Sat Feb  4 08:42:35 UTC 2017

How can I change from UTC to CET. Or better how to get the synology time zone working for the synagios installation?

Mark Clarkson

unread,
Feb 5, 2017, 2:06:11 PM2/5/17
to nagrestconf-users
On Saturday, 4 February 2017 08:48:16 UTC, jogun83 wrote:

How can I change from UTC to CET. Or better how to get the synology time zone working for the synagios installation?


Hi! Github issue #24 at https://github.com/mclarkson/nagrestconf/issues/24 has the information.

You will need to ssh in to the diskstation again, then:

sudo su
cd /volume1/@appstore/Synagios/nagios-chroot/ cp etc/localtime etc/localtime.orig cp usr/share/zoneinfo/CET etc/localtime
exit

I think that you won't need to restart anything, just refresh the web page.

Cheers!
Mark
 

jog...@googlemail.com

unread,
Feb 7, 2017, 1:50:42 PM2/7/17
to nagrestconf-users

Perferct! Worked imediately! Consider mentioning  this in the nagrestconf Documentation Topics.

Great Work. Greetings Jogun

Mark Clarkson

unread,
Feb 8, 2017, 5:01:26 AM2/8/17
to nagrestconf-users
On Tuesday, 7 February 2017 18:50:42 UTC, jogun83 wrote:

Perferct! Worked imediately! Consider mentioning  this in the nagrestconf Documentation Topics.

Great Work. Greetings Jogun


You're right! I need to take the time to gather info from this forum, github issues, blog comments, and web site comments to build an FAQ. I'm starting to repeat myself - and I've said this before :)
Reply all
Reply to author
Forward
0 new messages