SV: SV: [xymon] Xymon reports excessive memory usage on 1 SLES 11 host

Henrik Størner henrik at hswn.dk
Wed Dec 15 12:31:33 CET 2010


In <3BD667CCFBD0D04CA2BC3D57D01B64264CA04A6083 at HORMXB103VM1.onerm.dk> Carl Melgaard <Carl.Melgaard at STAB.RM.DK> writes:

>>> [free]
>>>              total       used       free     shared    buffers    cached
>>> Mem:       3921396    3851576      69820          0     319192  3903296=
>=20
>>> -/+ buffers/cache: 18014398509111072    4292308=20
>>> Swap:     2104472        904    2103568
>>I have to plead "not guilty" on behalf of Xymon, then. The data reported=20
>>by "free" in the "+/- buffers/cache" line is obviously bogus - but it is
>>what Xymon uses for the "Actual" memory calculations. If Xymon gets=20
>>bogus data, then you will also have bogus results.

>Yes, thats understandable. Is there any way I can NOT trigger notification =
>on these bogus alerts? Disable the MEMACT check for that host?

Not in the code You have. But it seems reasonable to add some sort of sanity
check in the memory-status handler, so I've done that to only act on the
data when the percent-used is at most 100%. So you will a) not get alerts
from the bogus data, and b) you can disable all memory alerts by setting
a threshold greater than 100.

Patch below should apply to 4.3.0-beta3.

Regards,
Henrik

Index: xymond/xymond_client.c
===================================================================
--- xymond/xymond_client.c	(revision 6590)
+++ xymond/xymond_client.c	(working copy)
@@ -883,17 +883,19 @@
 	get_memory_thresholds(hinfo, clientclass, &physyellow, &physred, &swapyellow, &swapred, &actyellow, &actred);
 
 	memphyspct = (memphystotal > 0) ? ((100 * memphysused) / memphystotal) : 0;
-	if (memphyspct > physyellow) physcolor = COL_YELLOW;
-	if (memphyspct > physred)    physcolor = COL_RED;
+	if (memphyspct <= 100) {
+		if (memphyspct > physyellow) physcolor = COL_YELLOW;
+		if (memphyspct > physred)    physcolor = COL_RED;
+	}
 
-	if (memswapused != -1) {
-		memswappct = (memswaptotal > 0) ? ((100 * memswapused) / memswaptotal) : 0;
+	if (memswapused != -1) memswappct = (memswaptotal > 0) ? ((100 * memswapused) / memswaptotal) : 0;
+	if (memswappct <= 100) {
 		if (memswappct > swapyellow) swapcolor = COL_YELLOW;
 		if (memswappct > swapred)    swapcolor = COL_RED;
 	}
 
-	if (memactused != -1) {
-		memactpct = (memphystotal > 0) ? ((100 * memactused) / memphystotal) : 0;
+	if (memactused != -1) memactpct = (memphystotal > 0) ? ((100 * memactused) / memphystotal) : 0;
+	if (memactpct <= 100) {
 		if (memactpct  > actyellow)  actcolor  = COL_YELLOW;
 		if (memactpct  > actred)     actcolor  = COL_RED;
 	}
@@ -927,14 +929,24 @@
 	addtostatus(msgline);
 
 	if (memactused != -1) {
-		sprintf(msgline, "&%s %-12s%11luM%11luM%11lu%%\n", 
-			colorname(actcolor), "Actual", memactused, memphystotal, memactpct);
+		if (memactpct <= 100)
+			sprintf(msgline, "&%s %-12s%11luM%11luM%11lu%%\n", 
+				colorname(actcolor), "Actual", memactused, memphystotal, memactpct);
+		else
+			sprintf(msgline, "&%s %-12s%11luM%11luM%11lu%% - invalid data\n", 
+				colorname(COL_CLEAR), "Actual", memactused, memphystotal, 0);
+			
 		addtostatus(msgline);
 	}
 
 	if (memswapused != -1) {
-		sprintf(msgline, "&%s %-12s%11luM%11luM%11lu%%\n", 
-			colorname(swapcolor), "Swap", memswapused, memswaptotal, memswappct);
+		if (memswappct <= 100)
+			sprintf(msgline, "&%s %-12s%11luM%11luM%11lu%%\n", 
+				colorname(swapcolor), "Swap", memswapused, memswaptotal, memswappct);
+		else
+			sprintf(msgline, "&%s %-12s%11luM%11luM%11lu%% - invalid data\n", 
+				colorname(COL_CLEAR), "Swap", memswapused, memswaptotal, 0);
+
 		addtostatus(msgline);
 	}
 	if (fromline && !localmode) addtostatus(fromline);




More information about the Xymon mailing list