From: Tobias Oetiker Date: Tue, 22 Sep 2015 11:38:46 +0000 (+0200) Subject: fix xport incompatibility ... make it possible to re-include the time into the xml... X-Git-Tag: v1.6.0~25^2~9^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F673%2Fhead;p=thirdparty%2Frrdtool-1.x.git fix xport incompatibility ... make it possible to re-include the time into the xml output --- diff --git a/doc/rrdxport.pod b/doc/rrdxport.pod index 1e71a170..bd266447 100644 --- a/doc/rrdxport.pod +++ b/doc/rrdxport.pod @@ -10,6 +10,7 @@ S<[B<-e>|B<--end> I]> S<[B<-m>|B<--maxrows> I]> S<[B<--step> I]> S<[B<--json>]> +S<[B<--showtime>]> S<[B<--enumds>]> S<[B<--daemon>|B<-d> I
]> S<[BIB<=>IB<:>IB<:>I]> @@ -60,6 +61,10 @@ For a list of accepted formats, see the B<-l> option in the L 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) diff --git a/src/rrd_xport.c b/src/rrd_xport.c index 610cded9..35ed656a 100644 --- a/src/rrd_xport.c +++ b/src/rrd_xport.c @@ -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} }; @@ -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){ @@ -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); @@ -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,