Disable host AND service notifications?


#1

I have some hosts which are eternally coming going up and down. I am not responsible for them, and it does not affect me, but i still would like to monitor them.

The hosts use service templates, and these are shared amongst many hosts, so i can’t just disable notifications on a service basis.

Surely there is a way to disable service notifications on a host basis. I am aware of cgi commands, but nagios forgets this if the service is restarted I think.


#2

You can eather set notifications_enabled to 0 in your hosts.cfg or if you want to send notifications to everybody else but you, you can create a contact group that does not contain your name and send notifications to this group
Edited Thu Mar 31 2005, 08:19AM ]


#3

Put this in your hosts.cfg for each host you are not interested in, if you don’t want anyone to get notifications.
define host{
host_name host_name
alias alias
address address
parents host_names
check_command command_name
max_check_attempts #
checks_enabled [0/1]
event_handler command_name
event_handler_enabled [0/1]
low_flap_threshold #
high_flap_threshold #
flap_detection_enabled [0/1]
process_perf_data [0/1]
retain_status_information [0/1]
retain_nonstatus_information [0/1]
notification_interval #
notification_period timeperiod_name
notification_options [d,u,r]
notifications_enabled 0
}
Likewise in the services.cfg
You ** MUST** then use the cgi interface to Disable notifications, I repeat, you must use cgi interface to disable notifications.


#4

notifications_enabled only disables host notifications. It does not disable notifications for the services related to the host.

Currently I use templates for services, and so many hosts use each service template. If i disable notifications for a service, then i disable notifications for all hosts which use the service. This is not what i want.

I am looking for functionality similar to “Disable notifications for all services on this host” in cgi that can be configured from the object files.

Alternatively, can nagios remember which hosts and service notifications have been disabled from the cgi across service restarts?


#5

There is state_retention_file=<file_name> option in the nagios.cfg. If you do use_retained_program_state=1 nagios will start with the status it was stoped with (more details in the documentation).

Also: you don’t need to restart Nagios, just reload it when you make only small changes in the config files and you know they are correct.


#6

I forgot: I’m not sure if this will work but: when you define a template and you have the same line in the template and in the service definition perhaps it will overwrite the template (try it). If not just get this line out of template and put it to each service.


#7

That’s why I stated put it on BOTH hosts and services.cfg.


#8

OK guys. Thanks for your help. Looks like the best way is to use the “Disable notifications for all services on this host” combined with saving state retention.

RooG. That is a good tip about the reload VS restart.

Jakkedup. You are right that I can override the service template for notifications_enabled on the service. I am also now using nagmin. I was not sure if nagmin allowed this from its interface, but it can. It allows me to attach service templates to hosts, and also create service entries which allows me to overide the template and attach it to the host.

Anyhow, I now have two options for this problem. Thanks to Roog and jakkedup for pointing them out