Page 3 of 3

Re: Configuring email and SMS notifications.

Posted: Fri Feb 14, 2020 4:02 pm
by scottwilkerson
scottwilkerson wrote:Do you see nagios attempting to send notification of the Notification report in the UI?
??
dheerushops wrote:[root@nagiosserver ~]# echo "test message"/bin/mail -s "** TEST MESSAGE **" dhe*@gmail.com
test message/bin/mail -s ** TEST MESSAGE** dhe*@gmail.com
[root@nagiosserver ~]#
sorry, I was missing a |

Code: Select all

echo "test message"| /bin/mail -s "** TEST MESSAGE **" dhe*@gmail.com

Re: Configuring email and SMS notifications.

Posted: Mon Feb 17, 2020 8:20 am
by dheerushops
Please check below output.


[root@nagiosserver objects]# echo "test message"| /bin/mail -s "** TEST MESSAGE **" dhe*@gmail.com
[root@nagiosserver objects]# tail -f /var/log/messages
Feb 17 08:00:19 nagiosserver nagios: SERVICE NOTIFICATION: nagiosadmin;nagioshost;Total Processes;CRITICAL;notify-service-by-email;PROCS CRITICAL: 1799 processes
Feb 17 08:00:19 nagiosserver nagios: job 28181 (pid=9415): read() returned error 11
Feb 17 08:04:38 nagiosserver rsyslogd-2177: imuxsock begins to drop messages from pid 2094 due to rate-limiting
[root@nagiosserver objects]#

Re: Configuring email and SMS notifications.

Posted: Mon Feb 17, 2020 8:25 am
by scottwilkerson
Did you get the email?

What is the output of the following

Code: Select all

tail -40 /var/log/maillog
service postfix status

Re: Configuring email and SMS notifications.

Posted: Mon Feb 17, 2020 8:35 am
by dheerushops
I haven't received email.

[root@nagiosserver objects]# service postfix status
master (pid 2081) is running...
[root@nagiosserver objects]# tail -40 /var/log/maillog

Feb 17 08:19:49 nagiosserver sendmail[12090]: 01H8Jniv012090: from=root, size=219, class=0, nrcpts=1, msgid=<202002170819.01H8Jniv012090@nagiosserver>, relay=root@localhost
Feb 17 08:19:49 nagiosserver postfix/smtpd[11809]: connect from localhost[127.0.0.1]
Feb 17 08:19:49 nagiosserver postfix/smtpd[11809]: 9395328E2: client=localhost[127.0.0.1]
Feb 17 08:19:49 nagiosserver postfix/cleanup[11812]: 9395328E2: message-id=<202002170819.01H8Jniv012090@nagiosserver>
Feb 17 08:19:49 nagiosserver postfix/qmgr[2094]: 9395328E2: from=<root@nagiosserver.localdomain>, size=665, nrcpt=1 (queue active)
Feb 17 08:19:49 nagiosserver sendmail[12090]: 01H8Jniv012090: to=dheerushops@gmail.com, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30219, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (Ok: queued as 9395328E2)
Feb 17 08:19:49 nagiosserver postfix/error[11813]: 9395328E2: to=<dheerushops@gmail.com>, relay=none, delay=0.05, delays=0.04/0/0/0, dsn=4.3.5, status=deferred (delivery temporarily suspended: Host or domain name not found. Name service error for name=smtp.example.com type=AAAA: Host not found)
Feb 17 08:19:49 nagiosserver postfix/smtpd[11809]: disconnect from localhost[127.0.0.1]
Feb 17 08:20:26 nagiosserver sendmail[12146]: 01H8KQaC012146: from=nagios, size=490, class=0, nrcpts=1, msgid=<202002170820.01H8KQaC012146@nagiosserver>, relay=nagios@localhost
Feb 17 08:20:26 nagiosserver postfix/smtpd[11809]: connect from localhost[127.0.0.1]
Feb 17 08:20:26 nagiosserver postfix/smtpd[11809]: 6FC753A67: client=localhost[127.0.0.1]
Feb 17 08:20:26 nagiosserver postfix/cleanup[11812]: 6FC753A67: message-id=<202002170820.01H8KQaC012146@nagiosserver>
Feb 17 08:20:26 nagiosserver postfix/qmgr[2094]: 6FC753A67: from=<nagios@nagiosserver.localdomain>, size=946, nrcpt=1 (queue active)
Feb 17 08:20:26 nagiosserver sendmail[12146]: 01H8KQaC012146: to=dheerushops@gmail.com, ctladdr=nagios (532/537), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30490, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (Ok: queued as 6FC753A67)
Feb 17 08:20:26 nagiosserver postfix/error[12052]: 6FC753A67: to=<dheerushops@gmail.com>, relay=none, delay=0.05, delays=0.04/0/0/0, dsn=4.3.5, status=deferred (delivery temporarily suspended: Host or domain name not found. Name service error for name=smtp.example.com type=AAAA: Host not found)
Feb 17 08:20:26 nagiosserver postfix/smtpd[11809]: disconnect from localhost[127.0.0.1]
Feb 17 08:21:02 nagiosserver sendmail[12193]: 01H8L20V012193: from=root, size=219, class=0, nrcpts=1, msgid=<202002170821.01H8L20V012193@nagiosserver>, relay=root@localhost
Feb 17 08:21:02 nagiosserver postfix/smtpd[11809]: connect from localhost[127.0.0.1]
Feb 17 08:21:02 nagiosserver postfix/smtpd[11809]: C0B993A68: client=localhost[127.0.0.1]
Feb 17 08:21:02 nagiosserver postfix/cleanup[11812]: C0B993A68: message-id=<202002170821.01H8L20V012193@nagiosserver>
Feb 17 08:21:02 nagiosserver sendmail[12193]: 01H8L20V012193: to=dheerushops@gmail.com, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30219, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (Ok: queued as C0B993A68)
Feb 17 08:21:02 nagiosserver postfix/qmgr[2094]: C0B993A68: from=<root@nagiosserver.localdomain>, size=665, nrcpt=1 (queue active)
Feb 17 08:21:02 nagiosserver postfix/error[12059]: C0B993A68: to=<dheerushops@gmail.com>, relay=none, delay=0.05, delays=0.05/0/0/0, dsn=4.3.5, status=deferred (delivery temporarily suspended: Host or domain name not found. Name service error for name=smtp.example.com type=AAAA: Host not found)
Feb 17 08:21:02 nagiosserver postfix/smtpd[11809]: disconnect from localhost[127.0.0.1]
Feb 17 08:21:49 nagiosserver sendmail[12255]: 01H8Lnqi012255: from=root, size=219, class=0, nrcpts=1, msgid=<202002170821.01H8Lnqi012255@nagiosserver>, relay=root@localhost
Feb 17 08:21:49 nagiosserver postfix/smtpd[11809]: connect from localhost[127.0.0.1]
Feb 17 08:21:49 nagiosserver postfix/smtpd[11809]: 665923A69: client=localhost[127.0.0.1]
Feb 17 08:21:49 nagiosserver postfix/cleanup[11812]: 665923A69: message-id=<202002170821.01H8Lnqi012255@nagiosserver>
Feb 17 08:21:49 nagiosserver postfix/qmgr[2094]: 665923A69: from=<root@nagiosserver.localdomain>, size=665, nrcpt=1 (queue active)
Feb 17 08:21:49 nagiosserver sendmail[12255]: 01H8Lnqi012255: to=dheerushops@gmail.com, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30219, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (Ok: queued as 665923A69)
Feb 17 08:21:49 nagiosserver postfix/error[12052]: 665923A69: to=<dheerushops@gmail.com>, relay=none, delay=0.05, delays=0.04/0/0/0, dsn=4.3.5, status=deferred (delivery temporarily suspended: Host or domain name not found. Name service error for name=smtp.example.com type=AAAA: Host not found)
Feb 17 08:21:49 nagiosserver postfix/smtpd[11809]: disconnect from localhost[127.0.0.1]
[root@nagiosserver objects]#

Re: Configuring email and SMS notifications.

Posted: Mon Feb 17, 2020 9:47 am
by scottwilkerson

Code: Select all

Feb 17 08:19:49 nagiosserver postfix/error[11813]: 9395328E2: to=<dheerushops@gmail.com>, relay=none, delay=0.05, delays=0.04/0/0/0, dsn=4.3.5, status=deferred (delivery temporarily suspended: Host or domain name not found. Name service error for name=smtp.example.com type=AAAA: Host not found)
This looks like your postfix service on the server isn't setup correctly

Re: Configuring email and SMS notifications.

Posted: Mon Feb 17, 2020 10:46 am
by dheerushops
Can you please help to set postfix service.

Re: Configuring email and SMS notifications.

Posted: Mon Feb 17, 2020 10:51 am
by scottwilkerson
dheerushops wrote:Can you please help to set postfix service.
Sorry this is outside the scope of Nagios Core support.

There are many guides available depending on your OS available with some Googling

Nagios XI however comes with full SMTP support and automatic setup if you'd like to check that out
https://www.nagios.com/products/nagios-xi/

Re: Configuring email and SMS notifications.

Posted: Tue Feb 18, 2020 12:23 pm
by dheerushops
Can we use SMTP to get mails.

Re: Configuring email and SMS notifications.

Posted: Tue Feb 18, 2020 12:38 pm
by scottwilkerson
dheerushops wrote:Can we use SMTP to get mails.
Nagios Core doesn't have that built-in but Nagios XI does.

To do it in Nagios Core you would need to manually configure the MTA on the server to send through your SMTP server