Skip to content
Browse files

Allow spaces in argument values.

This is a hack to allow spaces in argument values (for example, for
arguments like --title). The hack is to have the module substitute all
occurrences of tilde in the URI with spaces before passing the
arguments to rrdtool.

It comes at the cost of losing the ability to place literal tilde
characters in graph text, which is not likely to be a problem in
practice. If it is found to be a problem, perhaps the character to
substitue (or the feature altogether) could be controlled with a
module directive.
  • Loading branch information...
1 parent f1a155e commit fb323a099ee05810779d8f0f328fa59c00850c3c @jhesch committed May 16, 2012
Showing with 12 additions and 0 deletions.
  1. +10 −0 README
  2. +2 −0 ngx_http_rrd_graph_module.c
View
10 README
@@ -32,6 +32,16 @@ becomes:
http://mysite.com/rrdtool--start%20now-300s%20--end%20now%20DEF%3Ads0%3Dtest.rrd%3Areading%3AAVERAGE%20LINE1%3Ads0%2300FF00
+Spaces can be inlcuded in argument values by using the tilde character.
+For example, the title of the following example will be rendered as
+"Test Graph":
+
+ rrdtool graph --start now-300s \
+ --end now \
+ --tile Test~Graph \
+ DEF:ds0=test.rrd:reading:AVERAGE \
+ LINE1:ds0#00FF00
+
The module supports all the features of your copy of RRDtool. It can output
PNG, PDF, SVG, and EPS graphics (see the --imgformat option of rrdgraph(1)).
View
2 ngx_http_rrd_graph_module.c
@@ -189,6 +189,8 @@ ngx_http_rrd_graph_parse_uri(ngx_http_request_t *r, int *argc_ptr,
*p = '\0';
argv[argc++] = p+1;
} else {
+ if (*p == '~')
+ *p = ' ';
argv_len[argc-1]++;
}
p++;

0 comments on commit fb323a0

Please sign in to comment.
Something went wrong with that request. Please try again.