]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
fix xport incompatibility ... make it possible to re-include the time into the xml... 673/head
authorTobias Oetiker <tobi@oetiker.ch>
Tue, 22 Sep 2015 11:38:46 +0000 (13:38 +0200)
committerTobias Oetiker <tobi@oetiker.ch>
Tue, 22 Sep 2015 11:38:46 +0000 (13:38 +0200)
doc/rrdxport.pod
src/rrd_xport.c

index 1e71a170b088eabc3eecf64c38755a1f11d75b97..bd2664472dfeaddfcfdc1c482c8ad6fe6f832176 100644 (file)
@@ -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>]>
@@ -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)
index 610cded99d0eedc375cfb00d58ffed8b9f51c726..35ed656a3b82c7f2cc55536df60c48056cff4039 100644 (file)
@@ -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,