senedsa 0.2.6 → 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/senedsa/cli.rb +3 -3
- data/lib/senedsa/send_nsca.rb +10 -3
- data/lib/senedsa/version.rb +1 -1
- metadata +2 -3
data/lib/senedsa/cli.rb
CHANGED
@@ -66,11 +66,11 @@ module Senedsa
|
|
66
66
|
opts.on('-d', '--debug', "Enable debug mode") { @cli_options[:debug] = true}
|
67
67
|
opts.on('-a', '--about', "Display #{ID} information") { output_message ABOUT, 0 }
|
68
68
|
opts.on('-V', '--version', "Display #{ID} version") { output_message VERSION, 0 }
|
69
|
-
opts.on_tail('--help', "Show this message") {
|
70
|
-
|
71
|
-
output_message opts, 0 if @arguments.size == 0
|
69
|
+
opts.on_tail('--help', "Show this message") { @cli_options[:HELP] = true }
|
72
70
|
|
73
71
|
opts.parse!(@arguments)
|
72
|
+
output_message opts, 0 if @arguments.size == 0 or @cli_options[:HELP]
|
73
|
+
|
74
74
|
rescue => e
|
75
75
|
output_message e.message, 1
|
76
76
|
end
|
data/lib/senedsa/send_nsca.rb
CHANGED
@@ -45,8 +45,6 @@ module Senedsa
|
|
45
45
|
cfg_options
|
46
46
|
end
|
47
47
|
|
48
|
-
attr_accessor :send_nsca, :nsca
|
49
|
-
|
50
48
|
class Error < StandardError; end
|
51
49
|
class SendNscaError < Error; end
|
52
50
|
class ConfigurationError < SendNscaError; end
|
@@ -90,6 +88,9 @@ module Senedsa
|
|
90
88
|
|
91
89
|
def send(*args)
|
92
90
|
|
91
|
+
svc_status = nil
|
92
|
+
svc_output = nil
|
93
|
+
|
93
94
|
case args.size
|
94
95
|
when 0
|
95
96
|
# svc_status and svc_output should be set on @options
|
@@ -104,6 +105,12 @@ module Senedsa
|
|
104
105
|
else
|
105
106
|
raise ArgumentError, "wrong number of arguments"
|
106
107
|
end
|
108
|
+
@options.each_key do |option|
|
109
|
+
next if [:send_nsca_config, :svc_status, :svc_output].include? option
|
110
|
+
raise ArgumentError, "missing send_nsca option #{option}" if @options[option].nil?
|
111
|
+
end
|
112
|
+
raise ArgumentError, "missing send_nsca svc_status" if svc_status.nil?
|
113
|
+
raise ArgumentError, "missing send_nsca svc_output" if svc_output.nil?
|
107
114
|
run svc_status, svc_output
|
108
115
|
end
|
109
116
|
|
@@ -124,7 +131,7 @@ module Senedsa
|
|
124
131
|
c
|
125
132
|
end
|
126
133
|
|
127
|
-
def run(
|
134
|
+
def run(svc_status,svc_output)
|
128
135
|
begin
|
129
136
|
Open3.popen3(command) do |stdin, stdout, stderr, wait_thr|
|
130
137
|
payload = "%s" % [svc_hostname,svc_descr,STATUS[svc_status],svc_output].join(send_nsca_delim)
|
data/lib/senedsa/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: senedsa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.8
|
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: 2012-
|
12
|
+
date: 2012-07-09 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Senedsa is a small utility and library wrapper for the Nagios send_nsca.
|
15
15
|
email: gerir@evernote.com
|
@@ -52,4 +52,3 @@ signing_key:
|
|
52
52
|
specification_version: 3
|
53
53
|
summary: Utility and library wrapper for Nagios send_nsca utility
|
54
54
|
test_files: []
|
55
|
-
has_rdoc:
|