Permalink
Browse files

Add support for multiple metric groups to gmetric

This brings gmetric into line with Ganglia python modules which
already support comma-separated groups in metric descriptors.
  • Loading branch information...
1 parent 2600ddb commit 7af36b2eb33ffc6bdffbc5668390b99d7d57ab0b @satterly satterly committed Nov 27, 2012
Showing with 7 additions and 2 deletions.
  1. +1 −1 gmetric/cmdline.c.in
  2. +6 −1 gmetric/gmetric.c
View
@@ -42,7 +42,7 @@ const char *gengetopt_args_info_help[] = {
" -s, --slope=STRING Either zero|positive|negative|both (default=`both')",
" -x, --tmax=INT The maximum time in seconds between gmetric calls \n (default=`60')",
" -d, --dmax=INT The lifetime in seconds of this metric (default=`0')",
- " -g, --group=STRING Group of the metric",
+ " -g, --group=STRING Group(s) of the metric (comma-separated)",
" -C, --cluster=STRING Cluster of the metric",
" -D, --desc=STRING Description of the metric",
" -T, --title=STRING Title of the metric",
View
@@ -111,7 +111,12 @@ main( int argc, char *argv[] )
if(args_info.cluster_given)
Ganglia_metadata_add(gmetric, "CLUSTER", args_info.cluster_arg);
if(args_info.group_given)
- Ganglia_metadata_add(gmetric, "GROUP", args_info.group_arg);
+ {
+ char *last;
+ for (char *group = apr_strtok(args_info.group_arg, ", ", &last); group != NULL; group = apr_strtok(NULL, ", ", &last)) {
+ Ganglia_metadata_add(gmetric, "GROUP", group);
+ }
+ }
if(args_info.desc_given)
Ganglia_metadata_add(gmetric, "DESC", args_info.desc_arg);
if(args_info.title_given)

0 comments on commit 7af36b2

Please sign in to comment.