[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] hobbitgraph.cgi: adding support for stack (Was: [hobbit] ganglia-style graph aggregation with hobbit)
- To: hobbit (at) hswn.dk, henrik (at) hswn.dk
- Subject: [PATCH] hobbitgraph.cgi: adding support for stack (Was: [hobbit] ganglia-style graph aggregation with hobbit)
- From: Gildas Le Nadan <gn1 (at) sanger.ac.uk>
- Date: Thu, 12 Oct 2006 10:33:14 +0100
- References: <4511637D.2050006@sanger.ac.uk> <20060920193920.GD28669@hswn.dk> <4512A42E.9000804@sanger.ac.uk> <452BBB0E.8080809@mcclatchyinteractive.com> <452CB05A.8010309@sanger.ac.uk>
- User-agent: Thunderbird 1.5.0.7 (X11/20060922)
Hi,
BEWARE: this patch has been tested on a machine with rrdtool 1.0.x. The
values/behavior for rrdtool 1.2.x were taken from the online rrd documentation
so they are hopefully correct. If someone was able to test it for me on a server
with rrdtool 1.2, I would be very grateful!
Cheers,
Gildas
--
The following patch add support for a @STACKIT@ keyword in the graph definitions
in hobbitgraph.cfg, allowing data to be stacked.
The STACK behavior changed between rrdtool 1.0.x and 1.2.x, hence the ifdef:
- in 1.0.x, you replace the graph type (AREA|LINE) for the graph you want to
stack with the STACK keyword
- in 1.2.x, you add the STACK keyword at the end of the definition
Please note that in both cases the first entry mustn't contain the keyword STACK
at all, so we need a different treatment for the first rrdidx
examples of valid hobbitgraph.cfg entries:
rrdtool 1.0.x
[la-multi]
TITLE Multi-host CPU Load
YAXIS Load
FNPATTERN la.rrd
DEF:avg (at) RRDIDX@= (at) RRDFN@:la:AVERAGE
CDEF:la (at) RRDIDX@=avg (at) RRDIDX@,100,/
@STACKIT@:la (at) RRDIDX@# (at) COLOR@:@RRDPARAM@
-u 1.0
GPRINT:la (at) RRDIDX@:LAST: \: %5.1lf (cur)
GPRINT:la (at) RRDIDX@:MAX: \: %5.1lf (max)
GPRINT:la (at) RRDIDX@:MIN: \: %5.1lf (min)
GPRINT:la (at) RRDIDX@:AVERAGE: \: %5.1lf (avg)\n
rrdtool 1.2.x
[la-multi]
TITLE Multi-host CPU Load
YAXIS Load
FNPATTERN la.rrd
DEF:avg (at) RRDIDX@= (at) RRDFN@:la:AVERAGE
CDEF:la (at) RRDIDX@=avg (at) RRDIDX@,100,/
AREA:la (at) RRDIDX@# (at) COLOR@:@RRDPARAM@:@STACKIT@
-u 1.0
GPRINT:la (at) RRDIDX@:LAST: \: %5.1lf (cur)
GPRINT:la (at) RRDIDX@:MAX: \: %5.1lf (max)
GPRINT:la (at) RRDIDX@:MIN: \: %5.1lf (min)
GPRINT:la (at) RRDIDX@:AVERAGE: \: %5.1lf (avg)\n
--- hobbit-4.2.0/web/hobbitgraph.c 2006-08-09 21:10:13.000000000 +0100
+++ hobbit-4.2.0.ganglia/web/hobbitgraph.c 2006-10-12 10:24:09.788773551 +0100
@@ -392,6 +392,42 @@
}
inp += 10;
}
+ else if (strncmp(inp, "@STACKIT@", 9) == 0) {
+ /* the STACK behavior changed between rrdtool 1.0.x
+ * and 1.2.x, hence the ifdef:
+ * - in 1.0.x, you replace the graph type (AREA|LINE)
+ * for the graph you want to stack with the STACK
+ * keyword
+ * - in 1.2.x, you add the STACK keyword at the end
+ * of the definition
+ *
+ * Please note that in both cases the first entry
+ * mustn't contain the keyword STACK at all, so
+ * we need a different treatment for the first rrdidx
+ *
+ * examples of hobbitgraph.cfg entries:
+ *
+ * - rrdtool 1.0.x
+ * @STACKIT@:la (at) RRDIDX@# (at) COLOR@:@RRDPARAM@
+ *
+ * - rrdtool 1.2.x
+ * AREA::la (at) RRDIDX@# (at) COLOR@:@RRDPARAM@:@STACKIT@
+ */
+ char numstr[10];
+ if (rrdidx == 0) {
+#ifdef RRDTOOL12
+ sprintf(numstr, "");
+#else
+ sprintf(numstr, "AREA");
+#endif
+ }
+ else {
+ sprintf(numstr, "STACK");
+ }
+ strcpy(outp, numstr);
+ outp += strlen(outp);
+ inp += 9;
+ }
else if (strncmp(inp, "@RRDIDX@", 8) == 0) {
char numstr[10];