rnagios 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/rnagios/plugin.rb +6 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ccc2b6228857341c8852cbd7fae32795c2456a96
|
4
|
+
data.tar.gz: 57cc3cbe0a9d47aefb9f12d614bd33db10c18d78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cbbcd31d3f14a7fe2391b48c82519af9ade376dac30693b3b6dd5d9519dc5d50297c9cfd98a818069ce72acf0c75033aabdaf93e8deadb7caaddef892976e0c1
|
7
|
+
data.tar.gz: 93747faba10d44d4ff00c25024e1b687bbee621568dca3ad4c245a13f8ef0948450a2125247d27b97cd7b1849efbac490b71978a49b9b277884f5606a424323c
|
data/README.md
CHANGED
@@ -33,3 +33,5 @@ be parsed in the check method before the measure method is called.
|
|
33
33
|
measure() can then use the @config attribute to access configuration
|
34
34
|
parameters. The configuration file is expected to be in the same
|
35
35
|
directory as the plugin.
|
36
|
+
|
37
|
+
[How to use RNagios](https://github.com/Snapman/rnagios/wiki/RNagios)
|
data/lib/rnagios/plugin.rb
CHANGED
@@ -146,7 +146,11 @@ class Plugin
|
|
146
146
|
|
147
147
|
# If there is a config file, load it
|
148
148
|
if !blank? @config_file
|
149
|
-
|
149
|
+
begin
|
150
|
+
@config = YAML.load_file(@config_file)
|
151
|
+
rescue Psych::SyntaxError => e
|
152
|
+
raise NagiosError.new('Error occurred while trying to parse YAML config file; please verify that config file is valid YAML')
|
153
|
+
end
|
150
154
|
end
|
151
155
|
|
152
156
|
# measure() is where the magic happens. measure() should
|
@@ -271,16 +275,13 @@ private
|
|
271
275
|
# NSCA check results are different from active check results
|
272
276
|
# [<timestamp>] PROCESS_SERVICE_CHECK_RESULT;<host_name>;<svc_description>;<return_code>;<plugin_output>
|
273
277
|
def format_passive_service_check(status)
|
274
|
-
#'[' + Time.now.to_i.to_s + '] PROCESS_SERVICE_CHECK_RESULT;' + @host + ';' + @name + ';' + status.passive_code.to_s + ';' + status.message
|
275
|
-
#"[#{Time.now.to_i}] PROCESS_SERVICE_CHECK_RESULT;#{@host};#{@name};#{status.passive_code};#{status.message}"
|
276
278
|
"#{@host}\t#{@name}\t#{status.passive_code}\t#{status.message}"
|
277
279
|
end
|
278
280
|
|
279
281
|
# NSCA check results are different from active check results
|
280
282
|
# [<timestamp>] PROCESS_HOST_CHECK_RESULT;<host_name>;<host_status>;<plugin_output>
|
281
283
|
def format_passive_host_check(status)
|
282
|
-
#
|
283
|
-
"#{@host}\t#{status.passive_code.to_s}\t#{status.message}"
|
284
|
+
"#{@host}\t#{status.passive_code}\t#{status.message}"
|
284
285
|
end
|
285
286
|
|
286
287
|
def valid?(status)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rnagios
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roger A. Rubio
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Make your own plugins in Ruby for Nagios to run on the Nagios server
|
14
14
|
or as NSCA plugins on remote servers.
|