[hobbit] No graph of nmailq-bf.sh

Henrik Stoerner henrik at hswn.dk
Sun Apr 24 15:03:25 CEST 2005


On Sun, Apr 24, 2005 at 08:11:12PM +1000, Geoff Steer wrote:
> I'm having a similar problem with getting the correct data showing in
> the graph.

Could you try this patch for the "mailq" parser ? It changes the way
Hobbit looks for the queue-size number so that it looks for a line
with the word "requests", and the grabs the queue-size from any number
on that line, whether before or after the "requests" keyword.


Regards,
Henrik
-------------- next part --------------
--- hobbitd/larrd/do_mailq.c	2005/03/25 21:15:26	1.9
+++ hobbitd/larrd/do_mailq.c	2005/04/24 12:59:28
@@ -55,11 +55,21 @@
 
 	}
 	else {
+		char *bol, *eol;
+
 		/* Looking for "... N requests ... " */
-		p = strstr(msg, "requests");
-		if (p) {
+		bol = strstr(msg, "requests");
+		if (bol) {
+			while ((bol > msg) && (*bol != '\n')) bol--;
+			eol = strchr(bol, '\n'); if (eol) *eol = '\0';
+
+			bol += strcspn(bol, "0123456789");
+			mailq = atoi(bol);
+
+#if 0
 			while ((p > msg) && (isspace((int) *(p-1)) || isdigit((int) *(p-1)))) p--;
 			mailq = atoi(p);
+#endif
 
 			sprintf(rrdfn, "mailq.rrd");
 			sprintf(rrdvalues, "%d:%d", (int)tstamp, mailq);


More information about the Xymon mailing list