27

How Can I stop the email notifications. I am setting up a new server and getting tons of notifications. Wants to disable them for time being.

Ramesh Kumar
  • 1,690
  • 5
  • 18
  • 29

6 Answers6

37

Click on "Process Info" in the left nav pane, and then "Disable Notifications", then "Commit".

EEAA
  • 108,414
  • 18
  • 172
  • 242
24

in nagios.cfg, set enable_notifications=0 and restart nagios

ray
  • 471
  • 3
  • 3
  • was looking for a way to disable all notifications temporarily while troubleshooting a new config, this did the trick, thanks! – Joey T Nov 05 '14 at 05:13
7

You can also do it at a contact level, by disabling notifications for your Nagios contact. E.g.:

define contact { 
    contact_name JohnDoe
    email johndoe@example.com
    host_notifications_enabled 0
    service_notifications_enabled 0
}

The other way to skin this cat is to use the host_notification_options and service_notification_options in the contact definition. Set them to n (none).

KJH
  • 372
  • 1
  • 14
3

You can also do this via NAGIOS's command_file named pipe, if you have that defined. The advantages of doing it this way are it's internal to NAGIOS, it can be programmed from at or cron rather than requiring interaction with a web browser, and it doesn't require changing any of the config files.

To disable notifications (on CentOS6 EPEL NAGIOS - other distributions may have the command_file configured elsewhere):

echo "[`date +%s`] DISABLE_NOTIFICATIONS" > /var/nagios/rw/nagios.cmd

and to re-enable it later:

echo "[`date +%s`] ENABLE_NOTIFICATIONS" > /var/nagios/rw/nagios.cmd
MadHatter
  • 78,442
  • 20
  • 178
  • 229
1

Set both:

  • service_notification_period &
  • host_notification_period

to never instead of 24x7

Senthil
  • 172
  • 1
  • 1
0

You can also stop your mail server (service postfix stop) on the Nagios server, if you are relaying through the mail server on localhost where Nagios is installed. Then you can do postsuper -d ALL to delete all mails sitting in mailq.

Senthil
  • 21
  • 1
  • 1
    You weren't to know this as a low-rep user, but that suggestion's already been made, downvoted, and deleted by its poster. To quote one of the mods on the other (identical) answer, "*Sorry, that's a horrible solution. From the perspective of your Nagios logs and host/service availability data, they're going to show that you had an outage and that notifications were sent out. That makes the data useless for historical troubleshooting/trending. While this may be an acceptable solution for you, it's not something you ought to be suggesting is the "right" answer for a professional environment.*". – MadHatter Sep 03 '17 at 11:01