circonus 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,49 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'circonus'
5
+ require 'optparse'
6
+ require "#{ENV['HOME']}/.circonus.rb"
7
+
8
+ options = {}
9
+ options[:tags] = []
10
+ OptionParser.new { |opts|
11
+ opts.banner = "Usage: #{File.basename($0)} [-h] [-t tag1,tag2,...] [--type type] [--target target]\n"
12
+ opts.on( '-h', '--help', "This usage menu") do
13
+ puts opts
14
+ exit
15
+ end
16
+ opts.on( '-a','--attribute ATTRIBUTE',"attribute to print" ) do |a|
17
+ options[:attribute] = a
18
+ end
19
+ opts.on( '--type TYPE',"check bundle type" ) do |t|
20
+ options[:type] = t
21
+ end
22
+ opts.on( '-t','--tags TAGLIST',"Use comma separated list of tags for searching (takes the intersection)" ) do |t|
23
+ options[:tags] += t.split(/,/).sort.uniq
24
+ end
25
+ }.parse!
26
+
27
+ def usage()
28
+ print <<EOF
29
+ Usage: #{File.basename($0)} -t tag1,tag2,... [-a attribute]
30
+ -h,--help This usage menu
31
+ -t,--tags Comma separated list of tag names to use
32
+ --type Filter by check bundle type (e.g. nginx, statsd, apache, http, etc..)
33
+ --target Filter by target name
34
+ -a,--attribute attribute to print
35
+ EOF
36
+ end
37
+
38
+ @c = Circonus.new(@apitoken,@appname,@agent)
39
+ checkbundles = @c.list_check_bundle
40
+ checkbundles = checkbundles.select { |s| (s['tags'].sort.uniq & options[:tags]) == options[:tags] } if options[:tags].any?
41
+ checkbundles = checkbundles.select{ |s| s['type'] == options[:type] } if options[:type]
42
+ checkbundles = checkbundles.select{ |s| s['target'] == options[:target] } if options[:target]
43
+
44
+ if options[:attribute]
45
+ puts checkbundles.map { |m| m[options[:attribute]] }.join("\n")
46
+ else
47
+ pp checkbundles
48
+ end
49
+
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'circonus'
5
+ require 'optparse'
6
+ require "#{ENV['HOME']}/.circonus.rb"
7
+
8
+
9
+ options = {}
10
+ options[:tags] = []
11
+ OptionParser.new { |opts|
12
+ opts.banner = "Usage: #{File.basename($0)} [-h]\n"
13
+ opts.on( '-h', '--help', "This usage menu") do
14
+ puts opts
15
+ exit
16
+ end
17
+ }.parse!
18
+
19
+ def usage()
20
+ print <<EOF
21
+ Usage: #{File.basename($0)}
22
+ -h,--help This usage menu
23
+ EOF
24
+ end
25
+
26
+ @c = Circonus.new(@apitoken,@appname,@agent)
27
+ puts @c.list_check_bundle.map { |m| m['tags'] }.flatten.sort.uniq.join("\n")
28
+
@@ -89,7 +89,7 @@ metrics.each do |metric|
89
89
  "period"=>60,
90
90
  "status"=>"active",
91
91
  "tags"=>options[:tags],
92
- "target"=>"ouzo.edge",
92
+ "target"=>"composite",
93
93
  "timeout"=>10,
94
94
  "type"=>"composite"
95
95
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: circonus
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-07 00:00:00.000000000 Z
12
+ date: 2013-09-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client
@@ -69,7 +69,9 @@ extra_rdoc_files: []
69
69
  files:
70
70
  - lib/circonus.rb
71
71
  - lib/circonus/values.rb
72
+ - bin/circonus_list_checkbundle
72
73
  - bin/circonus-data-cli
74
+ - bin/circonus_list_tags
73
75
  - bin/circonus-cli
74
76
  - examples/add_dns_monitor.rb
75
77
  - examples/add_snmp_node.rb