Re: [Nagios-devel] [PATCH] Distinguish between warning and critical

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.
Locked
Guest

Re: [Nagios-devel] [PATCH] Distinguish between warning and critical

Post by Guest »

This is a multi-part message in MIME format.
--------------090509090900070300050306
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Mark Gius wrote:
> Hendrik Baecker wrote:
>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Am 18.11.09 01:02, schrieb Mark Gius:
>>
>>
>>> The patch adds 4 configuration directives to service escalations
>>> definitions:
>>>
>>> first_warning_notification #
>>> last_warning_notification #
>>> first_critical_notification #
>>> last_critical_notification #
>>>
>>> Behavior is identical to (first|last)_notification, except that they
>>> check against the count of warning/critical notifications instead of the
>>> number of total notifications.
>>>
>>>
>> Hi,
>>
>> I really like this but what about unknown state notifications which
>> might be used?
>>
>>
> I thought of unknowns right after I sent the patch. We don't really use
> them in our deployment, so I wasn't thinking about them during
> implementation. It's easy enough to add.
>
>> What about hostescalations? Would you patch them too?
>>
>>
> I was going to question the usefulness of this, but they can be both
> "down" and "unreachable." I'll get an updated patch up sometime next week.
>
And now I'm done. I've done some sanity checks on this (retention, cgi
behavior, notification behavior, objects.cache). I'm running this code
on our testing instance now, and I'll report back if something awful
happens.

The Patch adds the following directives to host escalations

first_down_notification #
last_down_notification #
first_unreachable_notification #
last_unreachable_notification #

Behavior is identical to (first_last)_notification, except that they
check against the count of down/unreachable notifications instead of the
total.

I've also added directives to service escalations to handle unknown states

first_unknown_notification #
last_unknown_notification #

-Gius

--------------090509090900070300050306
Content-Type: text/x-patch;
name="nagios_escalations.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="nagios_escalations.patch"

diff -ur nagiosclean/base/checks.c nagiospatched/base/checks.c
--- nagiosclean/base/checks.c 2009-08-11 09:56:39.000000000 -0700
+++ nagiospatched/base/checks.c 2009-11-19 17:13:07.000000000 -0800
@@ -1294,6 +1294,9 @@
temp_service->last_notification=(time_t)0;
temp_service->next_notification=(time_t)0;
temp_service->current_notification_number=0;
+ temp_service->current_warning_notification_number=0;
+ temp_service->current_critical_notification_number=0;
+ temp_service->current_unknown_notification_number=0;
temp_service->problem_has_been_acknowledged=FALSE;
temp_service->acknowledgement_type=ACKNOWLEDGEMENT_NONE;
temp_service->notified_on_unknown=FALSE;
diff -ur nagiosclean/base/notifications.c nagiospatched/base/notifications.c
--- nagiosclean/base/notifications.c 2008-11-30 09:22:58.000000000 -0800
+++ nagiospatched/base/notifications.c 2009-11-23 17:06:25.000000000 -0800
@@ -98,10 +98,23 @@
/* should the notification number be increased? */
if(type==NOTIFICATION_NORMAL || (options & NOTIFICATION_OPTION_INCREMENT)){
svc->current_notification_number++;
+ /* also increment the warning/critical/unknown state counter */
+ if (svc->current_state == STATE_WARNING) {
+ svc->current_warning_notification_number++;
+ }
+ if (svc->current_state == STATE_CRITICAL) {
+ svc->current_critical_notification_number++;
+ }
+ if (svc->current_state == STATE_UNKNOWN) {
+ svc->current_unknown_notification_number++;
+ }
increment_notification_number=TRUE;
}

log_debug_info(DEBUGL_NOTIFICATIONS,1,"Current notification number: %d (%s)\n",svc->current_notification_number,(increment_notification_number==TRUE)?"incremented":"unchanged");
+ log_debug_info(DEBUGL_NOTIFICATIONS,1,"Current warning notification number: %d (%s)\n",svc->current_warning_notification_number,(increment_notification_number==TRUE)?"incremented":"unchanged");
+ log_debug_info(DEBUGL_NOTIFICATIONS,1,"Current critical notification number: %d (%s)\n",svc

...[email truncated]...


This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Locked