sensu-plugins-graphite 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 95919766647d9a11674c461481f6bf721f6dd5c7
4
- data.tar.gz: 73c6e2979abaa4ff35f69b510000e96410921e6d
3
+ metadata.gz: 1c9b47b908225a034886cf53e05210d7364b74ad
4
+ data.tar.gz: 8519202e2e3a17afb71976483c3b828f67debd8e
5
5
  SHA512:
6
- metadata.gz: efcbdf877c3405cd8a7b98756581945f6d547b3c41942d61c1ea78dfe7deed82de5eb6dd1ade93d1745b371d981c69cba262ea4cf194a464870a74ebf769b227
7
- data.tar.gz: a75f1d56bb46334dcd4a32147f1644311b0ea78c43b832ac015eb86d76259c08b2a2587eac3f38a038c4959544f214a8eec27a2c0b4522247339c5ef112e0c65
6
+ metadata.gz: d62bfe5b3e8ef036e99441179c2791e85be02decfe1101424a6aec46cc7a0f26b80ab8808150e19a9d84686a0f170e56ff8df33b0babc909519a76a53e195d3e
7
+ data.tar.gz: 10875b3238b6744885485df857d6d137378e9a0adb5f96c0cc241af54dd22143215919d4a604e85889677754d0e19c45e4922bd8caa272753502ee7acfe7fbc6
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -4,6 +4,15 @@ This project adheres to [Semantic Versioning](http://semver.org/).
4
4
  This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
5
5
 
6
6
  ## [Unreleased]
7
+ - nothing
8
+
9
+ ## [0.0.7] - 2015-09-29
10
+ ### Added
11
+ - add -r option (Reverse the warning/crit scale (if value is less than instead of greater than)) to check-graphite-stats.rb
12
+
13
+ ### Changed
14
+ - The short command line option for 'Add an auth token to the HTTP request' is now -A, -a clashed with the proxy support
15
+ - Set socket's SSL mode only if using HTTPS
7
16
 
8
17
  ## [0.0.6] - 2015-08-27
9
18
  ### Added
@@ -13,7 +13,6 @@
13
13
  #
14
14
  # DEPENDENCIES:
15
15
  # gem: sensu-plugin
16
- # gem: openssl
17
16
  #
18
17
  # USAGE:
19
18
  # #YELLOW
@@ -14,7 +14,6 @@
14
14
  #
15
15
  # DEPENDENCIES:
16
16
  # gem: sensu-plugin
17
- # gem: openssl
18
17
  #
19
18
  # USAGE:
20
19
  # #YELLOW
@@ -79,6 +79,13 @@ class CheckGraphiteStat < Sensu::Plugin::Check::CLI
79
79
  boolean: true,
80
80
  default: false
81
81
 
82
+ option :reverse_scale,
83
+ short: '-r',
84
+ long: '--reverse-scale',
85
+ description: 'Reverse the warning/crit scale (if value is less than instead of greater than)',
86
+ boolean: true,
87
+ default: false
88
+
82
89
  def average(a)
83
90
  total = 0
84
91
  a.to_a.each { |i| total += i.to_f }
@@ -92,11 +99,18 @@ class CheckGraphiteStat < Sensu::Plugin::Check::CLI
92
99
  # #YELLOW
93
100
  unless datapoints.empty? # rubocop:disable UnlessElse
94
101
  avg = average(datapoints)
95
-
96
- if !config[:crit].nil? && avg > config[:crit]
97
- return [2, "#{metric['target']} is #{avg}"]
98
- elsif !config[:warn].nil? && avg > config[:warn]
99
- return [1, "#{metric['target']} is #{avg}"]
102
+ if config[:reverse_scale] == false
103
+ if !config[:crit].nil? && avg > config[:crit]
104
+ return [2, "#{metric['target']} is #{avg}"]
105
+ elsif !config[:warn].nil? && avg > config[:warn]
106
+ return [1, "#{metric['target']} is #{avg}"]
107
+ end
108
+ else
109
+ if !config[:crit].nil? && avg < config[:crit]
110
+ return [2, "#{metric['target']} is #{avg}"]
111
+ elsif !config[:warn].nil? && avg < config[:warn]
112
+ return [1, "#{metric['target']} is #{avg}"]
113
+ end
100
114
  end
101
115
  else
102
116
  return [3, "#{metric['target']} has no datapoints"] unless config[:unknown_ignore]
@@ -107,7 +121,7 @@ class CheckGraphiteStat < Sensu::Plugin::Check::CLI
107
121
  def run
108
122
  body =
109
123
  begin
110
- uri = URI("http://#{config[:host]}/render?format=json&target=#{config[:target]}&from=#{config[:period]}")
124
+ uri = URI.parse(URI.encode("http://#{config[:host]}/render?format=json&target=#{config[:target]}&from=#{config[:period]}"))
111
125
  res = Net::HTTP.get_response(uri)
112
126
  res.body
113
127
  rescue => e
@@ -26,7 +26,7 @@ class GraphiteEvent < Sensu::Handler
26
26
  uri = URI.parse(uri)
27
27
  req = Net::HTTP::Post.new(uri.path)
28
28
  sock = Net::HTTP.new(uri.host, uri.port)
29
- sock.use_ssl = true
29
+ sock.use_ssl = uri.scheme == 'https' ? true : false
30
30
  req.body = body
31
31
 
32
32
  req.basic_auth(uri.user, uri.password) if uri.user
@@ -63,7 +63,7 @@ module SensuPluginsGraphite
63
63
  auth: {
64
64
  description: 'Add an auth token to the HTTP request, in the form of "Name: Value",
65
65
  e.g. --auth yourapitokenvaluegoeshere',
66
- short: '-a TOKEN',
66
+ short: '-A TOKEN',
67
67
  long: '--auth TOKEN'
68
68
  },
69
69
 
@@ -2,7 +2,7 @@ module SensuPluginsGraphite
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- PATCH = 6
5
+ PATCH = 7
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-graphite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sensu Plugins and contributors
@@ -30,7 +30,7 @@ cert_chain:
30
30
  8sHuVruarogxxKPBzlL2is4EUb6oN/RdpGx2l4254+nyR+abg//Ed27Ym0PkB4lk
31
31
  HP0m8WSjZmFr109pE/sVsM5jtOCvogyujQOjNVGN4gz1wwPr
32
32
  -----END CERTIFICATE-----
33
- date: 2015-08-27 00:00:00.000000000 Z
33
+ date: 2015-09-29 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: array_stats
metadata.gz.sig CHANGED
Binary file