Skip to content

Commit

Permalink
fix xport incompatibility ... make it possible to re-include the time…
Browse files Browse the repository at this point in the history
… into the xml output
  • Loading branch information
oetiker committed Sep 22, 2015
1 parent 666ddb4 commit 67b0cde
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
5 changes: 5 additions & 0 deletions doc/rrdxport.pod
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ S<[B<-e>|B<--end> I<seconds>]>
S<[B<-m>|B<--maxrows> I<rows>]>
S<[B<--step> I<value>]>
S<[B<--json>]>
S<[B<--showtime>]>
S<[B<--enumds>]>
S<[B<--daemon>|B<-d> I<address>]>
S<[B<DEF:>I<vname>B<=>I<rrd>B<:>I<ds-name>B<:>I<CF>]>
Expand Down Expand Up @@ -60,6 +61,10 @@ For a list of accepted formats, see the B<-l> option in the L<rrdcached> manual.

rrdtool xport --daemon unix:/var/run/rrdcached.sock ...

=item B<--showtime>

include the time into each data row.

=item B<--json>

produce json formated output (instead of xml)
Expand Down
10 changes: 8 additions & 2 deletions src/rrd_xport.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ int rrd_xport(
{"maxrows",'m', OPTPARSE_REQUIRED},
{"step", 261, OPTPARSE_REQUIRED},
{"enumds", 262, OPTPARSE_NONE},
{"json", 263, OPTPARSE_NONE}, /* these are handled in the frontend ... */
{"json", 263, OPTPARSE_NONE},
{"showtime", 't', OPTPARSE_NONE},
{"daemon", 'd', OPTPARSE_REQUIRED},
{0}
};
Expand All @@ -95,7 +96,8 @@ int rrd_xport(

int enumds=0;
int json=0;

int showtime=0;

int opt;
while ((opt = optparse_long(&options,longopts,NULL)) != -1){

Expand All @@ -109,6 +111,9 @@ int rrd_xport(
case 263:
json=1;
break;
case 't':
showtime=1;
break;
case 's':
if ((parsetime_error = rrd_parsetime(options.optarg, &start_tv))) {
rrd_set_error("start time: %s", parsetime_error);
Expand Down Expand Up @@ -198,6 +203,7 @@ int rrd_xport(
if (!xsize) {
int flags=0;
if (json) { flags|=1; }
if (showtime) { flags|=2; }
if (enumds) { flags|=4; }
stringbuffer_t buffer={0,0,NULL,stdout};
rrd_xport_format_xmljson(flags,&buffer,&im,
Expand Down

0 comments on commit 67b0cde

Please sign in to comment.