sensu-cli 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NjQ1MjA2M2I2N2M1NDQ5MGQ5ZjJiZTZmOTVlMzNjYmIyNzRjZWM3Mg==
4
+ MzQyZTY3YzM1OTNlNzM3NzdmMWQ4MzcxN2E0MWQxOWQ1MjRhYzM1Nw==
5
5
  data.tar.gz: !binary |-
6
- ZWE2ODk3Njg3YThlODFlZmU4ZjUwNzIyNTE3Y2ExZGM2Y2NkODg5Yw==
6
+ MzUyYzcwNjQ5MzA5MDE0ODIzYTFjZDdlODcxYTNkMDBlOTVhNDM3Ng==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ODM5YzRiNDBjODQxOTgxN2Y2NDgxYzgyNmMwZTAxYjZhMGYyMDA5ZGU4YTc1
10
- NDEzNWFlMzYwYmJiNGRmMjgxZDdkZDMxNWE2ZmJhODFmNTRjNmI5YmE3ZjE3
11
- NTgxYjU5NDE5Nzk5ZDZmMjBkN2M2OGQ2NmZiZTZlNWMxMzgzNmQ=
9
+ NzEzOTlhNjk3MjNlMmU1NjZkYTk2M2ZmZjg2OGNkOWQ5OTU1M2UxOTIwNDQy
10
+ MWM2NmY2MGNkZDgxNmNlN2ZmMTkyZjljNTFkN2NlNjcwZmI3MjVlNWVlODBh
11
+ YWVkOGMxNTI0N2JjYWU4OTdkMTg3Y2I4OGJmZjAyOGQzZWQ0MWI=
12
12
  data.tar.gz: !binary |-
13
- NGI1NTU0NGUyY2U0NWIwMTljMDZjM2YwZGJiMzM1NWI0ZjkxMTk3Y2ExNDg1
14
- Yjc3MjNhMmIyODIzMmY3MWQ0MWY2YmIzMzIxZDI5ZGNlMjljZDMxY2ZkZmU4
15
- NWE5YWRjNzI4MmE4YTIyZWU4NTAxMjdhZjg4MGRlZWFhMDQ3NDE=
13
+ ZWRjNjMwNGM3NDZmNTZkYTUyMGJkMDZlYTBkYWVjZmY4MzQ5M2Q5YmViZmU1
14
+ YmY0NGUzOGQ1ZjNhOTZiM2I5ZGQ4NTFkOWY4YzhiNjZkYjlhMDYyMzc5MGQw
15
+ NzYxZTE0NGQzZDZhNWZhZGUwMzdhMzJkOGIwZDViNjJlZDgzMDQ=
data/README.md CHANGED
@@ -30,12 +30,14 @@ Usage and Configuration
30
30
  -----------------------
31
31
  * gem install sensu-cli
32
32
 
33
- * There is one settings file for host, port and ssl that lives in your user directory ~/.sensu/settings.rb. You can alternatively place this in /etc/sensu/sensu-cli/settings.rb.
33
+ * There is one settings file for host, port, ssl, and HTTP timeout that lives in your user directory ~/.sensu/settings.rb. You can alternatively place this in /etc/sensu/sensu-cli/settings.rb.
34
34
 
35
35
  ````
36
36
  host "127.0.0.1"
37
37
  port "4567"
38
38
  ssl false
39
+ read_timeout 20
40
+ open_timeout 20
39
41
  ````
40
42
  This format was chosen so you can do some ENV magic via your profile and setting up an alias. For details see the [wiki](https://github.com/agent462/sensu-cli/wiki)
41
43
 
@@ -48,12 +50,14 @@ ssl false
48
50
  user "some_user"
49
51
  password "some_secret_password"
50
52
  ````
53
+ If `read_timeout` and `open_timeout` are not set, they default to 15 and
54
+ 5 seconds respectively.
51
55
 
52
56
  Expire Silenced Hosts/Checks
53
57
  ----------------------------
54
- I added an expires option to `sensu-cli silence` to be used like `sensu-cli 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.
58
+ I added an expires option to `sensu-cli silence` to be used like `sensu-cli 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
59
 
56
- There is also a reason option `-r` available. Be nice and use it so your colleagues know what you're doing.
60
+ There is also a reason option `-r` available. Be nice and use it so your colleagues know what you're doing.
57
61
 
58
62
  Examples
59
63
  -----------
@@ -106,12 +110,12 @@ sensu-cli resolve NODE CHECK
106
110
  Contributions
107
111
  -------------
108
112
  Please provide a pull request. I'm an ops guy, not a developer, so if you're submitting code cleanup, all I ask is that you explain the improvement so I can learn.
109
-
113
+
110
114
  TODO
111
115
  ----
112
116
  * cleanup the cli
113
117
  * Once complete api support is implemented I'll add other features like filtering or issuing a event.
114
-
118
+
115
119
  License and Author
116
120
  ==================
117
121
  I'm releasing this under the MIT or Apache 2.0 license. You pick.
data/lib/sensu-cli/api.rb CHANGED
@@ -7,8 +7,8 @@ module SensuCli
7
7
 
8
8
  def request(opts)
9
9
  http = Net::HTTP.new(opts[:host], opts[:port])
10
- http.read_timeout = 15
11
- http.open_timeout = 5
10
+ http.read_timeout = opts[:read_timeout]
11
+ http.open_timeout = opts[:open_timeout]
12
12
  if opts[:ssl]
13
13
  http.use_ssl = true
14
14
  http.verify_mode = OpenSSL::SSL::VERIFY_NONE
@@ -38,6 +38,8 @@ module SensuCli
38
38
  :port => Config.port,
39
39
  :ssl => Config.ssl || false,
40
40
  :user => Config.user || nil,
41
+ :read_timeout => Config.read_timeout || 15,
42
+ :open_timeout => Config.open_timeout || 5,
41
43
  :password => Config.password || nil
42
44
  }
43
45
  api = Api.new
@@ -56,9 +56,10 @@ module SensuCli
56
56
  end
57
57
 
58
58
  def silence(cli)
59
- payload = { :content => { :timestamp => Time.now.to_i } }
60
- payload.merge!({ :owner => cli[:fields][:owner] }) if cli[:fields][:owner]
61
- payload.merge!({ :reason => cli[:fields][:reason] }) if cli[:fields][:reason]
59
+ content = { :timestamp => Time.now.to_i }
60
+ content.merge!({ :owner => cli[:fields][:owner] }) if cli[:fields][:owner]
61
+ content.merge!({ :reason => cli[:fields][:reason] }) if cli[:fields][:reason]
62
+ payload = { :content => content }
62
63
  payload.merge!({ :expire => cli[:fields][:expire].to_i }) if cli[:fields][:expire]
63
64
  silence_path = 'silence'
64
65
  silence_path << "/#{cli[:fields][:client]}" if cli[:fields][:client]
@@ -1,3 +1,3 @@
1
1
  module SensuCli
2
- VERSION = '0.3.0'
2
+ VERSION = '0.3.1'
3
3
  end
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.3.0
4
+ version: 0.3.1
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-10-30 00:00:00.000000000 Z
11
+ date: 2013-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rainbow