circonus 1.0.12 → 1.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/composite_builder.rb +7 -6
- metadata +1 -1
data/bin/composite_builder.rb
CHANGED
@@ -54,7 +54,7 @@ OptionParser.new { |opts|
|
|
54
54
|
options[:consolidation] = 'sum'
|
55
55
|
end
|
56
56
|
opts.on( '--type TYPE',"Check bundle type" ) do |t|
|
57
|
-
options[:
|
57
|
+
options[:checkbundletype] = t
|
58
58
|
end
|
59
59
|
opts.on( '--metric METRICNAME',"Metric name" ) do |m|
|
60
60
|
options[:metric] = m
|
@@ -62,12 +62,13 @@ OptionParser.new { |opts|
|
|
62
62
|
opts.on( '-t','--tags TAGLIST',"Use comma separated list of tags for searching (takes the union)" ) do |t|
|
63
63
|
options[:tags] += t.split(/,/).sort.uniq
|
64
64
|
# these batch of tags provide information for other automation tools to keep the formulas up to date:
|
65
|
-
options[:automation_tags] << "type:#{options[:type]}"
|
66
|
-
options[:automation_tags] << "datatype:#{options[:datatype]}"
|
67
|
-
options[:automation_tags] << "consolidation:#{options[:consolidation]}"
|
68
65
|
end
|
69
66
|
}.parse!
|
70
67
|
|
68
|
+
options[:automation_tags] << "datatype:#{options[:datatype]}"
|
69
|
+
options[:automation_tags] << "type:#{options[:checkbundletype]}"
|
70
|
+
options[:automation_tags] << "consolidation:#{options[:consolidation]}"
|
71
|
+
|
71
72
|
def usage()
|
72
73
|
print <<EOF
|
73
74
|
Usage: #{File.basename($0)} -t tag1,tag2,... --type CHECKBUNDLETYPE
|
@@ -83,7 +84,7 @@ EOF
|
|
83
84
|
end
|
84
85
|
|
85
86
|
raise "No tags given" unless options[:tags].any?
|
86
|
-
raise "No type given" unless options[:
|
87
|
+
raise "No type given" unless options[:checkbundletype]
|
87
88
|
@c = Circonus.new(@apitoken,@appname,@agent)
|
88
89
|
|
89
90
|
# the agent that will do composites for us:
|
@@ -93,7 +94,7 @@ agentid = @c.list_broker({'_name'=>'composite'}).first['_cid']
|
|
93
94
|
@cached_list_check_bundle = @c.list_check_bundle
|
94
95
|
|
95
96
|
# checkbundles matching what we want:
|
96
|
-
checkbundles = @cached_list_check_bundle.select { |s| ((s['tags'].sort.uniq & options[:tags]) == options[:tags]) and (s['type'] == options[:
|
97
|
+
checkbundles = @cached_list_check_bundle.select { |s| ((s['tags'].sort.uniq & options[:tags]) == options[:tags]) and (s['type'] == options[:checkbundletype]) }
|
97
98
|
|
98
99
|
# unique metric names:
|
99
100
|
metrics = checkbundles.map { |m| m['metrics'].map { |mn| mn['name'] } }.flatten.sort.uniq
|