nagi 0.2.1 → 0.2.2
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.
- data/NEWS +3 -0
- data/README.md +5 -5
- data/lib/nagi/utility.rb +3 -3
- data/lib/nagi/version.rb +1 -1
- data/spec/nagi/utility_spec.rb +2 -2
- metadata +7 -7
data/NEWS
CHANGED
data/README.md
CHANGED
|
@@ -140,11 +140,11 @@ Nagi do
|
|
|
140
140
|
collect :all
|
|
141
141
|
|
|
142
142
|
check do |args|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
143
|
+
begin
|
|
144
|
+
output = execute 'df'
|
|
145
|
+
rescue StandardError => e
|
|
146
|
+
critical "df failed: #{e.message}", true
|
|
147
|
+
end
|
|
148
148
|
output.lines.each do |line|
|
|
149
149
|
if line =~ /^.*?(\d+)%\s*(.*)$/
|
|
150
150
|
if $1.to_i > args[:percentage].to_i
|
data/lib/nagi/utility.rb
CHANGED
|
@@ -3,11 +3,11 @@ module Nagi
|
|
|
3
3
|
module_function
|
|
4
4
|
|
|
5
5
|
def execute(command)
|
|
6
|
-
command = command.gsub(/
|
|
6
|
+
command = command.gsub(/"/, '\\"')
|
|
7
7
|
if defined?(Open3.capture2)
|
|
8
|
-
output, status = Open3.capture2e("/bin/bash -o pipefail -c
|
|
8
|
+
output, status = Open3.capture2e("/bin/bash -o pipefail -c \"#{command}\"")
|
|
9
9
|
else
|
|
10
|
-
IO.popen("/bin/bash -o pipefail -c
|
|
10
|
+
IO.popen("/bin/bash -o pipefail -c \"#{command}\" 2>&1") do |io|
|
|
11
11
|
output = io.read
|
|
12
12
|
end
|
|
13
13
|
status = $?
|
data/lib/nagi/version.rb
CHANGED
data/spec/nagi/utility_spec.rb
CHANGED
|
@@ -2,8 +2,8 @@ require 'spec_helper'
|
|
|
2
2
|
|
|
3
3
|
describe 'Nagi::Utility::execute' do
|
|
4
4
|
it 'handles special characters correctly' do
|
|
5
|
-
Nagi::Utility.execute("echo 'x'").should eq 'x'
|
|
6
|
-
Nagi::Utility.execute('echo "y"').should eq 'y'
|
|
5
|
+
Nagi::Utility.execute("echo 'x y z'").should eq 'x y z'
|
|
6
|
+
Nagi::Utility.execute('echo "x y z"').should eq 'x y z'
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
it 'raises exception on non-zero status' do
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: nagi
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.2
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,11 +9,11 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2012-
|
|
12
|
+
date: 2012-06-26 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rake
|
|
16
|
-
requirement: &
|
|
16
|
+
requirement: &70365699752920 !ruby/object:Gem::Requirement
|
|
17
17
|
none: false
|
|
18
18
|
requirements:
|
|
19
19
|
- - ! '>='
|
|
@@ -21,10 +21,10 @@ dependencies:
|
|
|
21
21
|
version: '0'
|
|
22
22
|
type: :development
|
|
23
23
|
prerelease: false
|
|
24
|
-
version_requirements: *
|
|
24
|
+
version_requirements: *70365699752920
|
|
25
25
|
- !ruby/object:Gem::Dependency
|
|
26
26
|
name: rspec
|
|
27
|
-
requirement: &
|
|
27
|
+
requirement: &70365699751780 !ruby/object:Gem::Requirement
|
|
28
28
|
none: false
|
|
29
29
|
requirements:
|
|
30
30
|
- - ! '>='
|
|
@@ -32,7 +32,7 @@ dependencies:
|
|
|
32
32
|
version: '0'
|
|
33
33
|
type: :development
|
|
34
34
|
prerelease: false
|
|
35
|
-
version_requirements: *
|
|
35
|
+
version_requirements: *70365699751780
|
|
36
36
|
description: A DSL for writing Nagios plugins
|
|
37
37
|
email:
|
|
38
38
|
- erik@bengler.no
|
|
@@ -79,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
79
79
|
version: '0'
|
|
80
80
|
requirements: []
|
|
81
81
|
rubyforge_project:
|
|
82
|
-
rubygems_version: 1.8.
|
|
82
|
+
rubygems_version: 1.8.10
|
|
83
83
|
signing_key:
|
|
84
84
|
specification_version: 3
|
|
85
85
|
summary: A DSL for writing Nagios plugins
|