This is a multi-part message in MIME format.
--------------000609070005070400070007
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
This patch adds a variable to the host object configuration,
first_notification_delay, which causes notifications for a host to be
put off until a minimum amount of time has passed.
This is intended to artificially mimic the service notification logic
that allows some time to pass between a detected error and the first
notification by forcing at least some "sleep-time" between the HARD
detection of a downed host and the first notification sent for it.
Because of how notifications are scheduled, this means that no host
notifications are sent unless the host has been checked first the
max_check_attempts times (run serially), waited until a service (or the
host) has been checked again and then, if the host is still down, the
notification is sent provided (first_notification_delay *
interval_length) seconds has passed.
I did the documentation update. All credits for the code should go to
Mathias Sundman, a Sungard employee and also a customer of ours who sent
the patch to me for review. I'm forwarding it to the list with his
explicit consent. I've tested it and found it to be in good working order.
--
Andreas Ericsson [email protected]
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
--------------000609070005070400070007
Content-Type: text/plain;
name="host-first_notification_delay.diff"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline;
filename="host-first_notification_delay.diff"
diff -urN ../nagios.orig/base/notifications.c ./base/notifications.c
--- ../nagios.orig/base/notifications.c 2005-11-24 12:18:41.000000000 +01=
00
+++ ./base/notifications.c 2005-11-24 13:11:59.000000000 +0100
@@ -1116,6 +1116,17 @@
#endif
return ERROR;
}
+
+ /* See if enough time has elapsed since the host went down */
+ if(current_time last_hard_state_change + hst->first_notificatio=
n_delay*interval_length)){
+ if(hst->current_state=3D=3DHOST_DOWN || hst->current_state=3D=3DHOST_U=
NREACHABLE){
+#ifdef DEBUG4
+ printf("\tEnough time has not elapsed since the host went DOWN or UNR=
EACHABLE so we should not notify about this yet!\n");
+#endif
+ return ERROR;
+ }
+ }
+
if(hst->current_state=3D=3DHOST_UP){
=20
if(hst->notify_on_recovery=3D=3DFALSE){
diff -urN ../nagios.orig/cgi/config.c ./cgi/config.c
--- ../nagios.orig/cgi/config.c 2005-11-18 14:06:08.000000000 +0100
+++ ./cgi/config.c 2005-11-24 13:11:59.000000000 +0100
@@ -458,6 +458,7 @@
printf("Freshness Threshold\n");
printf("Default Contact Groups\n");
printf("Notification Interval");
+ printf("First Notification Delay");
printf("Notification Options");
printf("Notification Period");
printf("Event Handler");
@@ -544,6 +545,8 @@
get_interval_time_string(temp_host->notification_interval,time_string,=
sizeof(time_string));
printf("%s\n",bg_class,(temp_host->notification_=
interval=3D=3D0)?"No Re-notification":time_string);
=20
+ printf("%d\n",bg_class,temp_host->first_notifica=
tion_delay);
+
printf("",bg_class);
options=3D0;
if(temp_host->notify_on_down=3D=3DTRUE){
diff -urN ../nagios.orig/common/objects.c ./common/objects.c
--- ../nagios.orig/common/objects.c 2005-11-24 12:16:58.000000000 +0100
+++ ./common/objects.c 2005-11-24 14:49:24.000000000 +0100
@@ -922,7 +922,7 @@
=20
=20
/* add a new host definition */
-host *add_host(char *name, char *alias, char *address, char *check_perio=
d, int check_interval, int max_attempts, int notify_up, int notify_down, =
int notify_unreachable, int notify_flapping, int notification_interval, c=
har *notification_period, int notifications_enabled, char *check_command,=
int checks_enabled, int accept_passive_checks, char *eve
...[email truncated]...
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]