There are various different ways to generate rrdtool images. And most people will probably be generating elaborate ones out of perl or php scripts. The ones I am currently generating are built in a shell script (bash) and I was really having a problem with quotes and white space here for a while. If you generate the query and save it in a variable, the quotes go to hell and your white space (e.g. a space in a COMMENT) starts causing problems. my solution may not be the best, but it works without any trouble: Throw the whole command line into a temporary file and then use eval to create the graph. The following is not a complete statement, just a few lines as an example.
1 2 3 4 | TmpFile="$(mktemp)" echo -n "--vertical-label example --title \"Title with spaces\" " >> ${TmpFile} echo -n 'COMMENT:" Comment with spaces\l" ' >> ${TmpFile} eval "/usr/bin/rrdtool graph output.png $(cat ${TmpFile}) >/dev/null" |
Tjo, die Dinge können so simpel sein. Danke 😉