sensu-cli 0.0.9 → 0.0.10
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.
- checksums.yaml +8 -8
- data/README.md +6 -0
- data/lib/sensu-cli/cli.rb +2 -0
- data/lib/sensu-cli/sensu.rb +8 -2
- data/lib/sensu-cli/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZjkwOGFmNTA0OWM4MzZhNThkNjE1NDkwYTZjMGNmNzY2YmYyOWQ3NA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MjRkNzBkMTQ0ZWRhNGVkNTRlN2Y5YWVhNjVlODViZmJmNzllMGFmNQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZWE3ZGZiODZhNzdhNTdhZmM3NjU4Zjk1YzRkNGQzNDZmNjQwMjcxNzE2OWZk
|
10
|
+
ZWE2ZWQzZmNkYTY0OTA5MjU5ODhlMTI4ZThmNDNkYmY2N2JiZWYyZGI1ZDk0
|
11
|
+
MWNhMzMyNTg3NGMzMzBjNWFjMjVkMGExYTMyZjMzOTg4NDc2NWI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NTQ3ZjMzMWEyZDliNDk0NGU2NzhiZWU0YjI4NjEzZGEyN2M1MTJjYTg3YTU1
|
14
|
+
ZDk1ODQ4M2ExZWE3ODg1ZjcwOGMwZTE3ZGJkMTVkOWIxMDJiNmQ5YmI3ODZj
|
15
|
+
Y2Y0YTUzMzBlOTZhMmI0ZTdkMGYzMmQyMTBhNzdkOTM2NjliN2Y=
|
data/README.md
CHANGED
@@ -49,6 +49,11 @@ user "some_user"
|
|
49
49
|
password "some_secret_password"
|
50
50
|
````
|
51
51
|
|
52
|
+
Expire Silenced Hosts/Checks
|
53
|
+
----------------------------
|
54
|
+
I added an expires option to `sensu silence` to be used like `sensu silence HOST -e 30` where `-e` denotes the number of minutes from now a host/checks silence should expire. This won't work by itself. We add a key to the silence stash with a time in the future. If you run [check-stashes](https://github.com/agent462/sensu-check-stashes) on your sensu-server it will check for expired stashes and delete them.
|
55
|
+
|
56
|
+
There is also a reason option `-r` available. Be nice and use it so your colleagues know what you're doing.
|
52
57
|
|
53
58
|
Examples
|
54
59
|
-----------
|
@@ -108,6 +113,7 @@ TODO
|
|
108
113
|
|
109
114
|
License and Author
|
110
115
|
==================
|
116
|
+
I'm releasing this under the MIT or Apache 2.0 license. You pick.
|
111
117
|
|
112
118
|
Author:: Bryan Brandau <agent462@gmail.com>
|
113
119
|
|
data/lib/sensu-cli/cli.rb
CHANGED
@@ -253,6 +253,7 @@ module SensuCli
|
|
253
253
|
opt :id, "The id of the check issued.", :short=>"i", :type => :integer
|
254
254
|
opt :limit, "The number of aggregates to return", :short => "l", :type => :string
|
255
255
|
opt :offset, "The number of aggregates to offset before returning", :short => "o", :type => :string
|
256
|
+
#opt :results, "Include the check results", :short => "r", :type => :boolean
|
256
257
|
end
|
257
258
|
Trollop::die :offset, "Offset depends on the limit option --limit ( -l )".color(:red) if p[:offset] && !p[:limit]
|
258
259
|
item = next_argv
|
@@ -271,6 +272,7 @@ module SensuCli
|
|
271
272
|
p = Trollop::options do
|
272
273
|
opt :check, "The check to silence (requires --client)", :short => 'k', :type => :string
|
273
274
|
opt :reason, "The reason this check/node is being silenced", :short => 'r', :type => :string
|
275
|
+
opt :expires, "The number of minutes the silenced event is valid (must use with check-stashes plugin)", :short => 'e', :type => :integer
|
274
276
|
end
|
275
277
|
command = next_argv
|
276
278
|
explode(opts) if command == nil
|
data/lib/sensu-cli/sensu.rb
CHANGED
@@ -56,7 +56,13 @@ module SensuCli
|
|
56
56
|
payload = {:client => cli[:fields][:client], :check => cli[:fields][:check]}.to_json
|
57
57
|
path = "/event/resolve"
|
58
58
|
when 'silence'
|
59
|
-
|
59
|
+
payload = {:timestamp => Time.now.to_i}
|
60
|
+
payload.merge!({:reason => cli[:fields][:reason]}) if cli[:fields][:reason]
|
61
|
+
if cli[:fields][:expires]
|
62
|
+
expires = Time.now.to_i + (cli[:fields][:expires] * 60)
|
63
|
+
payload.merge!({:expires => expires})
|
64
|
+
end
|
65
|
+
payload = payload.to_json
|
60
66
|
path = "/stashes/silence" << (cli[:fields][:client] ? "/#{cli[:fields][:client]}" : "") << (cli[:fields][:check] ? "/#{cli[:fields][:check]}" : "")
|
61
67
|
when 'aggregates'
|
62
68
|
path = "/aggregates" << (cli[:fields][:check] ? "/#{cli[:fields][:check]}" : "") << (cli[:fields][:id] ? "/#{cli[:fields][:id]}" : "")
|
@@ -89,7 +95,7 @@ module SensuCli
|
|
89
95
|
when 'Delete'
|
90
96
|
req = Net::HTTP::Delete.new(@api[:path])
|
91
97
|
when 'Post'
|
92
|
-
req = Net::HTTP::Post.new(@api[:path],initheader = {'Content-Type' =>'application/json'})
|
98
|
+
req = Net::HTTP::Post.new(@api[:path],initheader = {'Content-Type' => 'application/json'})
|
93
99
|
req.body = @api[:payload]
|
94
100
|
end
|
95
101
|
req.basic_auth(Config.user, Config.password) if Config.user && Config.password
|
data/lib/sensu-cli/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryan Brandau
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-05-
|
11
|
+
date: 2013-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rainbow
|