Permalink
Browse files

*** empty log message ***

  • Loading branch information...
1 parent 2873b19 commit 6ec7c3687e60d3e32f0b651ef319a4a21407d02e massie committed Jan 28, 2005
@@ -6,7 +6,7 @@ AM_CFLAGS = -I$(top_builddir)/lib -I$(top_builddir)/srclib/libmetrics/ -I$(top_b
sbin_PROGRAMS = gmond
# metric.h and dtd.h are for gmetad/gmetric for now....
-gmond_SOURCES = gmond.c cmdline.c cmdline.h dtd.h metric.h
+gmond_SOURCES = gmond.c cmdline.c cmdline.h dtd.h metric.h g25_config.c
man_MANS = gmond.conf.5
@@ -49,6 +49,7 @@ cmdline_parser_print_help (void)
printf(" -t, --default_config Print the default configuration to stdout and exit \n (default=off)\n");
printf(" -m, --metrics Print the list of metrics this gmond supports \n (default=off)\n");
printf(" -b, --bandwidth Calculate minimum bandwidth use for configuration \n (default=off)\n");
+ printf(" -r, --convert=STRING Convert a 2.5.x configuration file to the new 2.6 \n format\n");
}
@@ -81,6 +82,7 @@ cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_i
args_info->default_config_given = 0 ;
args_info->metrics_given = 0 ;
args_info->bandwidth_given = 0 ;
+ args_info->convert_given = 0 ;
#define clear_args() { \
args_info->conf_arg = gengetopt_strdup("/etc/gmond.conf") ;\
args_info->location_arg = gengetopt_strdup("0,0,0") ;\
@@ -89,6 +91,7 @@ cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_i
args_info->default_config_flag = 0;\
args_info->metrics_flag = 0;\
args_info->bandwidth_flag = 0;\
+ args_info->convert_arg = NULL; \
}
clear_args();
@@ -113,11 +116,12 @@ cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_i
{ "default_config", 0, NULL, 't' },
{ "metrics", 0, NULL, 'm' },
{ "bandwidth", 0, NULL, 'b' },
+ { "convert", 1, NULL, 'r' },
{ NULL, 0, NULL, 0 }
};
stop_char = 0;
- c = getopt_long (argc, argv, "hVc:l:d:ftmb", long_options, &option_index);
+ c = getopt_long (argc, argv, "hVc:l:d:ftmbr:", long_options, &option_index);
if (c == -1) break; /* Exit from `while (1)' loop. */
@@ -214,6 +218,17 @@ cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_i
args_info->bandwidth_flag = !(args_info->bandwidth_flag);
break;
+ case 'r': /* Convert a 2.5.x configuration file to the new 2.6 format. */
+ if (args_info->convert_given)
+ {
+ fprintf (stderr, "%s: `--convert' (`-r') option given more than once\n", CMDLINE_PARSER_PACKAGE);
+ clear_args ();
+ exit (EXIT_FAILURE);
+ }
+ args_info->convert_given = 1;
+ args_info->convert_arg = gengetopt_strdup (optarg);
+ break;
+
case 0: /* Long option with no short option */
@@ -31,6 +31,7 @@ struct gengetopt_args_info
int default_config_flag; /* Print the default configuration to stdout and exit (default=off). */
int metrics_flag; /* Print the list of metrics this gmond supports (default=off). */
int bandwidth_flag; /* Calculate minimum bandwidth use for configuration (default=off). */
+ char * convert_arg; /* Convert a 2.5.x configuration file to the new 2.6 format. */
int help_given ; /* Whether help was given. */
int version_given ; /* Whether version was given. */
@@ -41,6 +42,7 @@ struct gengetopt_args_info
int default_config_given ; /* Whether default_config was given. */
int metrics_given ; /* Whether metrics was given. */
int bandwidth_given ; /* Whether bandwidth was given. */
+ int convert_given ; /* Whether convert was given. */
} ;
@@ -13,6 +13,7 @@ option "foreground" f "Run in foreground (don't daemonize)" flag off
option "default_config" t "Print the default configuration to stdout and exit" flag off
option "metrics" m "Print the list of metrics this gmond supports" flag off
option "bandwidth" b "Calculate minimum bandwidth use for configuration" flag off
+option "convert" r "Convert a 2.5.x configuration file to the new 2.6 format" string no
#Usage (a little tutorial)
#
Oops, something went wrong.

0 comments on commit 6ec7c36

Please sign in to comment.