[rrd-users] RRDs Coding Question - Dynamic Multiple RRD Data Sources
Wesley Wyche
wesley.wyche at verizon.com
Mon Sep 24 20:39:13 CEST 2012
I have a coding question. Suppose I have multiple RRD databases. Each one
contains metrics data that is collected from different sources all about the
same data. In other words, the collective data across all sources makes up
the entire set of data.
For example, I have 4 "collectors" each accumulating 25% of the data for an
individual item. Each database could be named cpu1.rrd, cpu2.rrd, cpu3.rrd,
and cpu4.rrd.
Here is an example of cpu data graphed for a single server:
($prints,$xs,$ys)=RRDs::graph ($tempName, "-i", "-b", "1024",
"-s","-$range", "-w",$width, "-h",$height, "-a", "PNG",
"-n","DEFAULT:0:Arial",
"-u 1", "-l 0", "-r", "--title", "$serverName - cpu usage - last
$descr ($dateString)",
"DEF:usrdat=/my/path/cpu1.rrd:cpuusr:AVERAGE",
"DEF:nicdat=/my/path/cpu1.rrd:cpunic:AVERAGE",
"DEF:sysdat=/my/path/cpu1.rrd:cpusys:AVERAGE",
"DEF:idldat=/my/path/cpu1.rrd:cpuidl:AVERAGE",
"CDEF:usravg=usrdat,1,1,*,*",
"CDEF:nicavg=nicdat,1,1,*,*",
"CDEF:sysavg=sysdat,1,1,*,*",
"CDEF:idlavg=idldat,1,1,*,*",
"AREA:sysavg#ff0000:system\\g",
"GPRINT:sysavg:MIN: (min\\:%7.2lf,\\g",
"GPRINT:sysavg:AVERAGE: avg\\:%7.2lf,\\g",
"GPRINT:sysavg:MAX: max\\:%7.2lf)\\n",
"STACK:usravg#0000ff:user\\g",
"GPRINT:usravg:MIN: (min\\:%7.2lf,\\g",
"GPRINT:usravg:AVERAGE: avg\\:%7.2lf,\\g",
"GPRINT:usravg:MAX: max\\:%7.2lf)\\n",
"STACK:nicavg#ffff00:nice\\g",
"GPRINT:nicavg:MIN: (min\\:%7.2lf,\\g",
"GPRINT:nicavg:AVERAGE: avg\\:%7.2lf,\\g",
"GPRINT:nicavg:MAX: max\\:%7.2lf)\\n",
"STACK:idlavg#00ff00:idle\\g",
"GPRINT:idlavg:MIN: (min\\:%7.2lf,\\g",
"GPRINT:idlavg:AVERAGE: avg\\:%7.2lf,\\g",
"GPRINT:idlavg:MAX: max\\:%7.2lf)\\n",
"HRULE:0#000000");
How do you transform this into multiple dynamic input databases. I realize
you could simply add 4 more DEFs for each new DB etc (as well as the changes
to the CDEFs), but that would be hardcoding the 4. The problem is that
there may by ANY number of databases (i.e. 1-n).
Is there a way to do a wildcard pull of the input files? Or perhaps some
other way?
--
View this message in context: http://rrd-mailinglists.937164.n2.nabble.com/RRDs-Coding-Question-Dynamic-Multiple-RRD-Data-Sources-tp7580480.html
Sent from the RRDtool Users Mailinglist mailing list archive at Nabble.com.
More information about the rrd-users
mailing list