Mail Notification problem

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.
orani
Posts: 169
Joined: Wed May 06, 2015 3:33 pm

Mail Notification problem

Post 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?
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Mail Notification problem

Post 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.
orani
Posts: 169
Joined: Wed May 06, 2015 3:33 pm

Re: Mail Notification problem

Post 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
...
Attachments
Screenshot_9.png
Screenshot_7.png
nagios.cfg
(45.77 KiB) Downloaded 371 times
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Mail Notification problem

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
orani
Posts: 169
Joined: Wed May 06, 2015 3:33 pm

Re: Mail Notification problem

Post 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?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Mail Notification problem

Post 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)
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
orani
Posts: 169
Joined: Wed May 06, 2015 3:33 pm

Re: Mail Notification problem

Post 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.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Mail Notification problem

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
orani
Posts: 169
Joined: Wed May 06, 2015 3:33 pm

Re: Mail Notification problem

Post 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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Mail Notification problem

Post 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?
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked