[Xymon] noflap option to disable flapping functionality per test
Martin Lenko
lenko99 at gmail.com
Sat Jun 13 19:10:23 CEST 2015
Hello,
in our installation of xymon we have found that there are certain test that
we do not want to apply flapping functionality so I've extended xymond code
a bit to allow use of noflap option in hosts.cfg.
JC, would it be possible to add this to xymon's code?
Here are the changes that add the noflap option:
Index: lib/loadhosts.h
===================================================================
--- lib/loadhosts.h (revision 1)
+++ lib/loadhosts.h (working copy)
@@ -36,6 +36,7 @@
XMH_HOLIDAYS,
XMH_DELAYRED,
XMH_DELAYYELLOW,
+ XMH_NOFLAP,
XMH_FLAG_NOINFO,
XMH_FLAG_NOTRENDS,
XMH_FLAG_NOCLIENT,
Index: lib/loadhosts.c
===================================================================
--- lib/loadhosts.c (revision 1)
+++ lib/loadhosts.c (working copy)
@@ -132,6 +132,8 @@
xmh_item_name[XMH_DELAYRED] = "XMH_DELAYRED";
xmh_item_key[XMH_DELAYYELLOW] = "delayyellow=";
xmh_item_name[XMH_DELAYYELLOW] = "XMH_DELAYYELLOW";
+ xmh_item_key[XMH_NOFLAP] = "noflap=";
+ xmh_item_name[XMH_NOFLAP] = "XMH_NOFLAP";
xmh_item_key[XMH_FLAG_NOINFO] = "noinfo";
xmh_item_name[XMH_FLAG_NOINFO] = "XMH_FLAG_NOINFO";
xmh_item_key[XMH_FLAG_NOTRENDS] = "notrends";
Index: xymond/xymond.c
===================================================================
--- xymond/xymond.c (revision 1)
+++ xymond/xymond.c (working copy)
@@ -1338,6 +1338,26 @@
return result;
}
+static int isset_noflap(void *hinfo, char *testname, char *hostname)
+{
+ char *tok, *dstr = NULL;
+ int keylen;
+ int result = 1; /* default is 1 - > use flapping */
+
+ dstr = xmh_item(hinfo, XMH_NOFLAP);
+ if (!dstr) return result;
+
+ /* Check "noflap=test1,test2" */
+ keylen = strlen(testname);
+ tok = strtok(dstr, ",");
+ while (tok && (strncmp(testname, tok, keylen) != 0)) tok =
strtok(NULL, ",");
+ if (tok) {
+ result = 0; /* do not use flapping for the test */
+ dbgprintf("Ignoring flapping for %s:%s due to noflap set.\n", hostname,
testname);
+ }
+ return result;
+}
+
void handle_status(unsigned char *msg, char *sender, char *hostname, char
*testname, char *grouplist,
xymond_log_t *log, int newcolor, char *downcause, int modifyonly)
{
@@ -1421,7 +1441,10 @@
* is less serious than the old color, then we ignore the
* color change and keep the status at the more serious level.
*/
- if (modifyonly || issummary) {
+ if (modifyonly || issummary || isset_noflap(hinfo, testname, hostname)) {
/* Nothing */
}
else if ((flapcount > 0) && ((now - log->lastchange[flapcount-1]) <
flapthreshold)) {
Kind regards,
Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20150613/dfa22046/attachment.html>
More information about the Xymon
mailing list