[rrd-users] rrdtool graph: COMMENT and empty lines(lf) - comprehension question

Simon Hobson linux at thehobsons.co.uk
Thu Oct 31 16:18:31 CET 2019

Daniel Schlifka <schlifka at geekpit.org> wrote:

> I have a little comprehension question, i'm still struggling/fighting with rrdtool graph.
> Today i tried to create an empty line within the plotted graphs legend(to separate two lines of text optically).
> Following older ML records and StackOverflow Threads i found some variants to achieve that.
> i.e. "COMMENT:\n" && COMMENT:" " && COMMENT:"\n" && COMMENT:"\s\n"
> Unfortunately none of these worked for me. I tried in different variations without success.
> What interestingly did the trick was:
> COMMENT:"\t\n"
> So here's the question - is the related to how COMMENT handle strings? Are linebreaks considered as part of the string or does COMMENT fail because it considers the 0x0a as terminator and therefore not part of the string(unlike tab) and "believes" there is nothing to print?
> Another theory would be this has nothing to do with rrdtool but is caused by some bash-expansion.

The latter sounds a likely issue. Checking a script from the past, I see I've used these lines in BASH scripts :
COMMENT:\"            min      ave      max      last\n\"
COMMENT:\"  Data to ${PrintedTime}\n\

It may be something specific to my scripts, in these cases it was a matter of doing :
echo "<load of RRD stuff>" | /usr/bin/rrdcgi --filter - 2>&1 > /dev/null
where <loads of RRD stuff> could amount to thousands of lines of script generated output !

It's was a long time ago that I wrote those scripts, one thing I do recall was struggling at times to get the right quoting for quote marks.

More information about the rrd-users mailing list