Not send e-mail notification

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
RockerMan
Posts: 70
Joined: Fri Nov 01, 2013 12:16 am

Not send e-mail notification

Post by RockerMan »

Hi

NagiosXI server not send e-mail notification of warning & critical events occurred. In mail logs written that everything is OK.

Code: Select all

Mar 15 13:35:30 nagiosxi postfix/pickup[8972]: BECC9120040: uid=501 from=<nagios>
Mar 15 13:35:30 nagiosxi postfix/cleanup[7024]: BECC9120040: message-id=<[email protected]>
Mar 15 13:35:30 nagiosxi postfix/qmgr[1440]: BECC9120040: from=<[email protected]>, size=848, nrcpt=1 (queue active)
Mar 15 13:35:30 nagiosxi postfix/pickup[8972]: C05A0120036: uid=501 from=<nagios>
Mar 15 13:35:30 nagiosxi postfix/cleanup[7027]: C05A0120036: message-id=<[email protected]>
Mar 15 13:35:30 nagiosxi postfix/pickup[8972]: C0FBC120038: uid=501 from=<nagios>
Mar 15 13:35:30 nagiosxi postfix/qmgr[1440]: C05A0120036: from=<[email protected]>, size=854, nrcpt=1 (queue active)
Mar 15 13:35:30 nagiosxi postfix/cleanup[7024]: C0FBC120038: message-id=<[email protected]>
Mar 15 13:35:30 nagiosxi postfix/qmgr[1440]: C0FBC120038: from=<[email protected]>, size=847, nrcpt=1 (queue active)
Mar 15 13:35:30 nagiosxi postfix/pickup[8972]: C264C12003A: uid=501 from=<nagios>
Mar 15 13:35:30 nagiosxi postfix/cleanup[7027]: C264C12003A: message-id=<[email protected]>
Mar 15 13:35:30 nagiosxi postfix/qmgr[1440]: C264C12003A: from=<[email protected]>, size=840, nrcpt=1 (queue active)
Mar 15 13:35:30 nagiosxi postfix/pickup[8972]: C30FD12003B: uid=501 from=<nagios>
Mar 15 13:35:30 nagiosxi postfix/cleanup[7024]: C30FD12003B: message-id=<[email protected]>
Mar 15 13:35:30 nagiosxi postfix/qmgr[1440]: C30FD12003B: from=<[email protected]>, size=837, nrcpt=1 (queue active)
Mar 15 13:35:30 nagiosxi postfix/smtp[7028]: BECC9120040: to=<[email protected]>, relay=mail-relay.my.domain[10.10.***.***]:25, delay=0.13, delays=0.03/0/0/0.09, dsn=2.6.0, status=sent (250 2.6.0 <20160315103530.BECC912004
Mar 15 13:35:30 nagiosxi postfix/qmgr[1440]: BECC9120040: removed
Mar 15 13:35:30 nagiosxi postfix/smtp[7031]: C05A0120036: to=<[email protected]>, relay=mail-relay.my.domain[10.10.***.***]:25, delay=0.12, delays=0.03/0/0/0.09, dsn=2.6.0, status=sent (250 2.6.0 <20160315103530.C05A
Mar 15 13:35:30 nagiosxi postfix/qmgr[1440]: C05A0120036: removed
Mar 15 13:35:30 nagiosxi postfix/smtp[7029]: C0FBC120038: to=<[email protected]>, relay=mail-relay.my.domain[10.10.***.***]:25, delay=0.12, delays=0.03/0/0.01/0.08, dsn=2.6.0, status=sent (250 2.6.0 <20160315103530.C0FBC120
Mar 15 13:35:30 nagiosxi postfix/qmgr[1440]: C0FBC120038: removed
Mar 15 13:35:30 nagiosxi postfix/smtp[7030]: C264C12003A: to=<[email protected]>, relay=mail-relay.my.domain[10.10.***.***]:25, delay=0.12, delays=0.04/0/0.01/0.07, dsn=2.6.0, status=sent (250 2.6.0 <20160315103530.C264C12003A@nag
Mar 15 13:35:30 nagiosxi postfix/qmgr[1440]: C264C12003A: removed
Mar 15 13:35:30 nagiosxi postfix/smtp[7032]: C30FD12003B: to=<[email protected]>, relay=mail-relay.my.domain[10.10.***.***]:25, delay=0.12, delays=0.04/0/0.01/0.07, dsn=2.6.0, status=sent (250 2.6.0 <20160315103530.C30FD12003B@nagios
Mar 15 13:35:30 nagiosxi postfix/qmgr[1440]: C30FD12003B: removed
but in the logs NagiosXI of error messages for each user (user1-user4)

Code: Select all

Mar 15 13:40:34 nagiosxi nagios: wproc: NOTIFY job 989 from worker Core Worker 20599 is a non-check helper but exited with return code 1
Mar 15 13:40:34 nagiosxi nagios: wproc:   host=Ibc2b1; service=Memory Usage; contact=user1
Mar 15 13:40:34 nagiosxi nagios: wproc:   early_timeout=0; exited_ok=1; wait_status=256; error_code=0;
Mar 15 13:40:34 nagiosxi nagios: wproc:   stderr line 01: /bin/sh: -c: line 0: syntax error near unexpected token `('
Mar 15 13:40:34 nagiosxi nagios: wproc:   stderr line 02: /bin/sh: -c: line 0: `/usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: PROBLEM\n\nService: --service="Memory Usage"\nHost: Ibc2b1\nAddress:
10.10.****.**\nState: --servicestate=WARNING\n\nDate/Time: Tue Mar 15 13:40:34 MSK 2016\n\nAdditional Info:\n\n --serviceoutput="Physical memory: 91%used(7178MB/7873MB) (90%) : WARNING"" | /bin/mail -s "** PROBLEM Service Alert: I
bc2b1/Memory Usage is WARNING **" [email protected]'
used command from wizard

Code: Select all

check_xi_service_snmp_linux_storage
command view

Code: Select all

$USER1$/check_snmp_storage_wizard.pl -H $HOSTADDRESS$ $ARG1$
$ARG1$

Code: Select all

 -C mypublic --v2c -m Physical -w 90 -c 95 -f
result, administrators do not receive e-mail notifications

Help me pls solve the problem

Best Regards
-
Valery

PS. NagiosXI license
-
License Type: Host-Based
Number of Licensed Hosts: Unlimited
Current Hosts: ****
Maintenance Status: Current (Expires in 300 days on 2017-01-09)
License Activation
Activation Status: Activated
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Not send e-mail notification

Post by hsmith »

Can you check your mail logs on the mail server to make sure these are not getting filtered? You may want to switch to using SMTP inside of XI to test.
Former Nagios Employee.
me.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Not send e-mail notification

Post by rkennedy »

Code: Select all

Mar 15 13:40:34 nagiosxi nagios: wproc:   stderr line 01: /bin/sh: -c: line 0: syntax error near unexpected token `('
Mar 15 13:40:34 nagiosxi nagios: wproc:   stderr line 02: /bin/sh: -c: line 0: `/usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: PROBLEM\n\nService: --service="Memory Usage"\nHost: Ibc2b1\nAddress:
10.10.****.**\nState: --servicestate=WARNING\n\nDate/Time: Tue Mar 15 13:40:34 MSK 2016\n\nAdditional Info:\n\n --serviceoutput="Physical memory: 91%used(7178MB/7873MB) (90%) : WARNING"" | /bin/mail -s "** PROBLEM Service Alert: I
bc2b1/Memory Usage is WARNING **" [email protected]'
Can you also post the definitions for the notification handlers that you're using as well?
Former Nagios Employee
RockerMan
Posts: 70
Joined: Fri Nov 01, 2013 12:16 am

Re: Not send e-mail notification

Post by RockerMan »

hsmith wrote:Can you check your mail logs on the mail server to make sure these are not getting filtered? You may want to switch to using SMTP inside of XI to test.
mail is not filtering, because mail exchange is in LAN network
some hosts send mail, some host not send mail.
RockerMan
Posts: 70
Joined: Fri Nov 01, 2013 12:16 am

Re: Not send e-mail notification

Post by RockerMan »

rkennedy wrote:

Code: Select all

Mar 15 13:40:34 nagiosxi nagios: wproc:   stderr line 01: /bin/sh: -c: line 0: syntax error near unexpected token `('
Mar 15 13:40:34 nagiosxi nagios: wproc:   stderr line 02: /bin/sh: -c: line 0: `/usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: PROBLEM\n\nService: --service="Memory Usage"\nHost: Ibc2b1\nAddress:
10.10.****.**\nState: --servicestate=WARNING\n\nDate/Time: Tue Mar 15 13:40:34 MSK 2016\n\nAdditional Info:\n\n --serviceoutput="Physical memory: 91%used(7178MB/7873MB) (90%) : WARNING"" | /bin/mail -s "** PROBLEM Service Alert: I
bc2b1/Memory Usage is WARNING **" [email protected]'
Can you also post the definitions for the notification handlers that you're using as well?
yes
Command Name

Code: Select all

notify-service-by-email
Command Line

Code: Select all

/usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: --service="$SERVICEDESC$"\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: --servicestate=$SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n --serviceoutput="$SERVICEOUTPUT$"" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
RockerMan
Posts: 70
Joined: Fri Nov 01, 2013 12:16 am

Re: Not send e-mail notification

Post by RockerMan »

SMS notification comes on, monitoring in NagiosXI shows that it is not the server's okay, mail logs in writing that the notification sent - but admins not receive mail.

PS
mail from CLI the server to the same admins address is sent ok.
RockerMan
Posts: 70
Joined: Fri Nov 01, 2013 12:16 am

Re: Not send e-mail notification

Post by RockerMan »

I create manually two alerts: CPU Usage and Memory Usage. CPU Usage - mail sent, Memory Usage - not sent. The server is the same, the wizard was used alone.

Code: Select all

Mar 16 17:57:51 nagiosxi nagios: SERVICE ALERT: Ibc2b1;CPU Usage;WARNING;HARD;1;2 CPU, average load 2.5% > 1% : WARNING
Mar 16 17:57:51 nagiosxi nagios: SERVICE NOTIFICATION: user1;Ibc2b1;CPU Usage;WARNING;notify-service-by-email;2 CPU, average load 2.5% > 1% : WARNING
Mar 16 17:57:51 nagiosxi nagios: SERVICE NOTIFICATION: user2;Ibc2b1;CPU Usage;WARNING;notify-service-by-email;2 CPU, average load 2.5% > 1% : WARNING
Mar 16 17:57:51 nagiosxi nagios: SERVICE NOTIFICATION: user3;Ibc2b1;CPU Usage;WARNING;notify-service-by-email;2 CPU, average load 2.5% > 1% : WARNING
Mar 16 17:57:51 nagiosxi nagios: SERVICE NOTIFICATION: user4;Ibc2b1;CPU Usage;WARNING;notify-service-by-email;2 CPU, average load 2.5% > 1% : WARNING
Mar 16 17:59:53 nagiosxi nagios: SERVICE ALERT: Ibc2b1;Memory Usage;WARNING;HARD;1;Physical memory: 34%used(2703MB/7873MB) (>30%) : WARNING
Mar 16 17:59:53 nagiosxi nagios: SERVICE NOTIFICATION: user1;Ibc2b1;Memory Usage;WARNING;notify-service-by-email;Physical memory: 34%used(2703MB/7873MB) (>30%) : WARNING
Mar 16 17:59:53 nagiosxi nagios: SERVICE NOTIFICATION: user2;Ibc2b1;Memory Usage;WARNING;notify-service-by-email;Physical memory: 34%used(2703MB/7873MB) (>30%) : WARNING
Mar 16 17:59:53 nagiosxi nagios: SERVICE NOTIFICATION: user3;Ibc2b1;Memory Usage;WARNING;notify-service-by-email;Physical memory: 34%used(2703MB/7873MB) (>30%) : WARNING
Mar 16 17:59:53 nagiosxi nagios: SERVICE NOTIFICATION: user4;Ibc2b1;Memory Usage;WARNING;notify-service-by-email;Physical memory: 34%used(2703MB/7873MB) (>30%) : WARNING
Mar 16 17:59:53 nagiosxi nagios: wproc:   host=Ibc2b1; service=Memory Usage; contact=user1
Mar 16 17:59:53 nagiosxi nagios: wproc:   stderr line 02: /bin/sh: -c: line 0: `/usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: PROBLEM\n\nService: --service="Memory Usage"\nHost: Ibc2b1\nAddress:
10.10.***.**\nState: --servicestate=WARNING\n\nDate/Time: Wed Mar 16 17:59:53 MSK 2016\n\nAdditional Info:\n\n --serviceoutput="Physical memory: 34%used(2703MB/7873MB) (30%) : WARNING"" | /bin/mail -s "** PROBLEM Service Alert: Ibc2b1/Memory Usage is WARNING **" [email protected]'
Mar 16 17:59:53 nagiosxi nagios: wproc:   host=Ibc2b1; service=Memory Usage; contact=user4
Mar 16 17:59:53 nagiosxi nagios: wproc:   stderr line 02: /bin/sh: -c: line 0: `/usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: PROBLEM\n\nService: --service="Memory Usage"\nHost: Ibc2b1\nAddress:
10.10.***.**\nState: --servicestate=WARNING\n\nDate/Time: Wed Mar 16 17:59:53 MSK 2016\n\nAdditional Info:\n\n --serviceoutput="Physical memory: 34%used(2703MB/7873MB) (30%) : WARNING"" | /bin/mail -s "** PROBLEM Service Alert: Ibc2b1/Memory Usage is WARNING **" [email protected]'
Mar 16 17:59:53 nagiosxi nagios: wproc:   host=Ibc2b1; service=Memory Usage; contact=user2
Mar 16 17:59:53 nagiosxi nagios: wproc:   stderr line 02: /bin/sh: -c: line 0: `/usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: PROBLEM\n\nService: --service="Memory Usage"\nHost: Ibc2b1\nAddress:
10.10.***.**\nState: --servicestate=WARNING\n\nDate/Time: Wed Mar 16 17:59:53 MSK 2016\n\nAdditional Info:\n\n --serviceoutput="Physical memory: 34%used(2703MB/7873MB) (30%) : WARNING"" | /bin/mail -s "** PROBLEM Service Alert: Ibc2b1/Memory Usage is WARNING **" [email protected]'
Mar 16 17:59:53 nagiosxi nagios: wproc:   host=Ibc2b1; service=Memory Usage; contact=user3
Mar 16 17:59:53 nagiosxi nagios: wproc:   stderr line 02: /bin/sh: -c: line 0: `/usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: PROBLEM\n\nService: --service="Memory Usage"\nHost: Ibc2b1\nAddress:
10.10.***.**\nState: --servicestate=WARNING\n\nDate/Time: Wed Mar 16 17:59:53 MSK 2016\n\nAdditional Info:\n\n --serviceoutput="Physical memory: 34%used(2703MB/7873MB) (30%) : WARNING"" | /bin/mail -s "** PROBLEM Service Alert: Ibc2b1/Memory Usage is WARNING **" [email protected]'
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Not send e-mail notification

Post by hsmith »

When you say you're able to send from the command line, is this the command that you are using?

Code: Select all

/usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: --service="$SERVICEDESC$"\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: --servicestate=$SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n --serviceoutput="$SERVICEOUTPUT$"" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
Former Nagios Employee.
me.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Not send e-mail notification

Post by rkennedy »

I believe there is an error in your formatting, specifically this part serviceoutput="$SERVICEOUTPUT$"" (too many ""), and this part --service="$SERVICEDESC$" -

Try using single ' or no " at all and let us know the result. Keep in mind you'll need the " after the printf, and " before printf closes out at |

Here's a standard notify-service-by-email -

Code: Select all

# 'notify-service-by-email' command definition
define command{
        command_name    notify-service-by-email
        command_line    /usr/bin/printf "%b" "***** 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" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
        }

Try using single ' or no " at all and let us know the result.
Former Nagios Employee
RockerMan
Posts: 70
Joined: Fri Nov 01, 2013 12:16 am

Re: Not send e-mail notification

Post by RockerMan »

hsmith wrote:When you say you're able to send from the command line, is this the command that you are using?

Code: Select all

/usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: --service="$SERVICEDESC$"\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: --servicestate=$SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n --serviceoutput="$SERVICEOUTPUT$"" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
No, i sent a short message to the e-mail address admins through the console. I did not think, unfortunately, to duplicate this command (above) the console.
Now everything is in order and running, thanks to the help of rkennedy
Locked