Page 1 of 2

Mail Notification problem

Posted: Mon May 27, 2019 5:01 am
by orani
I have the following configuration

Code: Select all

define host{
        host_name       PorApp1
        address         10.0.2.11
        contacts        nagiosadmin,systemadmin
        check_command check-host-alive
        max_check_attempts      5
        check_interval          1
        retry_interval          1
        parents SMCSW
        check_period            24x7
        hostgroups KDS PHYSICAL SERVERS, KDS Linux Servers
        statusmap_image rack-server.gd2
        notification_interval   0
        notification_options    d,u,r,s
        notification_period     24x7
}



define host{
        host_name       PorApp2
        address         10.0.2.12
        contacts        nagiosadmin,systemadmin
        check_command check-host-alive
        max_check_attempts      5
        check_interval          1
        retry_interval          1
        parents SMCSW
        check_period            24x7
        hostgroups KDS PHYSICAL SERVERS, KDS Linux Servers
        statusmap_image rack-server.gd2
        notification_interval   0
        notification_options    d,u,r,s
        notification_period     24x7
}



define service{
        host_name               PorApp1,PorApp2
        service_description     Memory Use
        check_command           check_nrpe!check_mem
        max_check_attempts      5
        check_interval          1
        retry_interval          1
        check_period            24x7
        servicegroups           Memory Use
#        notification_interval   0
#        notification_options    w,u,c,r,s
}
when memory hits warning or critical status i still getting notified via email even if i commented the notification command at the service check.

Why this happens?

Re: Mail Notification problem

Posted: Mon May 27, 2019 1:20 pm
by dwhitfield
Is there perhaps another service also checking memory?

What version of Core is this? If memory serves, there are some different notification options in different versions.

Re: Mail Notification problem

Posted: Tue May 28, 2019 1:10 am
by orani
No the configuration i posted is the only service check for memory for this host. I am running Nagios Core Version 4.4.1

Also at nagios.cfg i have the following statement

Code: Select all

...
# NOTIFICATIONS OPTION
# This determines whether or not Nagios will sent out any host or
# service notifications when it is initially (re)started.
# Values: 1 = enable notifications, 0 = disable notifications

enable_notifications=0
...

Re: Mail Notification problem

Posted: Tue May 28, 2019 12:15 pm
by scottwilkerson
To disable notification for a service you want to add this to the SERVICE config

Code: Select all

notifications_enabled    0
such as

Code: Select all

define service{
        host_name               PorApp1,PorApp2
        service_description     Memory Use
        check_command           check_nrpe!check_mem
        max_check_attempts      5
        check_interval          1
        retry_interval          1
        check_period            24x7
        servicegroups           Memory Use
        notifications_enabled    0
#        notification_interval   0
#        notification_options    w,u,c,r,s
}
By just commenting them out you are using default behavior which is to notify on everything

Re: Mail Notification problem

Posted: Wed May 29, 2019 7:26 am
by orani
Ok. That worked perfectly for me. But in nagios.cfg i had already disabled the global notification settings and still nagios was sent mails. Why was that happening?

Re: Mail Notification problem

Posted: Wed May 29, 2019 11:02 am
by scottwilkerson
orani wrote:Ok. That worked perfectly for me. But in nagios.cfg i had already disabled the global notification settings and still nagios was sent mails. Why was that happening?
there is also a runtime level that overrides the configuration.

If someone enabled then through the GUI it would override the config value
system -> Process Info -> Enable notifications (will show as "Disable notifications" if they are enabled)

Re: Mail Notification problem

Posted: Wed May 29, 2019 11:26 am
by orani
If you check my previous attachments you will see that i have disabled notifications on both the gui and the nagios.cfg, restarted the service but still receiving notifications.

Re: Mail Notification problem

Posted: Wed May 29, 2019 11:50 am
by scottwilkerson
Sorry, I missed seeing that image.

This is curious, can you see the notification in the notification report?
Do they show in the nagios.log?

Can you also post the following so we can make sure there aren't multiple nagios parent processes running

Code: Select all

ps -ef|grep nagios.cfg

Re: Mail Notification problem

Posted: Wed May 29, 2019 12:11 pm
by orani
notifications file is empty now.

Code: Select all

 #ps -ef|grep nagios.cfg
nagios    2858     1  2 May28 ?        00:46:23 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios    2868  2858  0 May28 ?        00:00:08 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
root     19640  6486  0 20:10 pts/0    00:00:00 grep nagios.cfg

Re: Mail Notification problem

Posted: Wed May 29, 2019 12:21 pm
by scottwilkerson
Hmm, that looks normal.

I know there were some notification bugs in 4.4.1 that are resolved in 4.4.3 but I wasn't aware of notifications being sent out when they were disabled.

Do these look like typical notifications from this server? Do you have more than one Nagios server?

Would a Nagios upgrade be possible?