icinga2 0.7.0.1 → 0.8.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c177787de41957958f31e98143b45e04d0215718
4
- data.tar.gz: ca5ee207818c54b5622a4c8bd82b81331a4345c7
3
+ metadata.gz: b1b29d3023c00d7dd825a06538ff256158e19889
4
+ data.tar.gz: ad824b03bcf3036cf96982c94d0a8dd254d4ef10
5
5
  SHA512:
6
- metadata.gz: b231ee1147b7d6dbec8f3261dccdb50490f52df3264c3f167907f4f7c56d099ee9d42fd9a34c9085f4b512149f20137d5c464ad360d890b1c3e1565a3a5a495c
7
- data.tar.gz: 31e1bb01d9c1d1121234700b16fb2ce03d859ae46b61f58f42ca9893ab6cf11e1a352e73c9cfb11f538bc492cea4f62ae4fae58eb039a50301480b73895b39f8
6
+ metadata.gz: b2bf72e37122c2fca742d44256ea80e814acfeb6693da661499269de2bd695714c5058bb1a4eb04c6d3511a11116df058316a9418cf4e359d8c4628a9d63bd2c
7
+ data.tar.gz: fa52dd4ddb225f5d806e8b9cc2d103ab2e40f8715201d6e34ee630235be3f617b12d1dd840157651b6432430dfd0a4fbf5e410aa23df4094d1e3da0c4b54bbcc
data/README.md CHANGED
@@ -1,16 +1,24 @@
1
1
  # ruby-icinga2
2
2
 
3
- Small Ruby Class for the Icinga2 API
3
+ Ruby Class for the Icinga2 API
4
+
5
+
4
6
 
5
7
 
6
8
  ## Requirements
7
9
 
8
- gem install rest-client --no-rdoc --no-ri
9
- gem install json --no-rdoc --no-ri
10
+ * ruby version ~> 2.3
11
+ * rest-client ~> 2.0
12
+ * openssl ~> 2.0
13
+ * json ~> 2.1
14
+
15
+ ## install
16
+
17
+ gem install icinga2
10
18
 
11
19
  ## usage
12
20
 
13
- create an instance and get information about the Icinga2 Server
21
+ create an instance
14
22
 
15
23
  config = {
16
24
  :icinga => {
@@ -25,79 +33,87 @@ create an instance and get information about the Icinga2 Server
25
33
  }
26
34
  }
27
35
 
28
- i = Icinga::Client.new( config )
29
- puts i.application_data()
30
-
36
+ @icinga = Icinga::Client.new( config )
31
37
 
32
38
  ## Status
33
39
 
34
40
  supports the following API Calls:
35
41
 
36
- - [Users](doc/status.md)
37
- * application_data
38
- * cib_data
39
- * api_listener
40
-
41
42
  - [Users](doc/users.md)
42
- * add_user( params = {} )
43
- * delete_user( params = {} )
44
- * users( params = {} )
45
- * exists_user?( name )
43
+ * [add user](doc/users.md#add-user)
44
+ * [delete user](doc/users.md#delete-dser)
45
+ * [list users](doc/users.md#list-users)
46
+ * [check if user exists](doc/users.md#user-exists)
46
47
 
47
48
  - [Usergroups](doc/usergroups.md)
48
- * add_usergroup( params = {} )
49
- * delete_usergroup( params = {} )
50
- * usergroups( params = {} )
51
- * exists_usergroup?( name )
49
+ * [add usergroup](doc/usergroups.md#add-usergroup)
50
+ * [delete usergroup](doc/usergroups.md#delete-usergroup)
51
+ * [list usergroups](doc/usergroups.md#list-usergroups)
52
+ * [check if usergroup exists](doc/usergroups.md#usergroup-exists)
52
53
 
53
54
  - [Hosts](doc/hosts.md)
54
- * add_host( params = {} )
55
- * delete_host( params = {} )
56
- * hosts( params = {} )
57
- * exists_host?( name )
58
- * host_objects( params = {} )
59
- * host_problems
60
- * problem_hosts( max_items = 5 )
61
- * host_severity( host )
55
+ * [add host](doc/hosts.md#add-host)
56
+ * [delete host](doc/hosts.md#delete-host)
57
+ * [list hosts](doc/hosts.md#list-hosts)
58
+ * [check if host exists](doc/hosts.md#host-exists)
59
+ * [list host objects](doc/hosts.md#list-host-objects)
60
+ * [adjusted hosts state](doc/hosts.md#hosts-adjusted)
61
+ * [count of hosts with problems](doc/hosts.md#count-hosts-with-problems)
62
+ * [list of hosts with problems](doc/hosts.md#list-hosts-with-problems)
63
+ * [count of all hosts](doc/hosts.md#count-all-hosts)
64
+ * [count hosts with problems](doc/hosts.md#count-host-problems)
65
+ * calculate host severity (protected)
62
66
 
63
67
  - [Hostgroups](doc/hostgroups.md)
64
- * add_hostgroup(params = {})
65
- * delete_hostgroup(params = {})
66
- * hostgroups(params = {})
67
- * exists_hostgroup?(name)
68
+ * [add hostgroup](doc/hostgroups.md#add-usergroup)
69
+ * [delete hostgroup](doc/hostgroups.md#delete-usergroup)
70
+ * [list hostgroups](doc/hostgroups.md#list-usergroups)
71
+ * [check if hostgroup exists](doc/hostgroups.md#usergroup-exists)
68
72
 
69
73
  - [Services](doc/services.md)
70
- * add_services( host, services = {} )
71
- * unhandled_services( params = {} )
72
- * services( params = {} )
73
- * exists_service?( params = {} )
74
- * service_objects( params = {} )
75
- * service_problems
76
- * problem_services( max_items = 5 )
77
- * update_host( hash, host )
78
- * service_severity( service )
74
+ * [add service](doc/services.md#add-service) (**this function is not operable yet!**)
75
+ * [delete service](doc/services.md#delete-service) (**not yet implemented**)
76
+ * [add service](doc/services.md#add-service) (**this function is not operable yet!**)
77
+ * [list unhandled services](doc/services.md#unhandled-services) (**not yet implemented**)
78
+ * [list services](doc/services.md#list-services)
79
+ * [check if service exists](doc/services.md#service-exists)
80
+ * [list service objects](doc/services.md#list-service-objects)
81
+ * [adjusted service state](doc/services.md#services-adjusted)
82
+ * [count services with problems](doc/services.md#count-services-with-problems)
83
+ * [list of services with problems](doc/services.md#list-services-with-problems)
84
+ * [update host](doc/services.md#update-host) (**this function is not operable yet!**)
85
+ * [count of all services](doc/services.md#count-all-services)
86
+ * [count all services with handled problems](doc/services.md#count-all-services-handled)
87
+ * calculate service severity (protected)
79
88
 
80
89
  - [Servicegroups](doc/servicegroups.md)
81
- * add_servicegroup( params = {} )
82
- * delete_servicegroup( params = {} )
83
- * servicegroups( params = {} )
84
- * exists_servicegroup?( name )
90
+ * [add servicegroup](doc/servicegroups.md#add-servicegroup)
91
+ * [delete servicegroup](doc/servicegroups.md#delete-servicegroup)
92
+ * [list servicegroups](doc/servicegroups.md#list-servicegroup)
93
+ * [check if servicegroup exists](doc/servicegroups.md#servicegroup-exists)
85
94
 
86
95
  - [Downtimes](doc/downtimes.md)
87
- * add_downtime( params = {} )
88
- * downtimes( params = {} )
96
+ * [add downtime](doc/downtimes.md#add-downtime)
97
+ * [list downtimes](doc/downtimes.md#list-downtimes)
89
98
 
90
99
  - [Notifications](doc/notifications.md)
91
- * enable_host_notification( host )
92
- * disable_host_notification( host )
93
- * enable_service_notification( params = {} )
94
- * disable_service_notification( host )
95
- * enable_hostgroup_notification( group )
96
- * disable_hostgroup_notification( group )
97
- * notifications( params = {} )
98
- * host_notification( params = {} )
99
- * hostgroup_notification( params = {} )
100
- * service_notification( params = {} )
100
+ * [enable host notifications](doc/notifications.md#enable-host-notification)
101
+ * [disable host notifications](doc/notifications.md#disable-host-notification)
102
+ * [enable service notifications](doc/notifications.md#enable-service-notification)
103
+ * [disable service notifications](doc/notifications.md#disable-service-notification)
104
+ * [enable hostgroup notifications](doc/notifications.md#enable-hostgroup-notification)
105
+ * [disable hostgroup notifications](doc/notifications.md#disable-hostgroup-notification)
106
+ * [list all notifications](doc/notifications.md#list-notifications)
107
+ * host notification (protected)
108
+ * hostgroup notification (protected)
109
+ * service notification (protected)
110
+
111
+ - [Statistics](doc/statistics.md)
112
+ * [statistic data for latence and execution time](doc/statistics.md#stats-avg)
113
+ * [statistic data for interval data](doc/statistics.md#stats-interval)
114
+ * [statistic data for services](doc/statistics.md#stats-services)
115
+ * [statistic data for hosts](doc/statistics.md#stats-hosts)
116
+ * [queue statistics from the api](doc/statistics.md#stats-work-queue)
101
117
 
102
118
 
103
119
  ## create a own gem File
@@ -116,7 +132,6 @@ supports the following API Calls:
116
132
 
117
133
  ## test via CLI
118
134
 
119
- #$ export ICINGA_HOST=localhost ; export ICINGA_API_USER=root ; export ICINGA_API_PASSWORD=icinga
120
135
  #$ irb
121
136
  2.3.0 :001 > require 'icinga2'
122
137
  => true
@@ -79,7 +79,7 @@
79
79
  <dl>
80
80
  <dt>Defined in:</dt>
81
81
  <dd>lib/icinga2.rb<span class="defines">,<br />
82
- lib/icinga2/hosts.rb,<br /> lib/icinga2/tools.rb,<br /> lib/icinga2/users.rb,<br /> lib/icinga2/status.rb,<br /> lib/icinga2/network.rb,<br /> lib/icinga2/version.rb,<br /> lib/icinga2/converts.rb,<br /> lib/icinga2/services.rb,<br /> lib/icinga2/downtimes.rb,<br /> lib/icinga2/hostgroups.rb,<br /> lib/icinga2/usergroups.rb,<br /> lib/icinga2/notifications.rb,<br /> lib/icinga2/servicegroups.rb</span>
82
+ lib/icinga2/hosts.rb,<br /> lib/icinga2/tools.rb,<br /> lib/icinga2/users.rb,<br /> lib/icinga2/network.rb,<br /> lib/icinga2/version.rb,<br /> lib/icinga2/converts.rb,<br /> lib/icinga2/services.rb,<br /> lib/icinga2/downtimes.rb,<br /> lib/icinga2/hostgroups.rb,<br /> lib/icinga2/statistics.rb,<br /> lib/icinga2/usergroups.rb,<br /> lib/icinga2/notifications.rb,<br /> lib/icinga2/servicegroups.rb</span>
83
83
  </dd>
84
84
  </dl>
85
85
 
@@ -100,7 +100,7 @@
100
100
  <p class="children">
101
101
 
102
102
 
103
- <strong class="modules">Modules:</strong> <span class='object_link'><a href="Icinga2/Converts.html" title="Icinga2::Converts (module)">Converts</a></span>, <span class='object_link'><a href="Icinga2/Downtimes.html" title="Icinga2::Downtimes (module)">Downtimes</a></span>, <span class='object_link'><a href="Icinga2/Hostgroups.html" title="Icinga2::Hostgroups (module)">Hostgroups</a></span>, <span class='object_link'><a href="Icinga2/Hosts.html" title="Icinga2::Hosts (module)">Hosts</a></span>, <span class='object_link'><a href="Icinga2/Network.html" title="Icinga2::Network (module)">Network</a></span>, <span class='object_link'><a href="Icinga2/Notifications.html" title="Icinga2::Notifications (module)">Notifications</a></span>, <span class='object_link'><a href="Icinga2/Servicegroups.html" title="Icinga2::Servicegroups (module)">Servicegroups</a></span>, <span class='object_link'><a href="Icinga2/Services.html" title="Icinga2::Services (module)">Services</a></span>, <span class='object_link'><a href="Icinga2/Status.html" title="Icinga2::Status (module)">Status</a></span>, <span class='object_link'><a href="Icinga2/Tools.html" title="Icinga2::Tools (module)">Tools</a></span>, <span class='object_link'><a href="Icinga2/Usergroups.html" title="Icinga2::Usergroups (module)">Usergroups</a></span>, <span class='object_link'><a href="Icinga2/Users.html" title="Icinga2::Users (module)">Users</a></span>, <span class='object_link'><a href="Icinga2/Version.html" title="Icinga2::Version (module)">Version</a></span>
103
+ <strong class="modules">Modules:</strong> <span class='object_link'><a href="Icinga2/Converts.html" title="Icinga2::Converts (module)">Converts</a></span>, <span class='object_link'><a href="Icinga2/Downtimes.html" title="Icinga2::Downtimes (module)">Downtimes</a></span>, <span class='object_link'><a href="Icinga2/Hostgroups.html" title="Icinga2::Hostgroups (module)">Hostgroups</a></span>, <span class='object_link'><a href="Icinga2/Hosts.html" title="Icinga2::Hosts (module)">Hosts</a></span>, <span class='object_link'><a href="Icinga2/Network.html" title="Icinga2::Network (module)">Network</a></span>, <span class='object_link'><a href="Icinga2/Notifications.html" title="Icinga2::Notifications (module)">Notifications</a></span>, <span class='object_link'><a href="Icinga2/Servicegroups.html" title="Icinga2::Servicegroups (module)">Servicegroups</a></span>, <span class='object_link'><a href="Icinga2/Services.html" title="Icinga2::Services (module)">Services</a></span>, <span class='object_link'><a href="Icinga2/Statistics.html" title="Icinga2::Statistics (module)">Statistics</a></span>, <span class='object_link'><a href="Icinga2/Tools.html" title="Icinga2::Tools (module)">Tools</a></span>, <span class='object_link'><a href="Icinga2/Usergroups.html" title="Icinga2::Usergroups (module)">Usergroups</a></span>, <span class='object_link'><a href="Icinga2/Users.html" title="Icinga2::Users (module)">Users</a></span>, <span class='object_link'><a href="Icinga2/Version.html" title="Icinga2::Version (module)">Version</a></span>
104
104
 
105
105
 
106
106
 
@@ -128,6 +128,38 @@
128
128
  </dt>
129
129
  <dd><pre class="code"><span class='int'>1</span></pre></dd>
130
130
 
131
+ <dt id="HOSTS_CRITICAL-constant" class="">HOSTS_CRITICAL =
132
+ <div class="docstring">
133
+ <div class="discussion">
134
+
135
+ <p>static variable for hosts critical</p>
136
+
137
+
138
+ </div>
139
+ </div>
140
+ <div class="tags">
141
+
142
+
143
+ </div>
144
+ </dt>
145
+ <dd><pre class="code"><span class='int'>2</span></pre></dd>
146
+
147
+ <dt id="HOSTS_UNKNOWN-constant" class="">HOSTS_UNKNOWN =
148
+ <div class="docstring">
149
+ <div class="discussion">
150
+
151
+ <p>static variable for hosts unknown</p>
152
+
153
+
154
+ </div>
155
+ </div>
156
+ <div class="tags">
157
+
158
+
159
+ </div>
160
+ </dt>
161
+ <dd><pre class="code"><span class='int'>3</span></pre></dd>
162
+
131
163
  <dt id="SERVICE_STATE_WARNING-constant" class="">SERVICE_STATE_WARNING =
132
164
  <div class="docstring">
133
165
  <div class="discussion">
@@ -205,7 +237,7 @@
205
237
  </div>
206
238
 
207
239
  <div id="footer">
208
- Generated on Wed Jun 28 05:55:20 2017 by
240
+ Generated on Tue Aug 22 11:29:51 2017 by
209
241
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
210
242
  0.9.9 (ruby-2.3.4).
211
243
  </div>
@@ -234,7 +234,7 @@ href="https://stackoverflow.com/questions/917566/ruby-share-logger-instance-amon
234
234
 
235
235
  <span class='id identifier rubyid_logger'>logger</span> <span class='op'>=</span> <span class='const'>Logger</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='const'>STDOUT</span><span class='rparen'>)</span>
236
236
  <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_progname'>progname</span> <span class='op'>=</span> <span class='id identifier rubyid_classname'>classname</span>
237
- <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_level'>level</span> <span class='op'>=</span> <span class='const'>Logger</span><span class='op'>::</span><span class='const'>DEBUG</span>
237
+ <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_level'>level</span> <span class='op'>=</span> <span class='const'>Logger</span><span class='op'>::</span><span class='const'>UNKNOWN</span>
238
238
  <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_datetime_format'>datetime_format</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>%Y-%m-%d %H:%M:%S::%3N</span><span class='tstring_end'>&#39;</span></span>
239
239
  <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_formatter'>formatter</span> <span class='op'>=</span> <span class='id identifier rubyid_proc'>proc</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_severity'>severity</span><span class='comma'>,</span> <span class='id identifier rubyid_datetime'>datetime</span><span class='comma'>,</span> <span class='id identifier rubyid_progname'>progname</span><span class='comma'>,</span> <span class='id identifier rubyid_msg'>msg</span><span class='op'>|</span>
240
240
  <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>[</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_datetime'>datetime</span><span class='period'>.</span><span class='id identifier rubyid_strftime'>strftime</span><span class='lparen'>(</span> <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_datetime_format'>datetime_format</span> <span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>] </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_severity'>severity</span><span class='period'>.</span><span class='id identifier rubyid_ljust'>ljust</span><span class='lparen'>(</span><span class='int'>5</span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'> : </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_progname'>progname</span><span class='embexpr_end'>}</span><span class='tstring_content'> - </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_msg'>msg</span><span class='embexpr_end'>}</span><span class='tstring_content'>\n</span><span class='tstring_end'>&quot;</span></span>
@@ -318,7 +318,7 @@ href="https://stackoverflow.com/questions/917566/ruby-share-logger-instance-amon
318
318
  </div>
319
319
 
320
320
  <div id="footer">
321
- Generated on Wed Jun 28 05:55:20 2017 by
321
+ Generated on Tue Aug 22 11:29:51 2017 by
322
322
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
323
323
  0.9.9 (ruby-2.3.4).
324
324
  </div>
@@ -202,7 +202,7 @@
202
202
  </li>
203
203
 
204
204
  <li>
205
- <span class='object_link'><a href="Icinga2/Status.html" title="Icinga2::Status (module)">Status</a></span>
205
+ <span class='object_link'><a href="Icinga2/Statistics.html" title="Icinga2::Statistics (module)">Statistics</a></span>
206
206
 
207
207
  <small>(Icinga2)</small>
208
208
 
@@ -275,7 +275,7 @@
275
275
  </div>
276
276
 
277
277
  <div id="footer">
278
- Generated on Wed Jun 28 05:55:20 2017 by
278
+ Generated on Tue Aug 22 11:29:51 2017 by
279
279
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
280
280
  0.9.9 (ruby-2.3.4).
281
281
  </div>
@@ -43,7 +43,7 @@
43
43
 
44
44
  <ul id="full_list" class="class">
45
45
  <li id="object_" class="odd"><div class="item" style="padding-left:30px"><span class='object_link'><a href="top-level-namespace.html" title="Top Level Namespace (root)">Top Level Namespace</a></span></div></li>
46
- <li id='object_Icinga2' class='even'><div class='item' style='padding-left:30px'><a class='toggle'></a> <span class='object_link'><a href="Icinga2.html" title="Icinga2 (module)">Icinga2</a></span><small class='search_info'>Top Level Namespace</small></div><ul><li id='object_Icinga2::Client' class='collapsed odd'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Icinga2/Client.html" title="Icinga2::Client (class)">Client</a></span> &lt; Object<small class='search_info'>Icinga2</small></div></li><li id='object_Icinga2::Converts' class='collapsed even'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Icinga2/Converts.html" title="Icinga2::Converts (module)">Converts</a></span><small class='search_info'>Icinga2</small></div></li><li id='object_Icinga2::Downtimes' class='collapsed odd'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Icinga2/Downtimes.html" title="Icinga2::Downtimes (module)">Downtimes</a></span><small class='search_info'>Icinga2</small></div></li><li id='object_Icinga2::Hostgroups' class='collapsed even'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Icinga2/Hostgroups.html" title="Icinga2::Hostgroups (module)">Hostgroups</a></span><small class='search_info'>Icinga2</small></div></li><li id='object_Icinga2::Hosts' class='collapsed odd'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Icinga2/Hosts.html" title="Icinga2::Hosts (module)">Hosts</a></span><small class='search_info'>Icinga2</small></div></li><li id='object_Icinga2::Network' class='collapsed even'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Icinga2/Network.html" title="Icinga2::Network (module)">Network</a></span><small class='search_info'>Icinga2</small></div></li><li id='object_Icinga2::Notifications' class='collapsed odd'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Icinga2/Notifications.html" title="Icinga2::Notifications (module)">Notifications</a></span><small class='search_info'>Icinga2</small></div></li><li id='object_Icinga2::Servicegroups' class='collapsed even'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Icinga2/Servicegroups.html" title="Icinga2::Servicegroups (module)">Servicegroups</a></span><small class='search_info'>Icinga2</small></div></li><li id='object_Icinga2::Services' class='collapsed odd'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Icinga2/Services.html" title="Icinga2::Services (module)">Services</a></span><small class='search_info'>Icinga2</small></div></li><li id='object_Icinga2::Status' class='collapsed even'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Icinga2/Status.html" title="Icinga2::Status (module)">Status</a></span><small class='search_info'>Icinga2</small></div></li><li id='object_Icinga2::Tools' class='collapsed odd'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Icinga2/Tools.html" title="Icinga2::Tools (module)">Tools</a></span><small class='search_info'>Icinga2</small></div></li><li id='object_Icinga2::Usergroups' class='collapsed even'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Icinga2/Usergroups.html" title="Icinga2::Usergroups (module)">Usergroups</a></span><small class='search_info'>Icinga2</small></div></li><li id='object_Icinga2::Users' class='collapsed odd'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Icinga2/Users.html" title="Icinga2::Users (module)">Users</a></span><small class='search_info'>Icinga2</small></div></li><li id='object_Icinga2::Version' class='collapsed even'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Icinga2/Version.html" title="Icinga2::Version (module)">Version</a></span><small class='search_info'>Icinga2</small></div></li></ul></li><li id='object_Logging' class='odd'><div class='item' style='padding-left:30px'><span class='object_link'><a href="Logging.html" title="Logging (module)">Logging</a></span><small class='search_info'>Top Level Namespace</small></div></li>
46
+ <li id='object_Icinga2' class='even'><div class='item' style='padding-left:30px'><a class='toggle'></a> <span class='object_link'><a href="Icinga2.html" title="Icinga2 (module)">Icinga2</a></span><small class='search_info'>Top Level Namespace</small></div><ul><li id='object_Icinga2::Client' class='collapsed odd'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Icinga2/Client.html" title="Icinga2::Client (class)">Client</a></span> &lt; Object<small class='search_info'>Icinga2</small></div></li><li id='object_Icinga2::Converts' class='collapsed even'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Icinga2/Converts.html" title="Icinga2::Converts (module)">Converts</a></span><small class='search_info'>Icinga2</small></div></li><li id='object_Icinga2::Downtimes' class='collapsed odd'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Icinga2/Downtimes.html" title="Icinga2::Downtimes (module)">Downtimes</a></span><small class='search_info'>Icinga2</small></div></li><li id='object_Icinga2::Hostgroups' class='collapsed even'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Icinga2/Hostgroups.html" title="Icinga2::Hostgroups (module)">Hostgroups</a></span><small class='search_info'>Icinga2</small></div></li><li id='object_Icinga2::Hosts' class='collapsed odd'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Icinga2/Hosts.html" title="Icinga2::Hosts (module)">Hosts</a></span><small class='search_info'>Icinga2</small></div></li><li id='object_Icinga2::Network' class='collapsed even'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Icinga2/Network.html" title="Icinga2::Network (module)">Network</a></span><small class='search_info'>Icinga2</small></div></li><li id='object_Icinga2::Notifications' class='collapsed odd'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Icinga2/Notifications.html" title="Icinga2::Notifications (module)">Notifications</a></span><small class='search_info'>Icinga2</small></div></li><li id='object_Icinga2::Servicegroups' class='collapsed even'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Icinga2/Servicegroups.html" title="Icinga2::Servicegroups (module)">Servicegroups</a></span><small class='search_info'>Icinga2</small></div></li><li id='object_Icinga2::Services' class='collapsed odd'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Icinga2/Services.html" title="Icinga2::Services (module)">Services</a></span><small class='search_info'>Icinga2</small></div></li><li id='object_Icinga2::Statistics' class='collapsed even'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Icinga2/Statistics.html" title="Icinga2::Statistics (module)">Statistics</a></span><small class='search_info'>Icinga2</small></div></li><li id='object_Icinga2::Tools' class='collapsed odd'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Icinga2/Tools.html" title="Icinga2::Tools (module)">Tools</a></span><small class='search_info'>Icinga2</small></div></li><li id='object_Icinga2::Usergroups' class='collapsed even'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Icinga2/Usergroups.html" title="Icinga2::Usergroups (module)">Usergroups</a></span><small class='search_info'>Icinga2</small></div></li><li id='object_Icinga2::Users' class='collapsed odd'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Icinga2/Users.html" title="Icinga2::Users (module)">Users</a></span><small class='search_info'>Icinga2</small></div></li><li id='object_Icinga2::Version' class='collapsed even'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Icinga2/Version.html" title="Icinga2::Version (module)">Version</a></span><small class='search_info'>Icinga2</small></div></li></ul></li><li id='object_Logging' class='odd'><div class='item' style='padding-left:30px'><span class='object_link'><a href="Logging.html" title="Logging (module)">Logging</a></span><small class='search_info'>Top Level Namespace</small></div></li>
47
47
 
48
48
  </ul>
49
49
  </div>
@@ -1,8 +1,25 @@
1
1
  # Icinga2 - Downtimes
2
2
 
3
3
 
4
- ## add
5
- add_downtime()
4
+ ## <a name="add-downtime"></a>add a downtime
5
+ add_downtime( params )
6
6
 
7
- ## list
8
- downtimes()
7
+ ### Example
8
+
9
+ param = {
10
+ name: 'test',
11
+ type: 'service',
12
+ host: 'icinga2',
13
+ comment: 'test downtime',
14
+ author: 'icingaadmin',
15
+ start_time: Time.now.to_i,
16
+ end_time: Time.now.to_i + 20
17
+ }
18
+ @icinga.add_downtime( param )
19
+
20
+
21
+ ## <a name="list-downtimes"></a>list all downtimes
22
+ downtimes
23
+
24
+ ### Example
25
+ @icinga.downtimes
@@ -60,16 +60,27 @@
60
60
  <div id="content"><div id='filecontents'>
61
61
  <h1 id="label-ruby-icinga2">ruby-icinga2</h1>
62
62
 
63
- <p>Small Ruby Class for the Icinga2 API</p>
63
+ <p>Ruby Class for the Icinga2 API</p>
64
64
 
65
65
  <h2 id="label-Requirements">Requirements</h2>
66
+ <ul><li>
67
+ <p>ruby version ~&gt; 2.3</p>
68
+ </li><li>
69
+ <p>rest-client ~&gt; 2.0</p>
70
+ </li><li>
71
+ <p>openssl ~&gt; 2.0</p>
72
+ </li><li>
73
+ <p>json ~&gt; 2.1</p>
74
+ </li></ul>
75
+
76
+ <h2 id="label-install">install</h2>
66
77
 
67
- <pre class="code ruby"><code class="ruby">gem install rest-client --no-rdoc --no-ri
68
- gem install json --no-rdoc --no-ri</code></pre>
78
+ <pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_gem'>gem</span> <span class='id identifier rubyid_install'>install</span> <span class='id identifier rubyid_icinga2'>icinga2</span>
79
+ </code></pre>
69
80
 
70
81
  <h2 id="label-usage">usage</h2>
71
82
 
72
- <p>create an instance and get information about the Icinga2 Server</p>
83
+ <p>create an instance</p>
73
84
 
74
85
  <pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_config'>config</span> <span class='op'>=</span> <span class='lbrace'>{</span>
75
86
  <span class='symbol'>:icinga</span> <span class='op'>=&gt;</span> <span class='lbrace'>{</span>
@@ -84,141 +95,183 @@ gem install json --no-rdoc --no-ri</code></pre>
84
95
  <span class='rbrace'>}</span>
85
96
  <span class='rbrace'>}</span>
86
97
 
87
- <span class='id identifier rubyid_i'>i</span> <span class='op'>=</span> <span class='const'>Icinga</span><span class='op'>::</span><span class='const'>Client</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span> <span class='id identifier rubyid_config'>config</span> <span class='rparen'>)</span>
88
- <span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_i'>i</span><span class='period'>.</span><span class='id identifier rubyid_application_data'>application_data</span><span class='lparen'>(</span><span class='rparen'>)</span>
98
+ <span class='ivar'>@icinga</span> <span class='op'>=</span> <span class='const'>Icinga</span><span class='op'>::</span><span class='const'>Client</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span> <span class='id identifier rubyid_config'>config</span> <span class='rparen'>)</span>
89
99
  </code></pre>
90
100
 
91
101
  <h2 id="label-Status">Status</h2>
92
102
 
93
103
  <p>supports the following API Calls:</p>
94
104
  <ul><li>
95
- <p><a href="doc/status.md">Users</a></p>
105
+ <p><a href="doc/users.md">Users</a></p>
96
106
  <ul><li>
97
- <p>application_data</p>
107
+ <p><a href="doc/users.md#add-user">add user</a></p>
98
108
  </li><li>
99
- <p>cib_data</p>
109
+ <p><a href="doc/users.md#delete-dser">delete user</a></p>
100
110
  </li><li>
101
- <p>api_listener</p>
111
+ <p><a href="doc/users.md#list-users">list users</a></p>
102
112
  </li><li>
103
- <p>application_data</p>
113
+ <p><a href="doc/users.md#user-exists">check if user exists</a></p>
104
114
  </li><li>
105
- <p>cib_data</p>
115
+ <p><a href="doc/users.md#add-user">add user</a></p>
106
116
  </li><li>
107
- <p>api_listener</p>
108
- </li></ul>
117
+ <p><a href="doc/users.md#delete-dser">delete user</a></p>
109
118
  </li><li>
110
- <p><a href="doc/users.md">Users</a></p>
111
- <ul><li>
112
- <p>add_user( params = {} )</p>
119
+ <p><a href="doc/users.md#list-users">list users</a></p>
113
120
  </li><li>
114
- <p>delete_user( params = {} )</p>
115
- </li><li>
116
- <p>users( params = {} )</p>
117
- </li><li>
118
- <p>exists_user?( name )</p>
121
+ <p><a href="doc/users.md#user-exists">check if user exists</a></p>
119
122
  </li></ul>
120
123
  </li><li>
121
124
  <p><a href="doc/usergroups.md">Usergroups</a></p>
122
125
  <ul><li>
123
- <p>add_usergroup( params = {} )</p>
126
+ <p><a href="doc/usergroups.md#add-usergroup">add usergroup</a></p>
124
127
  </li><li>
125
- <p>delete_usergroup( params = {} )</p>
128
+ <p><a href="doc/usergroups.md#delete-usergroup">delete usergroup</a></p>
126
129
  </li><li>
127
- <p>usergroups( params = {} )</p>
130
+ <p><a href="doc/usergroups.md#list-usergroups">list usergroups</a></p>
128
131
  </li><li>
129
- <p>exists_usergroup?( name )</p>
132
+ <p><a href="doc/usergroups.md#usergroup-exists">check if usergroup exists</a></p>
130
133
  </li></ul>
131
134
  </li><li>
132
135
  <p><a href="doc/hosts.md">Hosts</a></p>
133
136
  <ul><li>
134
- <p>add_host( params = {} )</p>
137
+ <p><a href="doc/hosts.md#add-host">add host</a></p>
138
+ </li><li>
139
+ <p><a href="doc/hosts.md#delete-host">delete host</a></p>
135
140
  </li><li>
136
- <p>delete_host( params = {} )</p>
141
+ <p><a href="doc/hosts.md#list-hosts">list hosts</a></p>
137
142
  </li><li>
138
- <p>hosts( params = {} )</p>
143
+ <p><a href="doc/hosts.md#host-exists">check if host exists</a></p>
139
144
  </li><li>
140
- <p>exists_host?( name )</p>
145
+ <p><a href="doc/hosts.md#list-host-objects">list host objects</a></p>
141
146
  </li><li>
142
- <p>host_objects( params = {} )</p>
147
+ <p><a href="doc/hosts.md#hosts-adjusted">adjusted hosts state</a></p>
143
148
  </li><li>
144
- <p>host_problems</p>
149
+ <p><a href="doc/hosts.md#count-hosts-with-problems">count of hosts with
150
+ problems</a></p>
145
151
  </li><li>
146
- <p>problem_hosts( max_items = 5 )</p>
152
+ <p><a href="doc/hosts.md#list-hosts-with-problems">list of hosts with
153
+ problems</a></p>
147
154
  </li><li>
148
- <p>host_severity( host )</p>
155
+ <p><a href="doc/hosts.md#count-all-hosts">count of all hosts</a></p>
156
+ </li><li>
157
+ <p><a href="doc/hosts.md#count-host-problems">count hosts with problems</a></p>
158
+ </li><li>
159
+ <p>calculate host severity (protected)</p>
149
160
  </li></ul>
150
161
  </li><li>
151
162
  <p><a href="doc/hostgroups.md">Hostgroups</a></p>
152
163
  <ul><li>
153
- <p>add_hostgroup(params = {})</p>
164
+ <p><a href="doc/hostgroups.md#add-usergroup">add hostgroup</a></p>
154
165
  </li><li>
155
- <p>delete_hostgroup(params = {})</p>
166
+ <p><a href="doc/hostgroups.md#delete-usergroup">delete hostgroup</a></p>
156
167
  </li><li>
157
- <p>hostgroups(params = {})</p>
168
+ <p><a href="doc/hostgroups.md#list-usergroups">list hostgroups</a></p>
158
169
  </li><li>
159
- <p>exists_hostgroup?(name)</p>
170
+ <p><a href="doc/hostgroups.md#usergroup-exists">check if hostgroup exists</a></p>
160
171
  </li></ul>
161
172
  </li><li>
162
173
  <p><a href="doc/services.md">Services</a></p>
163
174
  <ul><li>
164
- <p>add_services( host, services = {} )</p>
175
+ <p><a href="doc/services.md#add-service">add service</a> (<strong>this
176
+ function is not operable yet!</strong>)</p>
177
+ </li><li>
178
+ <p><a href="doc/services.md#delete-service">delete service</a> (<strong>not
179
+ yet implemented</strong>)</p>
180
+ </li><li>
181
+ <p><a href="doc/services.md#add-service">add service</a> (<strong>this
182
+ function is not operable yet!</strong>)</p>
183
+ </li><li>
184
+ <p><a href="doc/services.md#unhandled-services">list unhandled services</a>
185
+ (<strong>not yet implemented</strong>)</p>
186
+ </li><li>
187
+ <p><a href="doc/services.md#list-services">list services</a></p>
188
+ </li><li>
189
+ <p><a href="doc/services.md#service-exists">check if service exists</a></p>
165
190
  </li><li>
166
- <p>unhandled_services( params = {} )</p>
191
+ <p><a href="doc/services.md#list-service-objects">list service objects</a></p>
167
192
  </li><li>
168
- <p>services( params = {} )</p>
193
+ <p><a href="doc/services.md#services-adjusted">adjusted service state</a></p>
169
194
  </li><li>
170
- <p>exists_service?( params = {} )</p>
195
+ <p><a href="doc/services.md#count-services-with-problems">count services with
196
+ problems</a></p>
171
197
  </li><li>
172
- <p>service_objects( params = {} )</p>
198
+ <p><a href="doc/services.md#list-services-with-problems">list of services with
199
+ problems</a></p>
173
200
  </li><li>
174
- <p>service_problems</p>
201
+ <p><a href="doc/services.md#update-host">update host</a> (<strong>this
202
+ function is not operable yet!</strong>)</p>
175
203
  </li><li>
176
- <p>problem_services( max_items = 5 )</p>
204
+ <p><a href="doc/services.md#count-all-services">count of all services</a></p>
177
205
  </li><li>
178
- <p>update_host( hash, host )</p>
206
+ <p><a href="doc/services.md#count-all-services-handled">count all services
207
+ with handled problems</a></p>
179
208
  </li><li>
180
- <p>service_severity( service )</p>
209
+ <p>calculate service severity (protected)</p>
181
210
  </li></ul>
182
211
  </li><li>
183
212
  <p><a href="doc/servicegroups.md">Servicegroups</a></p>
184
213
  <ul><li>
185
- <p>add_servicegroup( params = {} )</p>
214
+ <p><a href="doc/servicegroups.md#add-servicegroup">add servicegroup</a></p>
186
215
  </li><li>
187
- <p>delete_servicegroup( params = {} )</p>
216
+ <p><a href="doc/servicegroups.md#delete-servicegroup">delete servicegroup</a></p>
188
217
  </li><li>
189
- <p>servicegroups( params = {} )</p>
218
+ <p><a href="doc/servicegroups.md#list-servicegroup">list servicegroups</a></p>
190
219
  </li><li>
191
- <p>exists_servicegroup?( name )</p>
220
+ <p><a href="doc/servicegroups.md#servicegroup-exists">check if servicegroup
221
+ exists</a></p>
192
222
  </li></ul>
193
223
  </li><li>
194
224
  <p><a href="doc/downtimes.md">Downtimes</a></p>
195
225
  <ul><li>
196
- <p>add_downtime( params = {} )</p>
226
+ <p><a href="doc/downtimes.md#add-downtime">add downtime</a></p>
197
227
  </li><li>
198
- <p>downtimes( params = {} )</p>
228
+ <p><a href="doc/downtimes.md#list-downtimes">list downtimes</a></p>
199
229
  </li></ul>
200
230
  </li><li>
201
231
  <p><a href="doc/notifications.md">Notifications</a></p>
202
232
  <ul><li>
203
- <p>enable_host_notification( host )</p>
233
+ <p><a href="doc/notifications.md#enable-host-notification">enable host
234
+ notifications</a></p>
204
235
  </li><li>
205
- <p>disable_host_notification( host )</p>
236
+ <p><a href="doc/notifications.md#disable-host-notification">disable host
237
+ notifications</a></p>
206
238
  </li><li>
207
- <p>enable_service_notification( params = {} )</p>
239
+ <p><a href="doc/notifications.md#enable-service-notification">enable service
240
+ notifications</a></p>
208
241
  </li><li>
209
- <p>disable_service_notification( host )</p>
242
+ <p><a href="doc/notifications.md#disable-service-notification">disable service
243
+ notifications</a></p>
210
244
  </li><li>
211
- <p>enable_hostgroup_notification( group )</p>
245
+ <p><a href="doc/notifications.md#enable-hostgroup-notification">enable
246
+ hostgroup notifications</a></p>
212
247
  </li><li>
213
- <p>disable_hostgroup_notification( group )</p>
248
+ <p><a href="doc/notifications.md#disable-hostgroup-notification">disable
249
+ hostgroup notifications</a></p>
250
+ </li><li>
251
+ <p><a href="doc/notifications.md#list-notifications">list all
252
+ notifications</a></p>
253
+ </li><li>
254
+ <p>host notification (protected)</p>
255
+ </li><li>
256
+ <p>hostgroup notification (protected)</p>
257
+ </li><li>
258
+ <p>service notification (protected)</p>
259
+ </li></ul>
260
+ </li><li>
261
+ <p><a href="doc/statistics.md">Statistics</a></p>
262
+ <ul><li>
263
+ <p><a href="doc/statistics.md#stats-avg">statistic data for latence and
264
+ execution time</a></p>
214
265
  </li><li>
215
- <p>notifications( params = {} )</p>
266
+ <p><a href="doc/statistics.md#stats-interval">statistic data for interval
267
+ data</a></p>
216
268
  </li><li>
217
- <p>host_notification( params = {} )</p>
269
+ <p><a href="doc/statistics.md#stats-services">statistic data for services</a></p>
218
270
  </li><li>
219
- <p>hostgroup_notification( params = {} )</p>
271
+ <p><a href="doc/statistics.md#stats-hosts">statistic data for hosts</a></p>
220
272
  </li><li>
221
- <p>service_notification( params = {} )</p>
273
+ <p><a href="doc/statistics.md#stats-work-queue">queue statistics from the
274
+ api</a></p>
222
275
  </li></ul>
223
276
  </li></ul>
224
277
 
@@ -238,8 +291,7 @@ Successfully installed icinga2-0.6.0
238
291
 
239
292
  <h2 id="label-test+via+CLI">test via CLI</h2>
240
293
 
241
- <pre class="code ruby"><code class="ruby">#$ export ICINGA_HOST=localhost ; export ICINGA_API_USER=root ; export ICINGA_API_PASSWORD=icinga
242
- #$ irb
294
+ <pre class="code ruby"><code class="ruby">#$ irb
243
295
  2.3.0 :001 &gt; require &#39;icinga2&#39;
244
296
  =&gt; true
245
297
  2.3.0 :002 &gt; config = { :icinga =&gt; { :host =&gt; &#39;localhost&#39;, :api =&gt; { :user =&gt; &#39;root&#39;, :pass =&gt; &#39;icinga&#39; } } }
@@ -268,7 +320,7 @@ feature&#39;</code>)</p>
268
320
  </div></div>
269
321
 
270
322
  <div id="footer">
271
- Generated on Wed Jun 28 05:55:20 2017 by
323
+ Generated on Tue Aug 22 11:29:51 2017 by
272
324
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
273
325
  0.9.9 (ruby-2.3.4).
274
326
  </div>