Notifications

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Notifications

Post by jdalrymple »

A key component making the alerts happen must be missing.

Can you show us your definitions for both the admins contactgroup and also the contact admin?
NagiosRoss
Posts: 21
Joined: Sat Feb 28, 2015 10:11 am

Re: Notifications

Post by NagiosRoss »

jdalrymple wrote:A key component making the alerts happen must be missing.

Can you show us your definitions for both the admins contactgroup and also the contact admin?

Code: Select all

###############################################################################
# CONTACTS.CFG - SAMPLE CONTACT/CONTACTGROUP DEFINITIONS
#
#
# NOTES: This config file provides you with some example contact and contact
#        group definitions that you can reference in host and service
#        definitions.
#       
#        You don't need to keep these definitions in a separate file from your
#        other object definitions.  This has been done just to make things
#        easier to understand.
#
###############################################################################



###############################################################################
###############################################################################
#
# CONTACTS
#
###############################################################################
###############################################################################

# Just one contact defined by default - the Nagios admin (that's you)
# This contact definition inherits a lot of default values from the 'generic-contact' 
# template which is defined elsewhere.

define contact{
        contact_name                    nagiosadmin		; Short name of user
	use				generic-contact		; Inherit default values from generic-contact template (defined above)
        alias                           Ross		; Full name of user
	host_notifications_enabled      1
        service_notifications_enabled   1
        service_notification_period     24x7
        host_notification_period        24x7
        service_notification_options    w,u,c,r,f,s,n
        host_notification_options       d,u,f
	service_notification_commands   notify-service-by-email ; send service notifications via email
        host_notification_commands      notify-host-by-email    ; send host notifications via email
        register			1							
        email                           *********@outlook.com	; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
        }



###############################################################################
###############################################################################
#
# CONTACT GROUPS
#
###############################################################################
###############################################################################

# We only have one contact in this simple configuration file, so there is
# no need to create more than one contact group.

define contactgroup{
        contactgroup_name       admins
        alias                   Nagios Administrators
        members                 nagiosadmin
        }
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Notifications

Post by jdalrymple »

More of the same - this looks mostly like the default and mostly like it should work.

2 more things:

1) post the output of:

Code: Select all

/usr/local/nagios/bin/nagios -v -v /usr/local/nagios/etc/nagios.cfg
Note - your paths may not be quite the same as mine. If you need help finding the proper paths let us know.

2) If possible, can you tar up all of the cfg files listed in the output of #1 - remove or obfuscate any senstive data - PM those configs and I'll load your config into a test environment here. If you prefer not to do that no worries - I was just trying to save you the hassle of continuing to send configuration components. Continuing to trace backwards we need to see the timeperiod for 24x7 and the generic-contacts template.

I guess also - before we go too crazy, can you show us an expanded view of your notifications window? The first time you sent it you cropped off just 2 of the custom notifications, right now it's still unclear to me if ALL the notifications are custom notifications.
NagiosRoss
Posts: 21
Joined: Sat Feb 28, 2015 10:11 am

Re: Notifications

Post by NagiosRoss »

Code: Select all

Running pre-flight check on configuration data...

Checking objects...
        Checked 10 services.
        Checked 3 hosts.
        Checked 2 host groups.
        Checked 0 service groups.
        Checked 1 contacts.
        Checked 1 contact groups.
        Checked 24 commands.
        Checked 5 time periods.
        Checked 0 host escalations.
        Checked 0 service escalations.
Checking for circular paths...
        Checked 3 hosts
        Checked 0 service dependencies
        Checked 0 host dependencies
        Checked 5 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 0
Total Errors:   0

Things look okay - No serious problems were detected during the pre-flight check
I'm sending you a PM with the CFG files in now.

And I cropped it to only those notifications as they are the only ones that it was showing.

Here is the event log if that helps at all?
Capture5.png
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Notifications

Post by jdalrymple »

Can you try to run the following from the commandline of your nagios server logged on as nagios and share with us the output, as well as maybe the last 20 or so lines of /var/log/maillog. Make sure to obfuscate private data from that log file.

Code: Select all

/usr/bin/printf "This is a test E-mail" | /usr/bin/mail -s "Test Subject" youremailaddress@outlook.com
modify the E-mail address to match yours.
NagiosRoss
Posts: 21
Joined: Sat Feb 28, 2015 10:11 am

Re: Notifications

Post by NagiosRoss »

jdalrymple wrote:Can you try to run the following from the commandline of your nagios server logged on as nagios and share with us the output, as well as maybe the last 20 or so lines of /var/log/maillog. Make sure to obfuscate private data from that log file.

Code: Select all

/usr/bin/printf "This is a test E-mail" | /usr/bin/mail -s "Test Subject" youremailaddress@outlook.com
modify the E-mail address to match yours.
This is the output from that command.
send-mail: Cannot open mailhub:25
Mar 2 00:31:09 ubuntuserver1404 sSMTP[19320]: Creating SSL connection to host
Mar 2 00:31:10 ubuntuserver1404 sSMTP[19320]: SSL connection using RSA_AES_256_CBC_SHA1
Mar 2 00:31:15 ubuntuserver1404 sSMTP[19320]: Sent mail for nagios@outlook.com (221 2.0.0 BLU436-SMTP158.smtp.hotmail.com Service closing transmission channel) uid=999 username=nagios outbytes=745
Mar 2 01:02:11 ubuntuserver1404 sSMTP[20100]: Creating SSL connection to host
Mar 2 01:02:12 ubuntuserver1404 sSMTP[20100]: SSL connection using RSA_AES_256_CBC_SHA1
Mar 2 01:02:17 ubuntuserver1404 sSMTP[20100]: Sent mail for nagios@outlook.com (221 2.0.0 BLU436-SMTP233.smtp.hotmail.com Service closing transmission channel) uid=999 username=nagios outbytes=811
Mar 2 01:10:30 ubuntuserver1404 sSMTP[20521]: Creating SSL connection to host
Mar 2 01:10:30 ubuntuserver1404 sSMTP[20521]: SSL connection using RSA_AES_256_CBC_SHA1
Mar 2 01:10:35 ubuntuserver1404 sSMTP[20521]: Sent mail for nagios@outlook.com (221 2.0.0 BLU436-SMTP87.smtp.hotmail.com Service closing transmission channel) uid=999 username=nagios outbytes=830
Mar 2 21:15:45 ubuntuserver1404 sSMTP[3115]: Creating SSL connection to host
Mar 2 21:15:46 ubuntuserver1404 sSMTP[3115]: SSL connection using RSA_AES_256_CBC_SHA1
Mar 2 21:15:51 ubuntuserver1404 sSMTP[3115]: Sent mail for nagios@outlook.com (221 2.0.0 BLU436-SMTP49.smtp.hotmail.com Service closing transmission channel) uid=999 username=nagios outbytes=830
Mar 3 19:59:35 ubuntuserver1404 sSMTP[3073]: /etc/ssmtp/ssmtp.conf not found
Mar 3 20:01:42 ubuntuserver1404 sSMTP[3073]: Unable to connect to "mailhub" port 25.
Mar 3 20:01:42 ubuntuserver1404 sSMTP[3073]: Cannot open mailhub:25
Mar 4 19:01:38 ubuntuserver1404 sSMTP[1914]: /etc/ssmtp/ssmtp.conf not found
Mar 4 19:03:45 ubuntuserver1404 sSMTP[1914]: Unable to connect to "mailhub" port 25.
Mar 4 19:03:45 ubuntuserver1404 sSMTP[1914]: Cannot open mailhub:25
This is mail.log.

The last three lines don't make any sense as I've just opened ssmtp.conf in nano and it's definitely there, and I haven't changed anything to do with SSMTP since the 2nd of March when I was able to send emails through forcing Nagios?

Sent mail for nagios@outlook.com could be interesting though..?
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Notifications

Post by jdalrymple »

Ubuntu doesn't come with a builtin sendmail or sendmail like package, instead it tries to mail using a forwarder called SSMTP. I suggest reviewing your configuration per this URL:

https://wiki.archlinux.org/index.php/SSMTP

Ultimately that command you tried must succeed, otherwise notifications will never work.
NagiosRoss
Posts: 21
Joined: Sat Feb 28, 2015 10:11 am

Re: Notifications

Post by NagiosRoss »

jdalrymple wrote:Ubuntu doesn't come with a builtin sendmail or sendmail like package, instead it tries to mail using a forwarder called SSMTP. I suggest reviewing your configuration per this URL:

https://wiki.archlinux.org/index.php/SSMTP

Ultimately that command you tried must succeed, otherwise notifications will never work.
Ok, I've added 'ross' and 'nagios' users and I receive email with the

Code: Select all

/usr/bin/printf "This is a test E-mail" | /usr/bin/mail -s "Test Subject" youremailaddress@outlook.com
command.

But still... No notification.
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Notifications

Post by jdalrymple »

Please post the output of

Code: Select all

grep NOTI /var/log/nagios/nagios.log
Your path might not be quite the same as mine, you can get the full path from the top of the notifications page. Nothing in that output *should* need to be obfuscated, however review and double-check it please before posting it publicly.
NagiosRoss
Posts: 21
Joined: Sat Feb 28, 2015 10:11 am

Re: Notifications

Post by NagiosRoss »

jdalrymple wrote:Please post the output of

Code: Select all

grep NOTI /var/log/nagios/nagios.log
Your path might not be quite the same as mine, you can get the full path from the top of the notifications page. Nothing in that output *should* need to be obfuscated, however review and double-check it please before posting it publicly.

Code: Select all

[1425256269] EXTERNAL COMMAND: SEND_CUSTOM_HOST_NOTIFICATION;NetGearWN2500RP;2;****;Testing.
[1425256269] HOST NOTIFICATION: nagiosadmin;NetGearWN2500RP;CUSTOM (UP);notify-host-by-email;PING OK - Packet loss = 0%, RTA = 7.88 ms;****;Testing.
[1425258103] EXTERNAL COMMAND: ENABLE_HOSTGROUP_SVC_NOTIFICATIONS;linux-servers
[1425258103] EXTERNAL COMMAND: ENABLE_HOSTGROUP_HOST_NOTIFICATIONS;linux-servers
[1425258131] EXTERNAL COMMAND: SEND_CUSTOM_SVC_NOTIFICATION;localhost;SSH;2;****;Test.
[1425258131] SERVICE NOTIFICATION: nagiosadmin;localhost;SSH;CUSTOM (OK);notify-service-by-email;SSH OK - OpenSSH_6.6.1p1 Ubuntu-2ubuntu2 (protocol 2.0);****;Test.
[1425258180] EXTERNAL COMMAND: ENABLE_HOSTGROUP_HOST_NOTIFICATIONS;linux-servers
[1425258305] EXTERNAL COMMAND: ENABLE_HOSTGROUP_HOST_NOTIFICATIONS;linux-servers
[1425258312] EXTERNAL COMMAND: ENABLE_HOSTGROUP_SVC_NOTIFICATIONS;linux-servers
[1425258312] EXTERNAL COMMAND: ENABLE_HOSTGROUP_HOST_NOTIFICATIONS;linux-servers
[1425258630] EXTERNAL COMMAND: SEND_CUSTOM_SVC_NOTIFICATION;localhost;SSH;0;****;Test
[1425258630] SERVICE NOTIFICATION: nagiosadmin;localhost;SSH;CUSTOM (CRITICAL);notify-service-by-email;connect to address 127.0.0.1 and port 22: Connection refused;****;Test
[1425258765] EXTERNAL COMMAND: ENABLE_HOST_SVC_NOTIFICATIONS;localhost
[1425258765] EXTERNAL COMMAND: ENABLE_HOST_NOTIFICATIONS;localhost
[1425206816] EXTERNAL COMMAND: ENABLE_HOST_SVC_NOTIFICATIONS;localhost
[1425206816] EXTERNAL COMMAND: ENABLE_HOST_NOTIFICATIONS;localhost
[1425330945] EXTERNAL COMMAND: SEND_CUSTOM_SVC_NOTIFICATION;localhost;SSH;2;****;Testing.
[1425330945] SERVICE NOTIFICATION: nagiosadmin;localhost;SSH;CUSTOM (CRITICAL);notify-service-by-email;connect to address 127.0.0.1 and port 22: Connection refused;****;Testing.
[1425502518] EXTERNAL COMMAND: ENABLE_HOST_SVC_NOTIFICATIONS;localhost
[1425502518] EXTERNAL COMMAND: ENABLE_HOST_NOTIFICATIONS;localhost
Locked