icinga_api 0.0.4 → 0.1.0
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.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/icinga_api.rb +12 -1
- data/lib/icinga_api/host_group.rb +6 -5
- data/lib/icinga_api/service.rb +6 -0
- data/lib/icinga_api/version.rb +1 -1
- 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: 006df691e36dc1330584c94373de408840fb2557
|
4
|
+
data.tar.gz: 131c64c3ca233e538a89108c327e6cabe7210b06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c8c9a4083ac7635c811db25384bbc8dae714cddf41306f43109c7eed43ffbaea6249a684f8ce1d3884ca47608106f8bc05178406974d418c20d9ad410e7d725
|
7
|
+
data.tar.gz: ec57997cdb40a367909be6819d267171a272a860631ce4a0089684fa623eda0c1a004000c5ddb26430782f117124100ffd4fb79a386eec8fc870ce9df3dc9ddd
|
data/README.md
CHANGED
@@ -92,7 +92,7 @@ hosts = icinga.hosts(IcingaApi::Host::F_DOWN & IcingaApi::Host::F_NACK)
|
|
92
92
|
|
93
93
|
# or with manually defined filters:
|
94
94
|
filter_host_down = IcingaApi::Filter.new('HOST_CURRENT_STATE', '=', 1)
|
95
|
-
filter_host_not_ack = IcingaApi::Filter.new('
|
95
|
+
filter_host_not_ack = IcingaApi::Filter.new('HOST_PROBLEM_HAS_BEEN_ACKNOWLEDGED', '=', 0)
|
96
96
|
hosts = icinga.hosts(filter_host_down & filter_host_not_ack)
|
97
97
|
```
|
98
98
|
|
data/lib/icinga_api.rb
CHANGED
@@ -43,6 +43,17 @@ class IcingaApi
|
|
43
43
|
|
44
44
|
|
45
45
|
def host_groups(filter)
|
46
|
-
|
46
|
+
rc = Request::request(self, HostGroup::TARGET, filter, [:HOSTGROUP_NAME])
|
47
|
+
rc[:result].map do |hostgroup_hash|
|
48
|
+
HostGroup.new(self, hostgroup_hash[:HOSTGROUP_NAME])
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
def services(filter)
|
54
|
+
rc = Request::request(self, Service::TARGET, filter, [:HOST_NAME, :SERVICE_NAME])
|
55
|
+
rc[:result].map do |service_hash|
|
56
|
+
Service.new(self, Host.new(self, service_hash[:HOST_NAME]), service_hash[:SERVICE_NAME])
|
57
|
+
end
|
47
58
|
end
|
48
59
|
end
|
@@ -45,11 +45,7 @@ class IcingaApi
|
|
45
45
|
|
46
46
|
|
47
47
|
def hosts(filter=nil)
|
48
|
-
filter
|
49
|
-
rc = request(Host::TARGET, filter, [:HOST_NAME])
|
50
|
-
rc[:result].map do |host_hash|
|
51
|
-
Host.new(@connection, host_hash[:HOST_NAME])
|
52
|
-
end
|
48
|
+
@connection.hosts(filter ? (@host_group_filter & filter) : @host_group_filter)
|
53
49
|
end
|
54
50
|
|
55
51
|
|
@@ -63,6 +59,11 @@ class IcingaApi
|
|
63
59
|
end
|
64
60
|
|
65
61
|
|
62
|
+
def services(filter=nil)
|
63
|
+
@connection.services(filter ? (@host_group_filter & filter) : @host_group_filter)
|
64
|
+
end
|
65
|
+
|
66
|
+
|
66
67
|
# TODO: implement further
|
67
68
|
end # of class HostGroup
|
68
69
|
end
|
data/lib/icinga_api/service.rb
CHANGED
@@ -3,6 +3,12 @@ class IcingaApi
|
|
3
3
|
TARGET = "service"
|
4
4
|
attr_reader :name, :service_filter
|
5
5
|
|
6
|
+
# some popular filter definitions
|
7
|
+
F_OK = Filter.new("SERVICE_CURRENT_STATE", "=", 0)
|
8
|
+
F_WARNING = Filter.new("SERVICE_CURRENT_STATE", "=", 1)
|
9
|
+
F_CRITICAL = Filter.new("SERVICE_CURRENT_STATE", "=", 2)
|
10
|
+
F_UNKNOWN = Filter.new("SERVICE_CURRENT_STATE", "=", 3)
|
11
|
+
|
6
12
|
CHECKS = {
|
7
13
|
integer: %i(
|
8
14
|
SERVICE_ID
|
data/lib/icinga_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: icinga_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lothar Handl
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ipaddress
|