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

Problem/Bug? in hobbitgraph.cgi with FNPATTERN and dynamic ds-name



--- Begin Message ---
Hi all

 

I have a rrd file containing multiple Oracle Tablespace use in
percentage.

It is updated throw Hobbit with NCV definition.

 

It looks like this:

 

rrdtool info /var/lib/hobbit/rrd/XXXXXX/TblSpace.rrd | grep "^ds"

ds[TblUseDATA].type = "GAUGE"

ds[TblUseDATA].minimal_heartbeat = 600

ds[TblUseDATA].min = 0.0000000000e+00

ds[TblUseDATA].max = NaN

ds[TblUseDATA].last_ds = "56"

ds[TblUseDATA].value = 7.8400000000e+02

ds[TblUseDATA].unknown_sec = 0

ds[TblUseIDX].type = "GAUGE"

ds[TblUseIDX].minimal_heartbeat = 600

ds[TblUseIDX].min = 0.0000000000e+00

ds[TblUseIDX].max = NaN

ds[TblUseIDX].last_ds = "59"

ds[TblUseIDX].value = 8.2600000000e+02

ds[TblUseIDX].unknown_sec = 0

ds[TblUseSYSTEM].type = "GAUGE"

ds[TblUseSYSTEM].minimal_heartbeat = 600

ds[TblUseSYSTEM].min = 0.0000000000e+00

ds[TblUseSYSTEM].max = NaN

ds[TblUseSYSTEM].last_ds = "43"

ds[TblUseSYSTEM].value = 6.0200000000e+02

ds[TblUseSYSTEM].unknown_sec = 0

ds[TblUseTSRMAN].type = "GAUGE"

ds[TblUseTSRMAN].minimal_heartbeat = 600

ds[TblUseTSRMAN].min = 0.0000000000e+00

ds[TblUseTSRMAN].max = NaN

ds[TblUseTSRMAN].last_ds = "6"

ds[TblUseTSRMAN].value = 8.4000000000e+01

ds[TblUseTSRMAN].unknown_sec = 0

ds[TblUseUNDOTBS1].type = "GAUGE"

ds[TblUseUNDOTBS1].minimal_heartbeat = 600

ds[TblUseUNDOTBS1].min = 0.0000000000e+00

ds[TblUseUNDOTBS1].max = NaN

ds[TblUseUNDOTBS1].last_ds = "3"

ds[TblUseUNDOTBS1].value = 4.2000000000e+01

ds[TblUseUNDOTBS1].unknown_sec = 0

 

I made a hobbitgraph.cfg definition:

 

[TblSpace]

            FNPATTERN TblSpace,(.*).rrd

            TITLE TblSpace Utilization

            YAXIS % Full

            DEF:TblUse (at) RRDIDX@= (at) RRDFN@:TblUse (at) RRDPARAM@:AVERAGE

            LINE2:TblUse (at) RRDIDX@# (at) COLOR@:@RRDPARAM@

            -u 100

            -l 0

            GPRINT:TblUse (at) RRDIDX@:LAST: \: %5.1lf (cur)

            GPRINT:TblUse (at) RRDIDX@:MAX: \: %5.1lf (max)

            GPRINT:TblUse (at) RRDIDX@:MIN: \: %5.1lf (min)

            GPRINT:TblUse (at) RRDIDX@:AVERAGE: \: %5.1lf (avg)\n

 

 

On DEF line TblUse (at) RRDPARAM@ change for each Table Space (ds-name is
"dynamic").

hobbitgraph.cgi process the rrd file like this :

[...]

2008-07-29 19:42:14 rrdgraph

2008-07-29 19:42:14 -

2008-07-29 19:42:14 --title

2008-07-29 19:42:14 XXXXXXXX TblSpace Utilization Last 48 Hours

2008-07-29 19:42:14 -w576

2008-07-29 19:42:14 -h120

2008-07-29 19:42:14 -v

2008-07-29 19:42:14 % Full

2008-07-29 19:42:14 -a

2008-07-29 19:42:14 PNG

2008-07-29 19:42:14 -s e-48h

2008-07-29 19:42:14 DEF:TblUse0=TblSpace,DATA.rrd:TblUseDATA:AVERAGE

2008-07-29 19:42:14 LINE2:TblUse0#0000FF:DATA

2008-07-29 19:42:14 -u 100

2008-07-29 19:42:14 -l 0

2008-07-29 19:42:14 GPRINT:TblUse0:LAST: \: %5.1lf (cur)

2008-07-29 19:42:14 GPRINT:TblUse0:MAX: \: %5.1lf (max)

2008-07-29 19:42:14 GPRINT:TblUse0:MIN: \: %5.1lf (min)

2008-07-29 19:42:14 GPRINT:TblUse0:AVERAGE: \: %5.1lf (avg)\n

2008-07-29 19:42:14 DEF:TblUse1=TblSpace,IDX.rrd:TblUseIDX :AVERAGE

2008-07-29 19:42:14 LINE2:TblUse1#FF0000:IDX

2008-07-29 19:42:14 -u 100

2008-07-29 19:42:14 -l 0

2008-07-29 19:42:14 GPRINT:TblUse1:LAST: \: %5.1lf (cur)

2008-07-29 19:42:14 GPRINT:TblUse1:MAX: \: %5.1lf (max)

2008-07-29 19:42:14 GPRINT:TblUse1:MIN: \: %5.1lf (min)

2008-07-29 19:42:14 GPRINT:TblUse1:AVERAGE: \: %5.1lf (avg)\n

2008-07-29 19:42:14 COMMENT:Updated\: 29-Jul-2008 19\:42\:14

Content-type: image/png

Expires: Tue, 29 Jul 2008 17:47:14 GMT

 

Content-type: text/html

 

<html><head><title>Invalid request</title></head>

<body>Cannot parse DS in 'DEF:TblUse1=TblSpace,IDX.rrd:TblUseIDX
:AVERAGE'</body></html>

 

 

We can see that there is a problem because hobbitgraph.cgi put a space
after "TblUseIDX".

hobbitgraph.cgi use a string with a size equal to the longest value of
TblUse (at) RRDPARAM@

 

So in hobbitgraph.c I made this modification:

In function " char *expand_tokens(char *tpl) " 

 

[...]

                        else if (strncmp(inp, "@RRDPARAM@", 10) == 0) {

                                   /* 

                                    * We do a colon-escape first, then
change all commas to slashes as

                                    * this is a common mangling used by
multiple backends (disk, http, iostat...)

                                    */

                                   if (rrddbs[rrdidx].rrdparam) {

                                               char *p;

                                               /* Next line added */

                                               char *escaped =
colon_escape(rrddbs[rrdidx].rrdparam);

                                               /* Next line modified */

                                               sprintf(outp, "%-*s",
strlen(escaped), escaped);

                                               p = outp; while ((p =
strchr(p, ',')) != NULL) *p = '/';

                                               outp += strlen(outp);

                                   }

                                   inp += 10;

                        }

[...]

 

Now all is fine !

 

Thanks for Hobbit : this is a very great tool.

 

Pierre

 


--- End Message ---
********************************************************************
Ce message et toutes les pièces jointes sont confidentiels et établis à l'intention exclusive de ses destinataires.
Il ne constitue pas un document officiel. En vertu du Code Général des Collectivités Territoriales,
seuls le Maire et les adjoints au Maire, secrétaire général et secrétaires généraux adjoints ayant reçu
une délégation de signature, ont compétence pour engager la Ville de Bordeaux chacun dans les domaines qui les concernent.
Toute utilisation ou diffusion non autorisée est interdite. Tout message électronique est susceptible d'altération.
La Ville de Bordeaux décline toute responsabilité au titre de ce message s'il a été altéré, déformé, falsifié.
********************************************************************