rnagios 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -0
  3. data/lib/rnagios/plugin.rb +6 -5
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d218dc592c0635556cca6e6a8d01d86410271812
4
- data.tar.gz: 574cce6c678b58ac64343d840b39f5b078fe759a
3
+ metadata.gz: ccc2b6228857341c8852cbd7fae32795c2456a96
4
+ data.tar.gz: 57cc3cbe0a9d47aefb9f12d614bd33db10c18d78
5
5
  SHA512:
6
- metadata.gz: 6ffc116c769c597c7575285eaf65bbe0223f1b38625d97ff48557621019155652c6359260bd15e8298a756a13e3f2d53b5fcc8dc4a83017cc512a8e62a61bdf8
7
- data.tar.gz: 83427ebbbebd7db2ce4054764660707f614a685aa847022dfc4406992e57bb79351967cf57fa7daa5c7f3669314e36e0ede5d83918ee9a0aa60269fe319ef63d
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)
@@ -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
- @config = YAML.load_file(@config_file)
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
- #'[' + Time.now.to_i.to_s + '] PROCESS_HOST_CHECK_RESULT;' + @host + ';' + status.passive_code.to_s + ';' + status.message
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.3
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-05 00:00:00.000000000 Z
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.