icinga-rest 0.1.0 → 0.1.1
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/Gemfile +1 -0
- data/Gemfile.lock +2 -0
- data/Rakefile +2 -1
- data/Readme.markdown +0 -4
- data/lib/icinga_rest.rb +2 -0
- data/lib/icinga_rest/request.rb +6 -8
- metadata +21 -7
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
data/Rakefile
CHANGED
@@ -29,7 +29,7 @@ spec = Gem::Specification.new do |s|
|
|
29
29
|
|
30
30
|
# Change these as appropriate
|
31
31
|
s.name = "icinga-rest"
|
32
|
-
s.version = "0.1.
|
32
|
+
s.version = "0.1.1"
|
33
33
|
s.summary = "Simple, basic access to the Icinga REST API"
|
34
34
|
s.author = "David Salgado"
|
35
35
|
s.email = "david@digitalronin.com"
|
@@ -49,6 +49,7 @@ spec = Gem::Specification.new do |s|
|
|
49
49
|
# If you want to depend on other gems, add them here, along with any
|
50
50
|
# relevant versions
|
51
51
|
s.add_dependency("json")
|
52
|
+
s.add_dependency("addressable")
|
52
53
|
|
53
54
|
# If your tests use any gems, include them here
|
54
55
|
s.add_development_dependency("rspec")
|
data/Readme.markdown
CHANGED
@@ -28,10 +28,6 @@ Requirements
|
|
28
28
|
|
29
29
|
You must have enabled the REST API on your Icinga server (and configured the hosts and services to be monitored, of course)
|
30
30
|
|
31
|
-
Any box that runs this check will need the wget program in /usr/bin/wget
|
32
|
-
|
33
|
-
wget is used instead of a nice ruby http library because the URLs to access the Icinga REST API are not valid http URLs, so all the libraries I tried barf on them. wget is more forgiving.
|
34
|
-
|
35
31
|
MIT License
|
36
32
|
===========
|
37
33
|
|
data/lib/icinga_rest.rb
CHANGED
data/lib/icinga_rest/request.rb
CHANGED
@@ -8,8 +8,6 @@ class IcingaRest::Request
|
|
8
8
|
:count_column, # count this column to produce the total
|
9
9
|
:output # json|xml
|
10
10
|
|
11
|
-
WGET = '/usr/bin/wget'
|
12
|
-
|
13
11
|
def initialize(params)
|
14
12
|
@host = params[:host]
|
15
13
|
@target = params[:target]
|
@@ -19,13 +17,13 @@ class IcingaRest::Request
|
|
19
17
|
@output = params[:output]
|
20
18
|
end
|
21
19
|
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
# So, we shell out to wget, which is more tolerant.
|
26
|
-
# Fugly, but functional.
|
20
|
+
# The standard URI library blows up with the malformed URLs
|
21
|
+
# required to access the Icinga REST API, but addressable
|
22
|
+
# works fine.
|
27
23
|
def get
|
28
|
-
|
24
|
+
uri = Addressable::URI.parse to_url
|
25
|
+
r = Net::HTTP.get_response uri.normalize
|
26
|
+
r.code == '200' ? r.body : ''
|
29
27
|
end
|
30
28
|
|
31
29
|
def to_url
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: icinga-rest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- David Salgado
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-10-
|
18
|
+
date: 2011-10-11 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: json
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
type: :runtime
|
33
33
|
version_requirements: *id001
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
|
-
name:
|
35
|
+
name: addressable
|
36
36
|
prerelease: false
|
37
37
|
requirement: &id002 !ruby/object:Gem::Requirement
|
38
38
|
none: false
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
segments:
|
44
44
|
- 0
|
45
45
|
version: "0"
|
46
|
-
type: :
|
46
|
+
type: :runtime
|
47
47
|
version_requirements: *id002
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
|
-
name:
|
49
|
+
name: rspec
|
50
50
|
prerelease: false
|
51
51
|
requirement: &id003 !ruby/object:Gem::Requirement
|
52
52
|
none: false
|
@@ -59,6 +59,20 @@ dependencies:
|
|
59
59
|
version: "0"
|
60
60
|
type: :development
|
61
61
|
version_requirements: *id003
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: ruby-debug
|
64
|
+
prerelease: false
|
65
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
hash: 3
|
71
|
+
segments:
|
72
|
+
- 0
|
73
|
+
version: "0"
|
74
|
+
type: :development
|
75
|
+
version_requirements: *id004
|
62
76
|
description: Use the Icinga REST API to count hosts with services in a given state
|
63
77
|
email: david@digitalronin.com
|
64
78
|
executables: []
|