[rrd-users] Hiding data + legend in STACK graph when no data found
payerle at umd.edu
Thu Dec 13 18:56:40 CET 2012
Is there a way in RRD graphing language to conditionally display a line (and
the associated legend)? I.e., if I have a graph displaying several variables
over a time period, but not all variables are defined over all time periods,
is there a way to programmatically (within the rrd graphing language) suppress
the plotting of a given variable (and perhaps more importantly, suppress its
listing in the legend) if the variable does not have any values over the whole
time period in question.
In particular, I have a VMware ESX container system with a bunch of virtual
guests on it, and I am collecting statistics related to the ESX host broken
down by guest. E.g., memory consumed by each guest while it is on that
I have a perl script which gets the list of virtual guests based on the
RRD files that exist, and produces a stacked area graph showing all the
memory consumed on that ESX host broken down by the guest consuming it.
The perl script at this time just does the relevant DEF,CDEF,VDEF,LINE,AREA,
etc. commands --- it does NOT specify the time range (which is currently
handled at a higher level).
For the most part, things are working. However, the guest VMs sometimes
get migrated from one ESX container to another (the statistics in question
pertain to the ESX container, so I do not want these statistics to migrate
with the host but to remain with the container), and a graph will often end
up with a lengthy legend referring to VM guests which were not on the host
(and therefore no data was collected in the rrds) in the referenced time
I.e., I would like something like
IF plotx THEN
That is, draw x (and put "x" in the legend) only if plotx is nonzero/1,
and plot nothing otherwise.
Alternatively, if there is someway to conditionally nullify the label
for the x line if plotx is not true, and/or set the color for the x variable
to invisible/undef if plotx is not true. (I am not particularly concerned
about the drawing of the line it self; I can't remember if the undef values
are skipped or treated as 0, and I can certainly force treating as 0; but
as migrating VMs between hosts is not uncommon, our legends are quickly getting
Does anyone have any suggestions? Thanks in advance.
More information about the rrd-users