summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 73ea596)
raw | patch | inline | side by side (parent: 73ea596)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Fri, 16 May 2008 12:18:05 +0000 (12:18 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Fri, 16 May 2008 12:18:05 +0000 (12:18 +0000) |
program/NEWS | patch | blob | history | |
program/src/rrd_dump.c | patch | blob | history |
diff --git a/program/NEWS b/program/NEWS
index 26c92a119ddec26e683f63bac04f9a2a2142496c..c482d227ebb3128e4ac0a8d0bafcc9e1c92bef9b 100644 (file)
--- a/program/NEWS
+++ b/program/NEWS
============
Major Changes between 1.2.x and 1.3.x
-see http://oss.oetiker.ch/rrdtool-trac/wiki/RRDtool13
-for up to date information
+RRdtool dump / restore Incompatibilities
+----------------------------------------
+rrdtool dump 1.3 does emit completely legal xml. Basically this means that
+it contains an xml header and a DOCTYPE definition. Unfortunately this
+causes older versions of rrdtool restore to be unhappy.
-File access methods (Bernhard Fischer)
+To restore a new dump with ann old rrdtool restore version, either remove
+the xml header and the doctype by hand (both on the first line of the dump)
+or use rrdtool dump --no-header.
+
+NEW File access methods (Bernhard Fischer)
-------------------
* introduced file-accessor functions rrd_read/rrd_seek/rrd_write
* implemented full mmap-based file access with madvise hints for improved
disk
* implemented optional full file-descriptor access instead of FILE* access
-Graphing (Tobi Oetiker)
+NEW Graphing (Tobi Oetiker)
--------
* libart has been replaced by cairo/pango
* pango markup is supported
* new interface graphv which returns inforamation useing the rrd_info
interface (Tobi Oetiker and Mark Plaksin)
-Forecasting (Evan Miller)
+NEW Forecasting (Evan Miller)
-----------
* the new MHWPREDICT consolidation function uses a variation of the Holt-Winters
method. It is a drop-in replacement for HWPREDICT, and is better suited for
--------
* rrd_restore now uses libxml for parsing which makes things much more
tolerant towards xml variations. The old code could mostly just parse the
- xml as it was output by rrd_dump (by Florian octo Forster)
+ xml as it was output by rrdtool dump. See also: 'incompatibilities' at the
+ top of this document. (by Florian octo Forster)
* rrd_update rewritten to make it more modular. Fixed two longstanding
HW bugs in the process (Evan Miller)
diff --git a/program/src/rrd_dump.c b/program/src/rrd_dump.c
index 7ad85b20e6a53e86f43b6a3517a50f69bbef7c64..707789ca5ecbbb8aece996583a1900056312e77c 100644 (file)
--- a/program/src/rrd_dump.c
+++ b/program/src/rrd_dump.c
char **argv)
{
int rc;
+ int opt_noheader = 0;
+ /* init rrd clean */
- if (argc < 2) {
- rrd_set_error("Not enough arguments");
- return -1;
+ optind = 0;
+ opterr = 0; /* initialize getopt */
+
+ while (42) {
+ int opt;
+ int option_index = 0;
+ static struct option long_options[] = {
+ {"no-header", no_argument, 0, 'n'},
+ {0, 0, 0, 0}
+ };
+
+ opt = getopt_long(argc, argv, "n", long_options, &option_index);
+
+ if (opt == EOF)
+ break;
+
+ switch (opt) {
+ case 'n':
+ opt_range_check = 1;
+ break;
+
+ default:
+ rrd_set_error("usage rrdtool %s [--no-header|-n] "
+ "file.rrd [file.xml]", argv[0]);
+ return (-1);
+ break;
+ }
+ } /* while (42) */
+
+ if ((argc - optind) < 2) {
+ rrd_set_error("usage rrdtool %s [--no-header|-n] "
+ "file.rrd [file.xml]", argv[0]);
+ return (-1);
}
if (argc == 3) {
- rc = rrd_dump_r(argv[1], argv[2]);
+ rc = rrd_dump_opt_r(argv[1], argv[2],opt_noheader);
} else {
- rc = rrd_dump_r(argv[1], NULL);
+ rc = rrd_dump_opt_r(argv[1], NULL,opt_noheader);
}
return rc;
}
-int rrd_dump_r(
+
+int rrd_dump_opt_r(
const char *filename,
- char *outname)
+ char *outname,
+ int opt_noheader
+)
{
unsigned int i, ii, ix, iii = 0;
time_t now;
out_file = stdout;
}
- fputs("<?xml version=\"1.0\" encoding=\"utf-8\"?>", out_file);
- fputs
- ("<!DOCTYPE rrd SYSTEM \"http://oss.oetiker.ch/rrdtool/rrdtool.dtd\">",
+ if (opt_noheader){
+ fputs("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n", out_file);
+ fputs
+ ("<!DOCTYPE rrd SYSTEM \"http://oss.oetiker.ch/rrdtool/rrdtool.dtd\">\n",
out_file);
+ }
fputs("<!-- Round Robin Database Dump -->", out_file);
fputs("<rrd>", out_file);
if (atoi(rrd.stat_head->version) <= 3) {
}
return rrd_close(rrd_file);
}
+
+/* backward compatibility with 1.2.x */
+int rrd_dump_r(
+ const char *filename,
+ char *outname)
+{
+ rrd_dump_opt_r(filename,outname,0);
+}