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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0153d5f474c808802e38b9c00130ccec7292bdfd
4
- data.tar.gz: 8a3c89757f2fa0a0edca40427109437aa8b1baa2
3
+ metadata.gz: 006df691e36dc1330584c94373de408840fb2557
4
+ data.tar.gz: 131c64c3ca233e538a89108c327e6cabe7210b06
5
5
  SHA512:
6
- metadata.gz: 9684ab8be64d04cc6588bbabf95f8214a0fee92ba4372faa49376b75ba3e95081d0a32757d3e70f207f0d642fb2af6919aa1656831dc5cadd7bb06a56ef26683
7
- data.tar.gz: 8dd51da1d9fc0de0d2f5ee7aaa9fdbc2a2aff7fc11eb0f246764043ca6bc8def942473fbacbbc8faf4282b8be0600f8b36f4e894723cd3fab8db04774f25b586
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('HOST_PROBLEM_HAS_BEEN_ACKNOWLEDGET', '=', 0)
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
 
@@ -43,6 +43,17 @@ class IcingaApi
43
43
 
44
44
 
45
45
  def host_groups(filter)
46
- # TODO
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 = filter ? (@host_group_filter & filter) : @host_group_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
@@ -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
@@ -1,3 +1,3 @@
1
1
  class IcingaApi
2
- VERSION = "0.0.4"
2
+ VERSION = "0.1.0"
3
3
  end
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
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-07 00:00:00.000000000 Z
11
+ date: 2014-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ipaddress