[Nagios-devel] host flapping weighting not always accurate

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

[Nagios-devel] host flapping weighting not always accurate

Post by Guest »

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

it looks like the flap calculation for hosts was not always giving the
latest states more weight compared to previous states. diff attached.

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

--- flapping.c 2008-11-30 19:22:58.000000000 +0200
+++ /tmp/flapping.c 2009-02-01 13:29:53.000000000 +0200
@@ -183,6 +183,7 @@
int update_history=TRUE;
int is_flapping=FALSE;
register int x=0;
+ register int y=0;
int last_state_history_value=HOST_UP;
unsigned long wait_threshold=0L;
double curved_changes=0.0;
@@ -256,17 +257,24 @@
}

/* calculate overall changes in state */
- for(x=0;xstate_history_index;xstate_history[x];
+ last_state_history_value=hst->state_history[y];
+ y++;
+ if(y>=MAX_STATE_HISTORY_ENTRIES)
+ y=0;
continue;
}

- if(last_state_history_value!=hst->state_history[x])
+ if(last_state_history_value!=hst->state_history[y])
curved_changes+=(((double)(x-1)*(high_curve_value-low_curve_value))/((double)(MAX_STATE_HISTORY_ENTRIES-2)))+low_curve_value;

- last_state_history_value=hst->state_history[x];
+ last_state_history_value=hst->state_history[y];
+
+ y++;
+ if(y>=MAX_STATE_HISTORY_ENTRIES)
+ y=0;
}

/* calculate overall percent change in state */

--------------010309070902000602010005--





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