[hobbit] Problem with ncv

Henrik Stoerner henrik at hswn.dk
Thu Sep 14 22:53:33 CEST 2006


On Thu, Sep 14, 2006 at 06:10:50PM +0200, Francesco Duranti wrote:
> I've a problem with data reporting in 
> rrd files via ncv, I've one script that report data in this way
>
> MySQL Connection statistics
> 
> Threads		= 7
> Questions	= 153015
> Slow queries	= 0</PRE>
> <DIV align=left><PRE>Opens		= 0
> Flush tables	= 1
> Open tables	= 32
> Queries per second avg	= 0.135
>
> The rrd will get MySQLConnectionstat as the name of the first data to save in 
> the rrd instead of getting Threads.

This patch should fix it.


Regards,
Henrik

-------------- next part --------------
--- release/hobbit-4.2.0/hobbitd/rrd/do_ncv.c	2006-08-09 22:10:06.000000000 +0200
+++ hobbitd/rrd/do_ncv.c	2006-09-14 22:49:06.259129035 +0200
@@ -11,7 +11,7 @@
 /*                                                                            */
 /*----------------------------------------------------------------------------*/
 
-static char ncv_rcsid[] = "$Id: do_ncv.c,v 1.10 2006/06/09 22:23:49 henrik Rel $";
+static char ncv_rcsid[] = "$Id: do_ncv.c,v 1.10 2006/06/09 22:23:49 henrik Rel henrik $";
 
 int do_ncv_rrd(char *hostname, char *testname, char *msg, time_t tstamp) 
 { 
@@ -44,11 +44,22 @@
 
 		l += strspn(l, " \t\n");
 		if (*l) { 
+			/* See if this line contains a '=' or ':' sign */
 			name = l; 
-			l += strcspn(l, ":="); 
-			if( *l ) { *l = '\0'; l++; }
-			else break;
+			l += strcspn(l, ":=\n"); 
+
+			if (*l) {
+				if (( *l == '=') || (*l == ':')) { 
+					*l = '\0'; l++;
+				}
+				else {
+					/* No marker, so skip this line */
+					name = NULL;
+				}
+			}
+			else break;	/* We've hit the end of the message */
 		}
+
 		if (name) { 
 			val = l + strspn(l, " \t"); 
 			l = val + strspn(val, "0123456789."); 


More information about the Xymon mailing list