Skip to content
This repository
Browse code

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...
commit 7af36b2eb33ffc6bdffbc5668390b99d7d57ab0b 1 parent 2600ddb
Nick Satterly satterly authored

Showing 2 changed files with 7 additions and 2 deletions. Show diff stats Hide diff stats

  1. +1 1  gmetric/cmdline.c.in
  2. +6 1 gmetric/gmetric.c
2  gmetric/cmdline.c.in
@@ -42,7 +42,7 @@ const char *gengetopt_args_info_help[] = {
42 42 " -s, --slope=STRING Either zero|positive|negative|both (default=`both')",
43 43 " -x, --tmax=INT The maximum time in seconds between gmetric calls \n (default=`60')",
44 44 " -d, --dmax=INT The lifetime in seconds of this metric (default=`0')",
45   - " -g, --group=STRING Group of the metric",
  45 + " -g, --group=STRING Group(s) of the metric (comma-separated)",
46 46 " -C, --cluster=STRING Cluster of the metric",
47 47 " -D, --desc=STRING Description of the metric",
48 48 " -T, --title=STRING Title of the metric",
7 gmetric/gmetric.c
@@ -111,7 +111,12 @@ main( int argc, char *argv[] )
111 111 if(args_info.cluster_given)
112 112 Ganglia_metadata_add(gmetric, "CLUSTER", args_info.cluster_arg);
113 113 if(args_info.group_given)
114   - Ganglia_metadata_add(gmetric, "GROUP", args_info.group_arg);
  114 + {
  115 + char *last;
  116 + for (char *group = apr_strtok(args_info.group_arg, ", ", &last); group != NULL; group = apr_strtok(NULL, ", ", &last)) {
  117 + Ganglia_metadata_add(gmetric, "GROUP", group);
  118 + }
  119 + }
115 120 if(args_info.desc_given)
116 121 Ganglia_metadata_add(gmetric, "DESC", args_info.desc_arg);
117 122 if(args_info.title_given)

0 comments on commit 7af36b2

Please sign in to comment.
Something went wrong with that request. Please try again.