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 +4 -4
- data/README.md +73 -58
- data/doc/Icinga2.html +35 -3
- data/doc/Logging.html +2 -2
- data/doc/_index.html +2 -2
- data/doc/class_list.html +1 -1
- data/doc/downtimes.md +21 -4
- data/doc/file.README.html +118 -66
- data/doc/hostgroups.md +26 -11
- data/doc/hosts.md +93 -20
- data/doc/index.html +118 -66
- data/doc/method_list.html +84 -300
- data/doc/notifications.md +42 -14
- data/doc/servicegroups.md +28 -11
- data/doc/services.md +91 -21
- data/doc/statistics.md +54 -0
- data/doc/top-level-namespace.html +1 -1
- data/doc/usergroups.md +25 -4
- data/doc/users.md +26 -29
- data/examples/test.rb +213 -76
- data/lib/icinga2.rb +256 -71
- data/lib/icinga2/converts.rb +5 -2
- data/lib/icinga2/downtimes.rb +26 -88
- data/lib/icinga2/hostgroups.rb +46 -32
- data/lib/icinga2/hosts.rb +205 -92
- data/lib/icinga2/network.rb +136 -325
- data/lib/icinga2/network.rb-SAVE +1004 -0
- data/lib/icinga2/notifications.rb +49 -72
- data/lib/icinga2/servicegroups.rb +54 -42
- data/lib/icinga2/services.rb +212 -82
- data/lib/icinga2/statistics.rb +191 -0
- data/lib/icinga2/tools.rb +28 -23
- data/lib/icinga2/usergroups.rb +49 -39
- data/lib/icinga2/users.rb +56 -61
- data/lib/icinga2/version.rb +3 -3
- metadata +5 -3
- data/lib/icinga2/status.rb +0 -210
data/doc/hostgroups.md
CHANGED
@@ -1,22 +1,37 @@
|
|
1
1
|
# Icinga2 - Hostgroups
|
2
2
|
|
3
3
|
|
4
|
-
## add
|
5
|
-
add_hostgroup()
|
4
|
+
## <a name="add-hostgroup"></a>add a hostgroup
|
5
|
+
add_hostgroup( params )
|
6
6
|
|
7
|
+
### Example
|
8
|
+
@icinga.add_hostgroup(host_group: 'foo', display_name: 'FOO')
|
7
9
|
|
8
|
-
## delete
|
9
|
-
delete_hostgroup()
|
10
10
|
|
11
|
+
## <a name="delete-hostgroup"></a>delete a hostgroup
|
12
|
+
delete_hostgroup( params )
|
11
13
|
|
12
|
-
|
14
|
+
### Example
|
15
|
+
@icinga.delete_hostgroup(host_group: 'foo')
|
13
16
|
|
14
|
-
### named
|
15
|
-
hostgroups()
|
16
17
|
|
17
|
-
|
18
|
-
hostgroups()
|
18
|
+
## <a name="list-hostgroups"></a>list hostgroups
|
19
19
|
|
20
|
+
### list named hostgroup
|
21
|
+
hostgroups( params )
|
20
22
|
|
21
|
-
|
22
|
-
|
23
|
+
#### Example
|
24
|
+
@icinga.hostgroups(host_group: 'linux-servers')
|
25
|
+
|
26
|
+
### list all hostgroups
|
27
|
+
hostgroups
|
28
|
+
|
29
|
+
### Example
|
30
|
+
@icinga.hostgroups
|
31
|
+
|
32
|
+
|
33
|
+
## <a name="usergroup-exists"></a>check if the hostgroup exists
|
34
|
+
exists_hostgroup?( hostgroup )
|
35
|
+
|
36
|
+
### Example
|
37
|
+
@icinga.exists_hostgroup?('linux-servers')
|
data/doc/hosts.md
CHANGED
@@ -1,34 +1,107 @@
|
|
1
1
|
# Icinga2 - Hosts
|
2
2
|
|
3
|
-
## add
|
4
|
-
|
5
|
-
|
3
|
+
## <a name="add-host"></a>add a host
|
4
|
+
add_host( params )
|
5
|
+
|
6
|
+
### Example
|
7
|
+
param = {
|
8
|
+
host: 'foo',
|
9
|
+
fqdn: 'foo.bar.com',
|
10
|
+
display_name: 'test node',
|
11
|
+
max_check_attempts: 5,
|
12
|
+
notes: 'test node'
|
6
13
|
}
|
14
|
+
@icinga.add_host(param)
|
15
|
+
|
16
|
+
|
17
|
+
## <a name="delete-host"></a>delete a host
|
18
|
+
delete_host( params )
|
19
|
+
|
20
|
+
### Example
|
21
|
+
@icinga.delete_host(host: 'foo')
|
22
|
+
|
23
|
+
|
24
|
+
## <a name="list-hosts"></a>list hosts
|
25
|
+
|
26
|
+
### list a named host
|
27
|
+
hosts( params )
|
28
|
+
|
29
|
+
#### Example
|
30
|
+
@icinga.host(host: 'icinga2')
|
31
|
+
|
32
|
+
### list all hosts
|
33
|
+
hosts
|
34
|
+
|
35
|
+
#### Example
|
36
|
+
@icinga.hosts
|
37
|
+
|
38
|
+
|
39
|
+
## <a name="host-exists"></a>check if the host exists
|
40
|
+
exists_host?( host_name )
|
41
|
+
|
42
|
+
### Example
|
43
|
+
@icinga.exists_host?('icinga2')
|
44
|
+
|
7
45
|
|
8
|
-
|
46
|
+
## <a name="list-host-objects"></a>get host objects
|
47
|
+
host_objects( params )
|
9
48
|
|
10
|
-
|
11
|
-
|
49
|
+
### Example
|
50
|
+
@icinga.host_objects(attrs: ['name', 'state'])
|
12
51
|
|
13
|
-
## list
|
14
52
|
|
15
|
-
|
16
|
-
|
53
|
+
## <a name="hosts-adjusted"></a>adjusted hosts state
|
54
|
+
hosts_adjusted
|
17
55
|
|
18
|
-
###
|
19
|
-
|
56
|
+
### Example
|
57
|
+
@icinga.cib_data
|
58
|
+
@icinga.host_objects
|
59
|
+
warning, critical, unknown = @icinga.hosts_adjusted.values
|
20
60
|
|
21
|
-
|
22
|
-
|
61
|
+
or
|
62
|
+
h = @icinga.hosts_adjusted
|
63
|
+
down = h.dig(:down_adjusted)
|
23
64
|
|
24
|
-
##
|
25
|
-
host_objects
|
26
65
|
|
27
|
-
##
|
66
|
+
## <a name="count-hosts-with-problems"></a>count of hosts with problems
|
67
|
+
count_hosts_with_problems
|
68
|
+
|
69
|
+
### Example
|
70
|
+
@icinga.count_hosts_with_problems
|
71
|
+
|
72
|
+
|
73
|
+
## <a name="list-hosts-with-problems"></a>a hash of hosts with problems
|
74
|
+
list_hosts_with_problems( max_items )
|
75
|
+
|
76
|
+
### Example
|
77
|
+
@icinga.list_hosts_with_problems
|
78
|
+
@icinga.list_hosts_with_problems( 10 )
|
79
|
+
|
80
|
+
|
81
|
+
## <a name="count-all-hosts"></a>count of all hosts
|
82
|
+
hosts_all
|
83
|
+
|
84
|
+
### Example
|
85
|
+
@icinga.host_objects
|
86
|
+
@icinga.hosts_all
|
87
|
+
|
88
|
+
|
89
|
+
## <a name="count-host-problems"></a>count all hosts with problems (down, warning, unknown state)
|
28
90
|
host_problems
|
29
91
|
|
30
|
-
|
31
|
-
|
92
|
+
### Example
|
93
|
+
@icinga.host_objects
|
94
|
+
all, down, critical, unknown = @icinga.host_problems.values
|
95
|
+
|
96
|
+
or
|
97
|
+
p = @icinga.host_problems
|
98
|
+
down = h.dig(:down)
|
99
|
+
|
100
|
+
|
101
|
+
## <a name="host-severity"></a>(protected) calculate a host severity
|
102
|
+
host_severity( params )
|
103
|
+
|
104
|
+
original code are from [Icinga Web2](/modules/monitoring/library/Monitoring/Backend/Ido/Query/ServicestatusQuery.php)
|
32
105
|
|
33
|
-
|
34
|
-
host_severity
|
106
|
+
### Example
|
107
|
+
host_severity( {'attrs' => { 'state' => 0.0, 'acknowledgement' => 0.0, 'downtime_depth' => 0.0 } } )
|
data/doc/index.html
CHANGED
@@ -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>
|
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 ~> 2.3</p>
|
68
|
+
</li><li>
|
69
|
+
<p>rest-client ~> 2.0</p>
|
70
|
+
</li><li>
|
71
|
+
<p>openssl ~> 2.0</p>
|
72
|
+
</li><li>
|
73
|
+
<p>json ~> 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
|
68
|
-
|
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
|
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'>=></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='
|
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/
|
105
|
+
<p><a href="doc/users.md">Users</a></p>
|
96
106
|
<ul><li>
|
97
|
-
<p>
|
107
|
+
<p><a href="doc/users.md#add-user">add user</a></p>
|
98
108
|
</li><li>
|
99
|
-
<p>
|
109
|
+
<p><a href="doc/users.md#delete-dser">delete user</a></p>
|
100
110
|
</li><li>
|
101
|
-
<p>
|
111
|
+
<p><a href="doc/users.md#list-users">list users</a></p>
|
102
112
|
</li><li>
|
103
|
-
<p>
|
113
|
+
<p><a href="doc/users.md#user-exists">check if user exists</a></p>
|
104
114
|
</li><li>
|
105
|
-
<p>
|
115
|
+
<p><a href="doc/users.md#add-user">add user</a></p>
|
106
116
|
</li><li>
|
107
|
-
<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">
|
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>
|
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
|
126
|
+
<p><a href="doc/usergroups.md#add-usergroup">add usergroup</a></p>
|
124
127
|
</li><li>
|
125
|
-
<p
|
128
|
+
<p><a href="doc/usergroups.md#delete-usergroup">delete usergroup</a></p>
|
126
129
|
</li><li>
|
127
|
-
<p
|
130
|
+
<p><a href="doc/usergroups.md#list-usergroups">list usergroups</a></p>
|
128
131
|
</li><li>
|
129
|
-
<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
|
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
|
141
|
+
<p><a href="doc/hosts.md#list-hosts">list hosts</a></p>
|
137
142
|
</li><li>
|
138
|
-
<p>
|
143
|
+
<p><a href="doc/hosts.md#host-exists">check if host exists</a></p>
|
139
144
|
</li><li>
|
140
|
-
<p>
|
145
|
+
<p><a href="doc/hosts.md#list-host-objects">list host objects</a></p>
|
141
146
|
</li><li>
|
142
|
-
<p
|
147
|
+
<p><a href="doc/hosts.md#hosts-adjusted">adjusted hosts state</a></p>
|
143
148
|
</li><li>
|
144
|
-
<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>
|
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>
|
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
|
164
|
+
<p><a href="doc/hostgroups.md#add-usergroup">add hostgroup</a></p>
|
154
165
|
</li><li>
|
155
|
-
<p
|
166
|
+
<p><a href="doc/hostgroups.md#delete-usergroup">delete hostgroup</a></p>
|
156
167
|
</li><li>
|
157
|
-
<p
|
168
|
+
<p><a href="doc/hostgroups.md#list-usergroups">list hostgroups</a></p>
|
158
169
|
</li><li>
|
159
|
-
<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
|
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
|
191
|
+
<p><a href="doc/services.md#list-service-objects">list service objects</a></p>
|
167
192
|
</li><li>
|
168
|
-
<p
|
193
|
+
<p><a href="doc/services.md#services-adjusted">adjusted service state</a></p>
|
169
194
|
</li><li>
|
170
|
-
<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>
|
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>
|
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>
|
204
|
+
<p><a href="doc/services.md#count-all-services">count of all services</a></p>
|
177
205
|
</li><li>
|
178
|
-
<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>
|
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
|
214
|
+
<p><a href="doc/servicegroups.md#add-servicegroup">add servicegroup</a></p>
|
186
215
|
</li><li>
|
187
|
-
<p
|
216
|
+
<p><a href="doc/servicegroups.md#delete-servicegroup">delete servicegroup</a></p>
|
188
217
|
</li><li>
|
189
|
-
<p
|
218
|
+
<p><a href="doc/servicegroups.md#list-servicegroup">list servicegroups</a></p>
|
190
219
|
</li><li>
|
191
|
-
<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
|
226
|
+
<p><a href="doc/downtimes.md#add-downtime">add downtime</a></p>
|
197
227
|
</li><li>
|
198
|
-
<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>
|
233
|
+
<p><a href="doc/notifications.md#enable-host-notification">enable host
|
234
|
+
notifications</a></p>
|
204
235
|
</li><li>
|
205
|
-
<p>
|
236
|
+
<p><a href="doc/notifications.md#disable-host-notification">disable host
|
237
|
+
notifications</a></p>
|
206
238
|
</li><li>
|
207
|
-
<p
|
239
|
+
<p><a href="doc/notifications.md#enable-service-notification">enable service
|
240
|
+
notifications</a></p>
|
208
241
|
</li><li>
|
209
|
-
<p>
|
242
|
+
<p><a href="doc/notifications.md#disable-service-notification">disable service
|
243
|
+
notifications</a></p>
|
210
244
|
</li><li>
|
211
|
-
<p
|
245
|
+
<p><a href="doc/notifications.md#enable-hostgroup-notification">enable
|
246
|
+
hostgroup notifications</a></p>
|
212
247
|
</li><li>
|
213
|
-
<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>
|
266
|
+
<p><a href="doc/statistics.md#stats-interval">statistic data for interval
|
267
|
+
data</a></p>
|
216
268
|
</li><li>
|
217
|
-
<p>
|
269
|
+
<p><a href="doc/statistics.md#stats-services">statistic data for services</a></p>
|
218
270
|
</li><li>
|
219
|
-
<p>
|
271
|
+
<p><a href="doc/statistics.md#stats-hosts">statistic data for hosts</a></p>
|
220
272
|
</li><li>
|
221
|
-
<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">#$
|
242
|
-
#$ irb
|
294
|
+
<pre class="code ruby"><code class="ruby">#$ irb
|
243
295
|
2.3.0 :001 > require 'icinga2'
|
244
296
|
=> true
|
245
297
|
2.3.0 :002 > config = { :icinga => { :host => 'localhost', :api => { :user => 'root', :pass => 'icinga' } } }
|
@@ -268,7 +320,7 @@ feature'</code>)</p>
|
|
268
320
|
</div></div>
|
269
321
|
|
270
322
|
<div id="footer">
|
271
|
-
Generated on
|
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>
|