diff --git a/program/src/rrd_tool.c b/program/src/rrd_tool.c
index 2cb449499a607fb6f8c4d7ac56f1e7351d6a1202..6aa53cc5b78dfdbc43266e2ac918c0746401eeac 100644 (file)
--- a/program/src/rrd_tool.c
+++ b/program/src/rrd_tool.c
/*****************************************************************************
/*****************************************************************************
- * RRDtool 1.1.x Copyright Tobias Oetiker, 1997 - 2002
+ * RRDtool 1.1.x Copyright Tobias Oetiker, 1997 - 2004
*****************************************************************************
* rrd_tool.c Startup wrapper
*****************************************************************************/
*****************************************************************************
* rrd_tool.c Startup wrapper
*****************************************************************************/
{
char help_main[] =
{
char help_main[] =
- "RRDtool 1.1.x Copyright 1997-2003 by Tobias Oetiker <tobi@oetiker.ch>\n"
+ "RRDtool 1.1.x Copyright 1997-2004 by Tobias Oetiker <tobi@oetiker.ch>\n"
#ifndef WIN32
" Compiled " MAKE_TIMESTAMP "\n\n"
#else
#ifndef WIN32
" Compiled " MAKE_TIMESTAMP "\n\n"
#else
"Usage: rrdtool [options] command command_options\n\n";
char help_list[] =
"Usage: rrdtool [options] command command_options\n\n";
char help_list[] =
- "Valid commands: create, update, graph, dump, restore,\n"
+ "Valid commands: create, update, updatev, graph, dump, restore,\n"
"\t\tlast, info, fetch, tune, resize, xport\n\n";
char help_listremote[] =
"\t\tlast, info, fetch, tune, resize, xport\n\n";
char help_listremote[] =
char help_restore[] =
"* restore - restore an RRD file from its XML form\n\n"
char help_restore[] =
"* restore - restore an RRD file from its XML form\n\n"
- "\trrdtool restore [--range-check|-r] filename.xml filename.rrd\n\n";
+ "\trrdtool restore [--range-check|-r] [--force-overwrite|-f] filename.xml filename.rrd\n\n";
char help_last[] =
"* last - show last update time for RRD\n\n"
char help_last[] =
"* last - show last update time for RRD\n\n"
"\t\ttime|N:value[:value...]\n\n"
"\t\tat-time@value[:value...]\n\n"
"\t\t[ time:value[:value...] ..]\n\n";
"\t\ttime|N:value[:value...]\n\n"
"\t\tat-time@value[:value...]\n\n"
"\t\t[ time:value[:value...] ..]\n\n";
+
+ char help_updatev[] =
+ "* updatev - a verbose version of update\n"
+ "\treturns information about values, RRAs, and datasources updated\n\n"
+ "\trrdtool updatev filename\n"
+ "\t\t--template|-t ds-name:ds-name:...\n"
+ "\t\ttime|N:value[:value...]\n\n"
+ "\t\tat-time@value[:value...]\n\n"
+ "\t\t[ time:value[:value...] ..]\n\n";
char help_fetch[] =
"* fetch - fetch data out of an RRD\n\n"
char help_fetch[] =
"* fetch - fetch data out of an RRD\n\n"
"\t\t[--resolution|-r resolution]\n"
"\t\t[--start|-s start] [--end|-e end]\n\n";
"\t\t[--resolution|-r resolution]\n"
"\t\t[--start|-s start] [--end|-e end]\n\n";
- char help_graph[] =
+/* break up very large strings (help_graph, help_tune) for ISO C89 compliance*/
+
+ char help_graph1[] =
"* graph - generate a graph from one or several RRD\n\n"
"\trrdtool graph filename [-s|--start seconds] [-e|--end seconds]\n"
"\t\t[-x|--x-grid x-axis grid and label]\n"
"* graph - generate a graph from one or several RRD\n\n"
"\trrdtool graph filename [-s|--start seconds] [-e|--end seconds]\n"
"\t\t[-x|--x-grid x-axis grid and label]\n"
"\t\t[-h|--height pixels] [-o|--logarithmic]\n"
"\t\t[-u|--upper-limit value] [-z|--lazy]\n"
"\t\t[-l|--lower-limit value] [-r|--rigid]\n"
"\t\t[-h|--height pixels] [-o|--logarithmic]\n"
"\t\t[-u|--upper-limit value] [-z|--lazy]\n"
"\t\t[-l|--lower-limit value] [-r|--rigid]\n"
- "\t\t[-g|--no-legend]\n"
+ "\t\t[-g|--no-legend]\n";
+ char help_graph2[] =
+ "\t\t[-j|--only-graph]\n"
"\t\t[--font FONTTAG:size:font]\n"
"\t\t[--zoom factor]\n"
"\t\t[--alt-autoscale]\n"
"\t\t[--font FONTTAG:size:font]\n"
"\t\t[--zoom factor]\n"
"\t\t[--alt-autoscale]\n"
"\t\t[--step seconds]\n"
"\t\t[-f|--imginfo printfstr]\n"
"\t\t[-a|--imgformat PNG]\n"
"\t\t[--step seconds]\n"
"\t\t[-f|--imginfo printfstr]\n"
"\t\t[-a|--imgformat PNG]\n"
- "\t\t[-c|--color COLORTAG#rrggbb[aa]] [-t|--title string]\n"
+ "\t\t[-c|--color COLORTAG#rrggbb[aa]] [-t|--title string]\n";
+ char help_graph3[] =
"\t\t[DEF:vname=rrd:ds-name:CF]\n"
"\t\t[CDEF:vname=rpn-expression]\n"
"\t\t[PRINT:vname:CF:format]\n"
"\t\t[DEF:vname=rrd:ds-name:CF]\n"
"\t\t[CDEF:vname=rpn-expression]\n"
"\t\t[PRINT:vname:CF:format]\n"
"\t\t[AREA:vname[#rrggbb[aa][:legend]]]\n"
"\t\t[STACK:vname[#rrggbb[aa][:legend]]]\n\n";
"\t\t[AREA:vname[#rrggbb[aa][:legend]]]\n"
"\t\t[STACK:vname[#rrggbb[aa][:legend]]]\n\n";
- char help_tune[] =
+ char help_tune1[] =
" * tune - Modify some basic properties of an RRD\n\n"
"\trrdtool tune filename\n"
"\t\t[--heartbeat|-h ds-name:heartbeat]\n"
" * tune - Modify some basic properties of an RRD\n\n"
"\trrdtool tune filename\n"
"\t\t[--heartbeat|-h ds-name:heartbeat]\n"
"\t\t[--deltapos scale-value] [--deltaneg scale-value]\n"
"\t\t[--failure-threshold integer]\n"
"\t\t[--window-length integer]\n"
"\t\t[--deltapos scale-value] [--deltaneg scale-value]\n"
"\t\t[--failure-threshold integer]\n"
"\t\t[--window-length integer]\n"
- "\t\t[--alpha adaptation-parameter]\n"
+ "\t\t[--alpha adaptation-parameter]\n";
+ char help_tune2[] =
+ " * tune - Modify some basic properties of an RRD\n\n"
"\t\t[--beta adaptation-parameter]\n"
"\t\t[--gamma adaptation-parameter]\n"
"\t\t[--gamma-deviation adaptation-parameter]\n"
"\t\t[--aberrant-reset ds-name]\n\n";
char help_resize[] =
"\t\t[--beta adaptation-parameter]\n"
"\t\t[--gamma adaptation-parameter]\n"
"\t\t[--gamma-deviation adaptation-parameter]\n"
"\t\t[--aberrant-reset ds-name]\n\n";
char help_resize[] =
- " * resize - alter the lenght of one of the RRAs in an RRD\n\n"
+ " * resize - alter the length of one of the RRAs in an RRD\n\n"
"\trrdtool resize filename rranum GROW|SHRINK rows\n\n";
char help_xport[] =
"\trrdtool resize filename rranum GROW|SHRINK rows\n\n";
char help_xport[] =
"\t\t[XPORT:vname:legend]\n\n";
char help_quit[] =
"\t\t[XPORT:vname:legend]\n\n";
char help_quit[] =
- " * quit - closeing a session in remote mode\n\n"
+ " * quit - closing a session in remote mode\n\n"
"\trrdtool quit\n\n";
char help_ls[] =
"\trrdtool quit\n\n";
char help_ls[] =
char help_cd[] =
" * cd - changes the current directory\n\n"
char help_cd[] =
" * cd - changes the current directory\n\n"
- "\trrdtool cd new direcotry\n\n";
+ "\trrdtool cd new directory\n\n";
char help_mkdir[] =
char help_mkdir[] =
- " * mkdir - creates a new direcotry\n\n"
- "\trrdtool mkdir newdirecotryname\n\n";
+ " * mkdir - creates a new directory\n\n"
+ "\trrdtool mkdir newdirectoryname\n\n";
char help_lic[] =
"RRDtool is distributed under the Terms of the GNU General\n"
char help_lic[] =
"RRDtool is distributed under the Terms of the GNU General\n"
enum { C_NONE, C_CREATE, C_DUMP, C_INFO, C_RESTORE, C_LAST,
C_UPDATE, C_FETCH, C_GRAPH, C_TUNE, C_RESIZE, C_XPORT,
enum { C_NONE, C_CREATE, C_DUMP, C_INFO, C_RESTORE, C_LAST,
C_UPDATE, C_FETCH, C_GRAPH, C_TUNE, C_RESIZE, C_XPORT,
- C_QUIT, C_LS, C_CD, C_MKDIR };
+ C_QUIT, C_LS, C_CD, C_MKDIR, C_UPDATEV };
int help_cmd = C_NONE;
int help_cmd = C_NONE;
help_cmd = C_LAST;
else if (!strcmp(cmd,"update"))
help_cmd = C_UPDATE;
help_cmd = C_LAST;
else if (!strcmp(cmd,"update"))
help_cmd = C_UPDATE;
+ else if (!strcmp(cmd,"updatev"))
+ help_cmd = C_UPDATEV;
else if (!strcmp(cmd,"fetch"))
help_cmd = C_FETCH;
else if (!strcmp(cmd,"graph"))
else if (!strcmp(cmd,"fetch"))
help_cmd = C_FETCH;
else if (!strcmp(cmd,"graph"))
case C_UPDATE:
fputs(help_update, stdout);
break;
case C_UPDATE:
fputs(help_update, stdout);
break;
+ case C_UPDATEV:
+ fputs(help_updatev, stdout);
+ break;
case C_FETCH:
fputs(help_fetch, stdout);
break;
case C_GRAPH:
case C_FETCH:
fputs(help_fetch, stdout);
break;
case C_GRAPH:
- fputs(help_graph, stdout);
+ fputs(help_graph1, stdout);
+ fputs(help_graph2, stdout);
+ fputs(help_graph3, stdout);
break;
case C_TUNE:
break;
case C_TUNE:
- fputs(help_tune, stdout);
+ fputs(help_tune1, stdout);
+ fputs(help_tune2, stdout);
break;
case C_RESIZE:
fputs(help_resize, stdout);
break;
case C_RESIZE:
fputs(help_resize, stdout);
if (strcmp(firstdir,"")){
chdir(firstdir);
if (errno!=0){
if (strcmp(firstdir,"")){
chdir(firstdir);
if (errno!=0){
- fprintf(stderr,"ERROR: %s\n",strerror(errno));
+ fprintf(stderr,"ERROR: %s\n",rrd_strerror(errno));
exit(errno);
}
}
exit(errno);
}
}
}
#if ! defined(HAVE_CHROOT) || ! defined(HAVE_GETUID)
if (getuid()==0 && ! ChangeRoot){
}
#if ! defined(HAVE_CHROOT) || ! defined(HAVE_GETUID)
if (getuid()==0 && ! ChangeRoot){
- printf("ERROR: chdir security problem - rrdtool is runnig as "
+ printf("ERROR: chdir security problem - rrdtool is running as "
"root an no chroot!\n");
return(0);
}
#endif
chdir(argv[2]);
if (errno!=0){
"root an no chroot!\n");
return(0);
}
#endif
chdir(argv[2]);
if (errno!=0){
- printf("ERROR: %s\n",strerror(errno));
+ printf("ERROR: %s\n",rrd_strerror(errno));
}
return(0);
}
}
return(0);
}
}
#if ! defined(HAVE_CHROOT) || ! defined(HAVE_GETUID)
if (getuid()==0 && ! ChangeRoot){
}
#if ! defined(HAVE_CHROOT) || ! defined(HAVE_GETUID)
if (getuid()==0 && ! ChangeRoot){
- printf("ERROR: mkdir security problem - rrdtool is runnig as "
+ printf("ERROR: mkdir security problem - rrdtool is running as "
"root an no chroot!\n");
return(0);
}
#endif
mkdir(argv[2],0777);
if (errno!=0){
"root an no chroot!\n");
return(0);
}
#endif
mkdir(argv[2],0777);
if (errno!=0){
- printf("ERROR: %s\n",strerror(errno));
+ printf("ERROR: %s\n",rrd_strerror(errno));
}
return(0);
}
}
return(0);
}
}
}
else{
}
}
else{
- printf("ERROR: %s\n",strerror(errno));
+ printf("ERROR: %s\n",rrd_strerror(errno));
return(errno);
}
return(0);
return(errno);
}
return(0);
rrd_create(argc-1, &argv[1]);
else if (strcmp("dump", argv[1]) == 0)
rrd_dump(argc-1, &argv[1]);
rrd_create(argc-1, &argv[1]);
else if (strcmp("dump", argv[1]) == 0)
rrd_dump(argc-1, &argv[1]);
- else if (strcmp("info", argv[1]) == 0){
+ else if (strcmp("info", argv[1]) == 0
+ || strcmp("updatev", argv[1]) == 0){
info_t *data,*save;
info_t *data,*save;
- data=rrd_info(argc-1, &argv[1]);
+ if (strcmp("info",argv[1]) == 0)
+ data=rrd_info(argc-1, &argv[1]);
+ else
+ data=rrd_update_v(argc-1, &argv[1]);
while (data) {
save=data;
printf ("%s = ", data->key);
while (data) {
save=data;
printf ("%s = ", data->key);
case RD_I_CNT:
printf ("%lu", data->value.u_cnt);
break;
case RD_I_CNT:
printf ("%lu", data->value.u_cnt);
break;
+ case RD_I_INT:
+ printf ("%d", data->value.u_int);
+ break;
case RD_I_STR:
printf ("\"%s\"", data->value.u_str);
free(data->value.u_str);
case RD_I_STR:
printf ("\"%s\"", data->value.u_str);
free(data->value.u_str);
strcmp("v", argv[1]) == 0 ||
strcmp("-v", argv[1]) == 0 ||
strcmp("-version", argv[1]) == 0 )
strcmp("v", argv[1]) == 0 ||
strcmp("-v", argv[1]) == 0 ||
strcmp("-version", argv[1]) == 0 )
- printf("RRDtool 1.1.x Copyright (C) 1997-2003 by Tobias Oetiker <tobi@oetiker.ch>\n");
+ printf("RRDtool 1.1.x Copyright (C) 1997-2004 by Tobias Oetiker <tobi@oetiker.ch>\n");
else if (strcmp("restore", argv[1]) == 0)
rrd_restore(argc-1, &argv[1]);
else if (strcmp("resize", argv[1]) == 0)
rrd_resize(argc-1, &argv[1]);
else if (strcmp("last", argv[1]) == 0)
else if (strcmp("restore", argv[1]) == 0)
rrd_restore(argc-1, &argv[1]);
else if (strcmp("resize", argv[1]) == 0)
rrd_resize(argc-1, &argv[1]);
else if (strcmp("last", argv[1]) == 0)
- printf("%ld\n",rrd_last(argc-1, &argv[1]));
+ printf("%ld\n",rrd_last(argc-1, argv[1]));
else if (strcmp("update", argv[1]) == 0)
rrd_update(argc-1, &argv[1]);
else if (strcmp("fetch", argv[1]) == 0) {
else if (strcmp("update", argv[1]) == 0)
rrd_update(argc-1, &argv[1]);
else if (strcmp("fetch", argv[1]) == 0) {
datai=data;
printf(" ");
for (i = 0; i<ds_cnt;i++)
datai=data;
printf(" ");
for (i = 0; i<ds_cnt;i++)
- printf("%14s",ds_namv[i]);
+ printf("%20s",ds_namv[i]);
printf ("\n\n");
for (ti = start+step; ti <= end; ti += step){
printf("%10lu:", ti);
printf ("\n\n");
for (ti = start+step; ti <= end; ti += step){
printf("%10lu:", ti);
}
else if (strcmp("graph", argv[1]) == 0) {
char **calcpr;
}
else if (strcmp("graph", argv[1]) == 0) {
char **calcpr;
+#ifdef notused /*XXX*/
const char *imgfile = argv[2]; /* rrd_graph changes argv pointer */
const char *imgfile = argv[2]; /* rrd_graph changes argv pointer */
+#endif
int xsize, ysize;
int i;
int tostdout = (strcmp(argv[2],"-") == 0);
int xsize, ysize;
int i;
int tostdout = (strcmp(argv[2],"-") == 0);
- if( rrd_graph(argc-1, &argv[1], &calcpr, &xsize, &ysize) != -1 ) {
+ if( rrd_graph(argc-1, &argv[1], &calcpr, &xsize, &ysize, NULL) != -1 ) {
if (!tostdout)
printf ("%dx%d\n",xsize,ysize);
if (calcpr) {
if (!tostdout)
printf ("%dx%d\n",xsize,ysize);
if (calcpr) {