sensu-plugin 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/sensu-plugin.rb +1 -1
- data/lib/sensu-plugin/cli.rb +5 -1
- data/lib/sensu-plugin/metric/cli.rb +9 -4
- metadata +18 -4
data/lib/sensu-plugin.rb
CHANGED
data/lib/sensu-plugin/cli.rb
CHANGED
@@ -8,6 +8,11 @@ module Sensu
|
|
8
8
|
|
9
9
|
attr_accessor :argv
|
10
10
|
|
11
|
+
def initialize
|
12
|
+
super
|
13
|
+
self.argv = self.parse_options
|
14
|
+
end
|
15
|
+
|
11
16
|
# Implementing classes should override this to produce appropriate
|
12
17
|
# output for their handler.
|
13
18
|
|
@@ -48,7 +53,6 @@ module Sensu
|
|
48
53
|
at_exit do
|
49
54
|
begin
|
50
55
|
check = @@autorun.new
|
51
|
-
check.argv = check.parse_options
|
52
56
|
check.run
|
53
57
|
rescue SystemExit => e
|
54
58
|
exit e.status
|
@@ -8,7 +8,9 @@ module Sensu
|
|
8
8
|
|
9
9
|
class JSON < Sensu::Plugin::CLI
|
10
10
|
def output(obj=nil)
|
11
|
-
|
11
|
+
if obj.is_a?(String) || obj.is_a?(Exception)
|
12
|
+
puts obj.to_s
|
13
|
+
elsif obj.is_a?(Hash)
|
12
14
|
obj['timestamp'] ||= Time.now.to_i
|
13
15
|
puts ::JSON.generate(obj)
|
14
16
|
end
|
@@ -16,9 +18,12 @@ module Sensu
|
|
16
18
|
end
|
17
19
|
|
18
20
|
class Graphite < Sensu::Plugin::CLI
|
19
|
-
def output(
|
20
|
-
|
21
|
-
puts [
|
21
|
+
def output(*args)
|
22
|
+
if args[0].is_a?(Exception) || args[1].nil?
|
23
|
+
puts args[0].to_s
|
24
|
+
else
|
25
|
+
args[2] ||= Time.now.to_i
|
26
|
+
puts args[0..2].join("\t")
|
22
27
|
end
|
23
28
|
end
|
24
29
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 6
|
10
|
+
version: 0.1.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Decklin Foster
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date:
|
19
|
+
date: 2013-02-07 00:00:00 -08:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -49,6 +49,20 @@ dependencies:
|
|
49
49
|
version: 1.1.0
|
50
50
|
type: :runtime
|
51
51
|
version_requirements: *id002
|
52
|
+
- !ruby/object:Gem::Dependency
|
53
|
+
name: rake
|
54
|
+
prerelease: false
|
55
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
hash: 3
|
61
|
+
segments:
|
62
|
+
- 0
|
63
|
+
version: "0"
|
64
|
+
type: :development
|
65
|
+
version_requirements: *id003
|
52
66
|
description: Plugins and helper libraries for Sensu, a monitoring framework
|
53
67
|
email:
|
54
68
|
- decklin@red-bean.com
|