[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [hobbit] trying to get netapp filer data into larrd graphs



On Wed, Feb 16, 2005 at 11:18:28PM +0100, Henrik Stoerner wrote:
> > Here is what the status message looks like from the ciscocpu script:
> > 
> > @@status#28646|1108591336.263764|10.10.10.22||WAN.jvbs-router.atg.com|cp
> > u|1108593136|green||green|1108550383|0||0|
> > status WAN,jvbs-router,atg,com.cpu green Wed Feb 16 16:02:16 CST 2005
> > <br>CPU 5 min average: 4%
> 
> Wouldn't be hard to add support for this in the standard hobbitd_larrd
> handler.

I've added a couple of lines to the "cpu" handler in hobbitd_larrd,
and from your message I think it should make it work. I also added
the lines that should make the Netapp cpu-reports work.

I've attached a small patch for this (also available at
http://www.hswn.dk/beta/cpu-reports.patch); apply with GNU patch using
"cd hobbit-4.0-RC2; patch -p0 </tmp/cpu-reports.patch" then rebuild
with "make" and "make install" and restart Hobbit.  If graphs appear
after 10-15 minutes, it worked.

Let me know if it's OK.


Regards,
Henrik (off to bed now)
--- hobbitd/larrd/do_la.c	2005/02/06 08:49:02	1.7
+++ hobbitd/larrd/do_la.c	2005/02/16 22:22:33
@@ -8,7 +8,7 @@
 /*                                                                            */
 /*----------------------------------------------------------------------------*/
 
-static char la_rcsid[] = "$Id: do_la.c,v 1.7 2005/02/06 08:49:02 henrik Exp $";
+static char la_rcsid[] = "$Id: do_la.c,v 1.8 2005/02/16 22:04:46 henrik Exp henrik $";
 
 static char *la_params[]          = { "rrdcreate", rrdfn, "DS:la:GAUGE:600:0:U", rra1, rra2, rra3, rra4, NULL };
 
@@ -20,6 +20,8 @@
 
 	eoln = strchr(msg, '\n'); if (eoln) *eoln = '\0';
 	p = strstr(msg, "up: ");
+	if (!p) p = strstr(msg, "Uptime:");	/* Netapp filerstats2bb script */
+	if (!p) p = strstr(msg, "uptime:");
 	if (p) {
 		/* First line of cpu report, contains "up: 159 days, 1 users, 169 procs, load=21" */
 		p = strchr(p, ',');
@@ -57,6 +59,17 @@
 	}
 	if (eoln) *eoln = '\n';
 
+	if (!gotload) {
+		/* See if it's a report from the ciscocpu.pl script. It has load-average on a line by itself */
+		p = strstr(msg, "<br>CPU 5 min average:");
+		if (p) {
+			/* It reports in % cpu utilization */
+			p = strchr(p, ':');
+			load = atoi(p+1);
+			gotload = 1;
+		}
+	}
+
 	if (gotload) {
 		sprintf(rrdfn, "la.rrd");
 		sprintf(rrdvalues, "%d:%d", (int)tstamp, load);