icinga2 0.6.4.0 → 0.6.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eacc8deb824f3977fc7aa502e7f355a13fa6b114
4
- data.tar.gz: c5f56243487975571d581c13223a96e1c4ed2073
3
+ metadata.gz: 5d082904a4b57ecb1d3da9a398611e130a8ac951
4
+ data.tar.gz: 575a2ec8387ef5ab1cc95cfa2a1c3a8013b85274
5
5
  SHA512:
6
- metadata.gz: 24ea6e2ba8956c1050ca4498751141546dd7605ee11f8256d915029d95cf0896a70cc100828ee2d17ddb3c97b3e14c1b0957734b5ddd46ee2eb8479482156fba
7
- data.tar.gz: f6f10f320fdbc0ba26c656859a33e95b61895ddbffca560e08d031392a58e21046ce8f42104a5725762a46c790995508886d9208ebc3c640c8aa853dab63e4a6
6
+ metadata.gz: 3d3f7b99eff8a66a6d6aefcf2d5d58e78ca41f97c36147c73d723b928cd750953eeb4cae92585564ba4283a9d99ec02d6e2218f5c085f31cc0a2180584acce17
7
+ data.tar.gz: 91a5ff146a4f3a0b7255e01fb4bdb3635928b7f5f10d9936420c5d8e29dd8cd25296e5c446ab40da878a6b22251ddaf9a797540d233ed6e6c0e5a801e4152e21
data/doc/Icinga2.html CHANGED
@@ -112,7 +112,23 @@
112
112
  <h2>Constant Summary</h2>
113
113
  <dl class="constants">
114
114
 
115
- <dt id="HANDLED_WARNING-constant" class="">HANDLED_WARNING =
115
+ <dt id="HOSTS_DOWN-constant" class="">HOSTS_DOWN =
116
+ <div class="docstring">
117
+ <div class="discussion">
118
+
119
+ <p>static variable for hosts down</p>
120
+
121
+
122
+ </div>
123
+ </div>
124
+ <div class="tags">
125
+
126
+
127
+ </div>
128
+ </dt>
129
+ <dd><pre class="code"><span class='int'>1</span></pre></dd>
130
+
131
+ <dt id="SERVICE_STATE_WARNING-constant" class="">SERVICE_STATE_WARNING =
116
132
  <div class="docstring">
117
133
  <div class="discussion">
118
134
 
@@ -128,7 +144,7 @@
128
144
  </dt>
129
145
  <dd><pre class="code"><span class='int'>1</span></pre></dd>
130
146
 
131
- <dt id="HANDLED_CRITICAL-constant" class="">HANDLED_CRITICAL =
147
+ <dt id="SERVICE_STATE_CRITICAL-constant" class="">SERVICE_STATE_CRITICAL =
132
148
  <div class="docstring">
133
149
  <div class="discussion">
134
150
 
@@ -144,7 +160,7 @@
144
160
  </dt>
145
161
  <dd><pre class="code"><span class='int'>2</span></pre></dd>
146
162
 
147
- <dt id="HANDLED_UNKNOWN-constant" class="">HANDLED_UNKNOWN =
163
+ <dt id="SERVICE_STATE_UNKNOWN-constant" class="">SERVICE_STATE_UNKNOWN =
148
164
  <div class="docstring">
149
165
  <div class="discussion">
150
166
 
@@ -174,7 +190,7 @@
174
190
 
175
191
  </div>
176
192
  </dt>
177
- <dd><pre class="code"><span class='lbracket'>[</span><span class='const'><span class='object_link'><a href="Icinga2/Version.html" title="Icinga2::Version (module)">Version</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Icinga2/Version.html#MAJOR-constant" title="Icinga2::Version::MAJOR (constant)">MAJOR</a></span></span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="Icinga2/Version.html" title="Icinga2::Version (module)">Version</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Icinga2/Version.html#MINOR-constant" title="Icinga2::Version::MINOR (constant)">MINOR</a></span></span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="Icinga2/Version.html" title="Icinga2::Version (module)">Version</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Icinga2/Version.html#TINY-constant" title="Icinga2::Version::TINY (constant)">TINY</a></span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span> <span class='op'>*</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>.</span><span class='tstring_end'>&#39;</span></span></pre></dd>
193
+ <dd><pre class="code"><span class='lbracket'>[</span><span class='const'><span class='object_link'><a href="Icinga2/Version.html" title="Icinga2::Version (module)">Version</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Icinga2/Version.html#MAJOR-constant" title="Icinga2::Version::MAJOR (constant)">MAJOR</a></span></span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="Icinga2/Version.html" title="Icinga2::Version (module)">Version</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Icinga2/Version.html#MINOR-constant" title="Icinga2::Version::MINOR (constant)">MINOR</a></span></span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="Icinga2/Version.html" title="Icinga2::Version (module)">Version</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Icinga2/Version.html#TINY-constant" title="Icinga2::Version::TINY (constant)">TINY</a></span></span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="Icinga2/Version.html" title="Icinga2::Version (module)">Version</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Icinga2/Version.html#PATCH-constant" title="Icinga2::Version::PATCH (constant)">PATCH</a></span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span> <span class='op'>*</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>.</span><span class='tstring_end'>&#39;</span></span></pre></dd>
178
194
 
179
195
  </dl>
180
196
 
@@ -189,7 +205,7 @@
189
205
  </div>
190
206
 
191
207
  <div id="footer">
192
- Generated on Sun Jun 18 15:20:36 2017 by
208
+ Generated on Wed Jun 28 05:55:20 2017 by
193
209
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
194
210
  0.9.9 (ruby-2.3.4).
195
211
  </div>
data/doc/Logging.html CHANGED
@@ -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 Sun Jun 18 15:20:36 2017 by
321
+ Generated on Wed Jun 28 05:55:20 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>
data/doc/_index.html CHANGED
@@ -275,7 +275,7 @@
275
275
  </div>
276
276
 
277
277
  <div id="footer">
278
- Generated on Sun Jun 18 15:20:36 2017 by
278
+ Generated on Wed Jun 28 05:55:20 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>
data/doc/file.README.html CHANGED
@@ -268,7 +268,7 @@ feature&#39;</code>)</p>
268
268
  </div></div>
269
269
 
270
270
  <div id="footer">
271
- Generated on Sun Jun 18 15:20:36 2017 by
271
+ Generated on Wed Jun 28 05:55:20 2017 by
272
272
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
273
273
  0.9.9 (ruby-2.3.4).
274
274
  </div>
data/doc/index.html CHANGED
@@ -268,7 +268,7 @@ feature&#39;</code>)</p>
268
268
  </div></div>
269
269
 
270
270
  <div id="footer">
271
- Generated on Sun Jun 18 15:20:36 2017 by
271
+ Generated on Wed Jun 28 05:55:20 2017 by
272
272
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
273
273
  0.9.9 (ruby-2.3.4).
274
274
  </div>
data/doc/method_list.html CHANGED
@@ -116,6 +116,22 @@
116
116
  </li>
117
117
 
118
118
 
119
+ <li class="even ">
120
+ <div class="item">
121
+ <span class='object_link'><a href="Icinga2/Client.html#avg_execution_time-instance_method" title="Icinga2::Client#avg_execution_time (method)">#avg_execution_time</a></span>
122
+ <small>Icinga2::Client</small>
123
+ </div>
124
+ </li>
125
+
126
+
127
+ <li class="odd ">
128
+ <div class="item">
129
+ <span class='object_link'><a href="Icinga2/Client.html#avg_latency-instance_method" title="Icinga2::Client#avg_latency (method)">#avg_latency</a></span>
130
+ <small>Icinga2::Client</small>
131
+ </div>
132
+ </li>
133
+
134
+
119
135
  <li class="even ">
120
136
  <div class="item">
121
137
  <span class='object_link'><a href="Icinga2/Client.html#cert%3F-instance_method" title="Icinga2::Client#cert? (method)">#cert?</a></span>
@@ -318,13 +334,21 @@
318
334
 
319
335
  <li class="odd ">
320
336
  <div class="item">
321
- <span class='object_link'><a href="Icinga2/Network.html#get_with_payload-class_method" title="Icinga2::Network.get_with_payload (method)">get_with_payload</a></span>
337
+ <span class='object_link'><a href="Icinga2/Network.html#get_raw-class_method" title="Icinga2::Network.get_raw (method)">get_raw</a></span>
322
338
  <small>Icinga2::Network</small>
323
339
  </div>
324
340
  </li>
325
341
 
326
342
 
327
343
  <li class="even ">
344
+ <div class="item">
345
+ <span class='object_link'><a href="Icinga2/Network.html#get_with_payload-class_method" title="Icinga2::Network.get_with_payload (method)">get_with_payload</a></span>
346
+ <small>Icinga2::Network</small>
347
+ </div>
348
+ </li>
349
+
350
+
351
+ <li class="odd ">
328
352
  <div class="item">
329
353
  <span class='object_link'><a href="Icinga2/Tools.html#handled_problems-instance_method" title="Icinga2::Tools#handled_problems (method)">#handled_problems</a></span>
330
354
  <small>Icinga2::Tools</small>
@@ -332,7 +356,7 @@
332
356
  </li>
333
357
 
334
358
 
335
- <li class="odd ">
359
+ <li class="even ">
336
360
  <div class="item">
337
361
  <span class='object_link'><a href="Icinga2/Hosts.html#host_objects-instance_method" title="Icinga2::Hosts#host_objects (method)">#host_objects</a></span>
338
362
  <small>Icinga2::Hosts</small>
@@ -340,7 +364,7 @@
340
364
  </li>
341
365
 
342
366
 
343
- <li class="even ">
367
+ <li class="odd ">
344
368
  <div class="item">
345
369
  <span class='object_link'><a href="Icinga2/Hosts.html#host_problems-instance_method" title="Icinga2::Hosts#host_problems (method)">#host_problems</a></span>
346
370
  <small>Icinga2::Hosts</small>
@@ -348,7 +372,7 @@
348
372
  </li>
349
373
 
350
374
 
351
- <li class="odd ">
375
+ <li class="even ">
352
376
  <div class="item">
353
377
  <span class='object_link'><a href="Icinga2/Hosts.html#host_severity-instance_method" title="Icinga2::Hosts#host_severity (method)">#host_severity</a></span>
354
378
  <small>Icinga2::Hosts</small>
@@ -356,7 +380,7 @@
356
380
  </li>
357
381
 
358
382
 
359
- <li class="even ">
383
+ <li class="odd ">
360
384
  <div class="item">
361
385
  <span class='object_link'><a href="Icinga2/Hostgroups.html#hostgroups-instance_method" title="Icinga2::Hostgroups#hostgroups (method)">#hostgroups</a></span>
362
386
  <small>Icinga2::Hostgroups</small>
@@ -364,7 +388,7 @@
364
388
  </li>
365
389
 
366
390
 
367
- <li class="odd ">
391
+ <li class="even ">
368
392
  <div class="item">
369
393
  <span class='object_link'><a href="Icinga2/Hosts.html#hosts-instance_method" title="Icinga2::Hosts#hosts (method)">#hosts</a></span>
370
394
  <small>Icinga2::Hosts</small>
@@ -372,7 +396,7 @@
372
396
  </li>
373
397
 
374
398
 
375
- <li class="even ">
399
+ <li class="odd ">
376
400
  <div class="item">
377
401
  <span class='object_link'><a href="Icinga2/Client.html#hosts_acknowledged-instance_method" title="Icinga2::Client#hosts_acknowledged (method)">#hosts_acknowledged</a></span>
378
402
  <small>Icinga2::Client</small>
@@ -380,7 +404,7 @@
380
404
  </li>
381
405
 
382
406
 
383
- <li class="odd ">
407
+ <li class="even ">
384
408
  <div class="item">
385
409
  <span class='object_link'><a href="Icinga2/Client.html#hosts_active_checks_1min-instance_method" title="Icinga2::Client#hosts_active_checks_1min (method)">#hosts_active_checks_1min</a></span>
386
410
  <small>Icinga2::Client</small>
@@ -388,7 +412,7 @@
388
412
  </li>
389
413
 
390
414
 
391
- <li class="even ">
415
+ <li class="odd ">
392
416
  <div class="item">
393
417
  <span class='object_link'><a href="Icinga2/Client.html#hosts_all-instance_method" title="Icinga2::Client#hosts_all (method)">#hosts_all</a></span>
394
418
  <small>Icinga2::Client</small>
@@ -396,7 +420,7 @@
396
420
  </li>
397
421
 
398
422
 
399
- <li class="odd ">
423
+ <li class="even ">
400
424
  <div class="item">
401
425
  <span class='object_link'><a href="Icinga2/Client.html#hosts_down-instance_method" title="Icinga2::Client#hosts_down (method)">#hosts_down</a></span>
402
426
  <small>Icinga2::Client</small>
@@ -404,7 +428,7 @@
404
428
  </li>
405
429
 
406
430
 
407
- <li class="even ">
431
+ <li class="odd ">
408
432
  <div class="item">
409
433
  <span class='object_link'><a href="Icinga2/Client.html#hosts_down_adjusted-instance_method" title="Icinga2::Client#hosts_down_adjusted (method)">#hosts_down_adjusted</a></span>
410
434
  <small>Icinga2::Client</small>
@@ -412,7 +436,7 @@
412
436
  </li>
413
437
 
414
438
 
415
- <li class="odd ">
439
+ <li class="even ">
416
440
  <div class="item">
417
441
  <span class='object_link'><a href="Icinga2/Client.html#hosts_handled_critical_problems-instance_method" title="Icinga2::Client#hosts_handled_critical_problems (method)">#hosts_handled_critical_problems</a></span>
418
442
  <small>Icinga2::Client</small>
@@ -420,7 +444,7 @@
420
444
  </li>
421
445
 
422
446
 
423
- <li class="even ">
447
+ <li class="odd ">
424
448
  <div class="item">
425
449
  <span class='object_link'><a href="Icinga2/Client.html#hosts_handled_problems-instance_method" title="Icinga2::Client#hosts_handled_problems (method)">#hosts_handled_problems</a></span>
426
450
  <small>Icinga2::Client</small>
@@ -428,7 +452,7 @@
428
452
  </li>
429
453
 
430
454
 
431
- <li class="odd ">
455
+ <li class="even ">
432
456
  <div class="item">
433
457
  <span class='object_link'><a href="Icinga2/Client.html#hosts_handled_unknown_problems-instance_method" title="Icinga2::Client#hosts_handled_unknown_problems (method)">#hosts_handled_unknown_problems</a></span>
434
458
  <small>Icinga2::Client</small>
@@ -436,7 +460,7 @@
436
460
  </li>
437
461
 
438
462
 
439
- <li class="even ">
463
+ <li class="odd ">
440
464
  <div class="item">
441
465
  <span class='object_link'><a href="Icinga2/Client.html#hosts_handled_warning_problems-instance_method" title="Icinga2::Client#hosts_handled_warning_problems (method)">#hosts_handled_warning_problems</a></span>
442
466
  <small>Icinga2::Client</small>
@@ -444,7 +468,7 @@
444
468
  </li>
445
469
 
446
470
 
447
- <li class="odd ">
471
+ <li class="even ">
448
472
  <div class="item">
449
473
  <span class='object_link'><a href="Icinga2/Client.html#hosts_in_downtime-instance_method" title="Icinga2::Client#hosts_in_downtime (method)">#hosts_in_downtime</a></span>
450
474
  <small>Icinga2::Client</small>
@@ -452,7 +476,7 @@
452
476
  </li>
453
477
 
454
478
 
455
- <li class="even ">
479
+ <li class="odd ">
456
480
  <div class="item">
457
481
  <span class='object_link'><a href="Icinga2/Client.html#hosts_passive_checks_1min-instance_method" title="Icinga2::Client#hosts_passive_checks_1min (method)">#hosts_passive_checks_1min</a></span>
458
482
  <small>Icinga2::Client</small>
@@ -460,7 +484,7 @@
460
484
  </li>
461
485
 
462
486
 
463
- <li class="odd ">
487
+ <li class="even ">
464
488
  <div class="item">
465
489
  <span class='object_link'><a href="Icinga2/Client.html#hosts_problems-instance_method" title="Icinga2::Client#hosts_problems (method)">#hosts_problems</a></span>
466
490
  <small>Icinga2::Client</small>
@@ -468,6 +492,14 @@
468
492
  </li>
469
493
 
470
494
 
495
+ <li class="odd ">
496
+ <div class="item">
497
+ <span class='object_link'><a href="Icinga2/Client.html#hosts_problems_down-instance_method" title="Icinga2::Client#hosts_problems_down (method)">#hosts_problems_down</a></span>
498
+ <small>Icinga2::Client</small>
499
+ </div>
500
+ </li>
501
+
502
+
471
503
  <li class="even ">
472
504
  <div class="item">
473
505
  <span class='object_link'><a href="Icinga2/Client.html#hosts_up-instance_method" title="Icinga2::Client#hosts_up (method)">#hosts_up</a></span>
@@ -765,6 +797,14 @@
765
797
 
766
798
 
767
799
  <li class="odd ">
800
+ <div class="item">
801
+ <span class='object_link'><a href="Icinga2/Status.html#status_data-instance_method" title="Icinga2::Status#status_data (method)">#status_data</a></span>
802
+ <small>Icinga2::Status</small>
803
+ </div>
804
+ </li>
805
+
806
+
807
+ <li class="even ">
768
808
  <div class="item">
769
809
  <span class='object_link'><a href="Icinga2/Services.html#unhandled_services-instance_method" title="Icinga2::Services#unhandled_services (method)">#unhandled_services</a></span>
770
810
  <small>Icinga2::Services</small>
@@ -772,7 +812,7 @@
772
812
  </li>
773
813
 
774
814
 
775
- <li class="even ">
815
+ <li class="odd ">
776
816
  <div class="item">
777
817
  <span class='object_link'><a href="Icinga2/Services.html#update_host-instance_method" title="Icinga2::Services#update_host (method)">#update_host</a></span>
778
818
  <small>Icinga2::Services</small>
@@ -780,7 +820,7 @@
780
820
  </li>
781
821
 
782
822
 
783
- <li class="odd ">
823
+ <li class="even ">
784
824
  <div class="item">
785
825
  <span class='object_link'><a href="Icinga2/Client.html#uptime-instance_method" title="Icinga2::Client#uptime (method)">#uptime</a></span>
786
826
  <small>Icinga2::Client</small>
@@ -788,7 +828,7 @@
788
828
  </li>
789
829
 
790
830
 
791
- <li class="even ">
831
+ <li class="odd ">
792
832
  <div class="item">
793
833
  <span class='object_link'><a href="Icinga2/Usergroups.html#usergroups-instance_method" title="Icinga2::Usergroups#usergroups (method)">#usergroups</a></span>
794
834
  <small>Icinga2::Usergroups</small>
@@ -796,7 +836,7 @@
796
836
  </li>
797
837
 
798
838
 
799
- <li class="odd ">
839
+ <li class="even ">
800
840
  <div class="item">
801
841
  <span class='object_link'><a href="Icinga2/Users.html#users-instance_method" title="Icinga2::Users#users (method)">#users</a></span>
802
842
  <small>Icinga2::Users</small>
@@ -804,7 +844,7 @@
804
844
  </li>
805
845
 
806
846
 
807
- <li class="even ">
847
+ <li class="odd ">
808
848
  <div class="item">
809
849
  <span class='object_link'><a href="Icinga2/Client.html#version-instance_method" title="Icinga2::Client#version (method)">#version</a></span>
810
850
  <small>Icinga2::Client</small>
@@ -812,6 +852,14 @@
812
852
  </li>
813
853
 
814
854
 
855
+ <li class="even ">
856
+ <div class="item">
857
+ <span class='object_link'><a href="Icinga2/Status.html#work_queue_statistics-instance_method" title="Icinga2::Status#work_queue_statistics (method)">#work_queue_statistics</a></span>
858
+ <small>Icinga2::Status</small>
859
+ </div>
860
+ </li>
861
+
862
+
815
863
 
816
864
  </ul>
817
865
  </div>
@@ -100,7 +100,7 @@
100
100
  </div>
101
101
 
102
102
  <div id="footer">
103
- Generated on Sun Jun 18 15:20:36 2017 by
103
+ Generated on Wed Jun 28 05:55:20 2017 by
104
104
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
105
105
  0.9.9 (ruby-2.3.4).
106
106
  </div>
data/examples/test.rb CHANGED
@@ -53,38 +53,40 @@ unless( i.nil? )
53
53
  puts ''
54
54
  puts 'API Listener'
55
55
  puts i.api_listener
56
- puts ''
57
56
 
57
+ puts ''
58
58
  puts format( 'version: %s, revision %s', i.version, i.revision )
59
59
  puts format( 'start time: %s', i.start_time )
60
60
  puts format( 'uptime: %s', i.uptime )
61
+
61
62
  puts ''
62
- puts format( 'all hosts: %d', i.hosts_all )
63
- puts format( 'host down %d', i.hosts_down )
64
- puts format( 'hosts handled warning problems: %d', i.hosts_handled_warning_problems )
65
- puts format( 'hosts handled critical problems: %d', i.hosts_handled_critical_problems )
66
- puts format( 'hosts handled unknown problems: %d', i.hosts_handled_unknown_problems )
63
+ puts format( 'count of all hosts: %d', i.hosts_all )
64
+ puts format( 'host down: %d', i.hosts_down )
65
+ puts format( 'hosts problems down: %d', i.hosts_problems_down )
66
+
67
67
  puts ''
68
- puts format( 'all services: %d', i.services_all )
69
- puts format( 'services critical %d', i.services_critical)
70
- puts format( 'services warning %d', i.services_warning)
71
- puts format( 'services unknown %d', i.services_unknown)
72
- puts format( 'services handled warning problems %d', i.services_handled_warning_problems)
73
- puts format( 'services handled critical problems %d', i.services_handled_critical_problems)
74
- puts format( 'services handled unknown problems %d', i.services_handled_unknown_problems)
75
- puts format( 'services adjusted critical %d', i.services_critical_adjusted)
76
- puts format( 'services adjusted warning %d', i.services_warning_adjusted)
77
- puts format( 'services adjusted unknown %d', i.services_unknown_adjusted)
68
+ puts format( 'count of all services: %d', i.services_all )
69
+ puts format( 'services critical: %d', i.services_critical)
70
+ puts format( 'services warning: %d', i.services_warning)
71
+ puts format( 'services unknown: %d', i.services_unknown)
72
+ puts ''
73
+ puts format( 'services handled warning problems: %d', i.services_handled_warning_problems)
74
+ puts format( 'services handled critical problems: %d', i.services_handled_critical_problems)
75
+ puts format( 'services handled unknown problems: %d', i.services_handled_unknown_problems)
76
+ puts ''
77
+ puts format( 'services adjusted critical: %d', i.services_critical_adjusted)
78
+ puts format( 'services adjusted warning: %d', i.services_warning_adjusted)
79
+ puts format( 'services adjusted unknown: %d', i.services_unknown_adjusted)
78
80
  puts ''
79
81
 
80
82
  puts 'check if Host \'icinga2\' exists'
81
83
  puts i.exists_host?( 'icinga2' ) ? 'true' : 'false'
82
84
  puts ''
83
85
  puts 'get host Objects'
84
- puts i.hosts_objects
86
+ puts i.host_objects
85
87
  puts ''
86
88
  puts 'Host problems'
87
- puts i.hosts_problems
89
+ puts i.host_problems
88
90
  puts ''
89
91
  puts 'Problem Hosts'
90
92
  puts i.problem_hosts
@@ -117,13 +119,14 @@ unless( i.nil? )
117
119
  puts i.exists_service?( host: 'icinga2', service: 'users' ) ? 'true' : 'false'
118
120
  puts ''
119
121
  puts 'get service Objects'
120
- puts i.services_objects
122
+ puts i.service_objects
121
123
  puts ''
122
124
  puts 'Service problems'
123
- puts i.services_problems
125
+ puts i.service_problems
124
126
  puts ''
125
127
  puts 'Problem Services'
126
- puts i.problem_services
128
+ a,_b = i.problem_services
129
+ puts a
127
130
  puts ''
128
131
  puts i.problem_services(10)
129
132
  puts ''
@@ -192,24 +195,27 @@ unless( i.nil? )
192
195
  puts i.notifications
193
196
  puts ''
194
197
  puts 'enable Notifications for host'
195
- puts i.enable_hosts_notification( 'icinga2' )
198
+ puts i.enable_host_notification( 'icinga2' )
196
199
  puts ''
197
200
  puts 'disable Notifications for host'
198
- puts i.disable_hosts_notification( 'icinga2' )
201
+ puts i.disable_host_notification( 'icinga2' )
199
202
  puts ''
200
203
  puts 'enable Notifications for host and services'
201
- puts i.enable_services_notification('icinga2')
204
+ puts i.enable_service_notification('icinga2')
202
205
  puts ''
203
206
  puts 'disable Notifications for host and services'
204
- puts i.disable_services_notification( 'icinga2' )
207
+ puts i.disable_service_notification( 'icinga2' )
205
208
  puts ''
206
209
  puts 'enable Notifications for hostgroup'
207
- puts i.enable_hostgroup_notification( host: 'icinga2', hosts_group: 'linux-servers')
210
+ puts i.enable_hostgroup_notification( host: 'icinga2', host_group: 'linux-servers')
208
211
  puts ''
209
212
  puts 'disable Notifications for hostgroup'
210
- puts i.disable_hostgroup_notification( host: 'icinga2', hosts_group: 'linux-servers')
213
+ puts i.disable_hostgroup_notification( host: 'icinga2', host_group: 'linux-servers')
211
214
  puts ''
212
215
 
216
+ puts 'work queue statistics'
217
+ puts i.work_queue_statistics
218
+
213
219
  end
214
220
 
215
221
  # -----------------------------------------------------------------------------
data/lib/icinga2/hosts.rb CHANGED
@@ -224,7 +224,7 @@ module Icinga2
224
224
  data = JSON.parse(data) if data.is_a?(String)
225
225
  nodes = data.dig(:nodes)
226
226
 
227
- unless !nodes
227
+ unless( nodes.nil? )
228
228
 
229
229
  nodes.each do |n|
230
230
 
@@ -261,7 +261,7 @@ module Icinga2
261
261
  host_data = JSON.parse( host_data ) if host_data.is_a?(String)
262
262
  host_data = host_data.dig(:nodes)
263
263
 
264
- unless !host_data
264
+ unless( host_data.nil? )
265
265
 
266
266
  host_data.each do |_host,v|
267
267
 
@@ -49,13 +49,8 @@ module Icinga2
49
49
  result[:data] ||={}
50
50
 
51
51
  results.each do |r|
52
-
53
- # puts JSON.pretty_generate r
54
- # name = r.dig('name')
55
52
  attrs = r.dig('attrs')
56
-
57
53
  if( !attrs.nil? )
58
-
59
54
  result[:data][attrs['name']] = {
60
55
  name: attrs['name'],
61
56
  display_name: attrs['display_name'],
@@ -90,11 +85,11 @@ module Icinga2
90
85
  sleep( 4 )
91
86
  retry
92
87
  else
93
- $stderr.puts( 'Exiting request ...' )
88
+ $stderr.puts(format( "Maximum retries (%d) against '%s' reached. Giving up ...", max_retries, url ))
94
89
 
95
90
  return {
96
91
  status: 500,
97
- message: format( 'Errno::ECONNREFUSED for request: %s', url )
92
+ message: format( "Maximum retries (%d) against '%s' reached. Giving up ...", max_retries, url )
98
93
  }
99
94
  end
100
95
  end
@@ -102,6 +97,90 @@ module Icinga2
102
97
  result
103
98
  end
104
99
 
100
+ # static function for GET Requests without filters
101
+ #
102
+ # @param [Hash] params
103
+ # @option params [String] :host
104
+ # @option params [String] :url
105
+ # @option params [String] :headers
106
+ # @option params [String] :options
107
+ # @option params [Hash] :payload
108
+ #
109
+ #
110
+ # @return [Hash]
111
+ #
112
+ def self.get_raw( params = {} )
113
+
114
+ host = params.dig(:host)
115
+ url = params.dig(:url)
116
+ headers = params.dig(:headers)
117
+ options = params.dig(:options)
118
+ payload = params.dig(:payload) || {}
119
+ result = {}
120
+ max_retries = 30
121
+ times_retried = 0
122
+
123
+ return get_with_payload( params ) if payload.count >= 1
124
+
125
+ headers.delete( 'X-HTTP-Method-Override' )
126
+
127
+ result = {}
128
+
129
+ rest_client = RestClient::Resource.new(
130
+ URI.encode( url ),
131
+ options
132
+ )
133
+
134
+ begin
135
+
136
+ data = rest_client.get( headers )
137
+ results = JSON.parse( data.body )
138
+ results = results.dig('results')
139
+
140
+ result[:status] = 200
141
+ result[:data] ||={}
142
+
143
+ results.each do |r|
144
+
145
+ r.reject! { |x| x == 'perfdata' }
146
+ result[:data][r.dig('name')] = r.dig('status')
147
+ end
148
+
149
+ rescue RestClient::ExceptionWithResponse => e
150
+
151
+ error = e.response ? e.response : nil
152
+ error = JSON.parse( error )
153
+
154
+ result = {
155
+ status: error['error'].to_i,
156
+ name: host,
157
+ message: error['status']
158
+ }
159
+ rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH => e
160
+
161
+ if( times_retried < max_retries )
162
+
163
+ times_retried += 1
164
+ $stderr.puts(format( 'Cannot execute request %s', url ))
165
+ $stderr.puts(format( ' cause: %s', e ))
166
+ $stderr.puts(format( ' retry %d / %d', times_retried, max_retries ))
167
+
168
+ sleep( 4 )
169
+ retry
170
+ else
171
+ $stderr.puts(format( "Maximum retries (%d) against '%s' reached. Giving up ...", max_retries, url ))
172
+
173
+ return {
174
+ status: 500,
175
+ message: format( "Maximum retries (%d) against '%s' reached. Giving up ...", max_retries, url )
176
+ }
177
+ end
178
+ end
179
+
180
+ result
181
+ end
182
+
183
+
105
184
  # static function for GET Requests with payload
106
185
  # internal we use here an POST Request and overwrite a http header
107
186
  #
@@ -145,7 +145,7 @@ module Icinga2
145
145
  payload = {}
146
146
 
147
147
  if( attrs.nil? )
148
- attrs = ['name', 'state', 'acknowledgement', 'downtime_depth', 'last_check']
148
+ attrs = %w[name state acknowledgement downtime_depth last_check]
149
149
  end
150
150
 
151
151
  if( joins.nil? )
@@ -179,7 +179,8 @@ module Icinga2
179
179
  data = JSON.parse(data) if data.is_a?(String)
180
180
  nodes = data.dig(:nodes)
181
181
 
182
- unless !nodes
182
+ unless( nodes.nil? )
183
+
183
184
  nodes.each do |n|
184
185
  attrs = n.last.dig('attrs')
185
186
  state = attrs.dig('state') || 0
@@ -205,8 +206,8 @@ module Icinga2
205
206
  #
206
207
  def problem_services( max_items = 5 )
207
208
 
208
- @service_problems = {}
209
- @service_problems_severity = {}
209
+ service_problems = {}
210
+ service_problems_severity = {}
210
211
 
211
212
  # only fetch the minimal attribute set required for severity calculation
212
213
  services_data = service_objects
@@ -217,7 +218,7 @@ module Icinga2
217
218
 
218
219
  services_data = services_data.dig(:nodes)
219
220
 
220
- unless !services_data
221
+ unless( services_data.nil? )
221
222
 
222
223
  services_data.each do |_service,v|
223
224
 
@@ -225,13 +226,14 @@ module Icinga2
225
226
  state = v.dig('attrs','state')
226
227
  next if state.zero?
227
228
 
228
- @service_problems[name] = service_severity(v)
229
+ service_problems[name] = service_severity(v)
229
230
  end
230
231
 
231
- @service_problems.sort.reverse!
232
- @service_problems.keys[1..max_items].each { |k,_v| @service_problems_severity[k] = @service_problems[k] }
232
+ service_problems.sort.reverse!
233
+ service_problems = service_problems.keys[1..max_items].each { |k,_v| service_problems_severity[k] = service_problems[k] }
233
234
  end
234
- @service_problems_severity
235
+
236
+ [service_problems, service_problems_severity]
235
237
  end
236
238
 
237
239
  # update host
@@ -19,7 +19,6 @@ module Icinga2
19
19
  url: format( '%s/v1/status/IcingaApplication', @icinga_api_url_base ),
20
20
  headers: @headers,
21
21
  options: @options)
22
-
23
22
  end
24
23
 
25
24
  # return Icinga2 CIB
@@ -38,6 +37,22 @@ module Icinga2
38
37
 
39
38
  end
40
39
 
40
+ #
41
+ #
42
+ #
43
+ def status_data
44
+
45
+ data = Network.get_raw(host: nil,
46
+ url: format( '%s/v1/status', @icinga_api_url_base ),
47
+ headers: @headers,
48
+ options: @options)
49
+
50
+ return nil unless data.dig(:status) != 200
51
+
52
+ data.dig('results')
53
+
54
+ end
55
+
41
56
  # return Icinga2 API Listener
42
57
  #
43
58
  # @example
@@ -54,6 +69,47 @@ module Icinga2
54
69
 
55
70
  end
56
71
 
72
+ # return queue statistics from the api
73
+ #
74
+ # @example
75
+ # @icinga.work_queue_statistics
76
+ #
77
+ # @return [Hash]
78
+ #
79
+ def work_queue_statistics
80
+
81
+ stats = {}
82
+ data = Network.get_raw(host: nil,
83
+ url: format( '%s/v1/status', @icinga_api_url_base ),
84
+ headers: @headers,
85
+ options: @options)
86
+
87
+ return stats if data.nil?
88
+
89
+ data = data.dig(:data)
90
+
91
+ a = {
92
+ 'json-rpc' => data.dig('ApiListener', 'api', 'json_rpc'),
93
+ 'graphite' => data.dig('GraphiteWriter', 'graphitewriter', 'graphite'),
94
+ 'ido-mysql' => data.dig('IdoMysqlConnection', 'idomysqlconnection', 'ido-mysql')
95
+ }
96
+
97
+ key_list = %w[work_queue_item_rate query_queue_item_rate]
98
+
99
+ a.each do |k,v|
100
+ key_list.each do |key|
101
+ if( v.include?( key ))
102
+ attr_name = format('%s queue rate', k)
103
+ stats[attr_name] = v[key].to_f.round(3)
104
+ end
105
+ end
106
+ end
107
+
108
+ stats
109
+
110
+ end
111
+
112
+
57
113
  # extract many datas from application_data and cib_data
58
114
  # and store them in global variables
59
115
  #
@@ -65,7 +121,7 @@ module Icinga2
65
121
 
66
122
  a_data = a_data.dig('status','icingaapplication','app')
67
123
 
68
- if( !a_data.nil? )
124
+ unless( a_data.nil? )
69
125
 
70
126
  # extract
71
127
  # - version
@@ -85,7 +141,7 @@ module Icinga2
85
141
 
86
142
  c_data = c_data.dig('status')
87
143
 
88
- if( !c_data.nil? )
144
+ unless( c_data.nil? )
89
145
 
90
146
  # extract
91
147
  # - uptime
@@ -107,14 +163,12 @@ module Icinga2
107
163
 
108
164
  @hosts_all = all_hosts.size
109
165
  @hosts_problems = host_problems
110
- @hosts_handled_warning_problems = handled_problems(all_hosts, Icinga2::HANDLED_WARNING)
111
- @hosts_handled_critical_problems = handled_problems(all_hosts, Icinga2::HANDLED_CRITICAL)
112
- @hosts_handled_unknown_problems = handled_problems(all_hosts, Icinga2::HANDLED_UNKNOWN)
166
+ @hosts_problems_down = handled_problems(h_objects, Icinga2::HOSTS_DOWN)
113
167
 
114
168
  # calculate host problems adjusted by handled problems
115
169
  # count togther handled host problems
116
- @hosts_handled_problems = @hosts_handled_warning_problems + @hosts_handled_critical_problems + @hosts_handled_unknown_problems
117
- @hosts_down_adjusted = @hosts_down - @hosts_handled_problems
170
+ # @hosts_handled_problems = @hosts_handled_warning_problems + @hosts_handled_critical_problems + @hosts_handled_unknown_problems
171
+ # @hosts_down_adjusted = @hosts_down - @hosts_handled_problems
118
172
 
119
173
  # - services
120
174
  @services_ok = c_data.dig('num_services_ok').to_i
@@ -129,9 +183,9 @@ module Icinga2
129
183
 
130
184
  @services_all = all_services.size
131
185
  @services_problems = service_problems
132
- @services_handled_warning_problems = handled_problems(all_services, Icinga2::HANDLED_WARNING)
133
- @services_handled_critical_problems = handled_problems(all_services, Icinga2::HANDLED_CRITICAL)
134
- @services_handled_unknown_problems = handled_problems(all_services, Icinga2::HANDLED_UNKNOWN)
186
+ @services_handled_warning_problems = handled_problems(s_objects, Icinga2::SERVICE_STATE_WARNING)
187
+ @services_handled_critical_problems = handled_problems(s_objects, Icinga2::SERVICE_STATE_CRITICAL)
188
+ @services_handled_unknown_problems = handled_problems(s_objects, Icinga2::SERVICE_STATE_UNKNOWN)
135
189
 
136
190
  # calculate service problems adjusted by handled problems
137
191
  @services_warning_adjusted = @services_warning - @services_handled_warning_problems
@@ -144,6 +198,8 @@ module Icinga2
144
198
  @hosts_passive_checks_1min = c_data.dig('passive_host_checks_1min')
145
199
  @services_active_checks_1min = c_data.dig('active_service_checks_1min')
146
200
  @services_passive_checks_1min = c_data.dig('passive_service_checks_1min')
201
+
202
+ @service_problems, @service_problems_severity = problem_services
147
203
  end
148
204
  end
149
205
  end
data/lib/icinga2/tools.rb CHANGED
@@ -50,17 +50,13 @@ module Icinga2
50
50
  #
51
51
  # @example for host objects
52
52
  # h_objects = @icinga.host_objects
53
- # all_hosts = h_objects.dig(:nodes)
54
- # warning = @icinga.handled_problems(all_hosts, Icinga2::HANDLED_WARNING)
55
- # critical = @icinga.handled_problems(all_hosts, Icinga2::HANDLED_CRITICAL)
56
- # unknown = @icinga.handled_problems(all_hosts, Icinga2::HANDLED_UNKNOWN)
53
+ # warning = @icinga.handled_problems(h_objects, Icinga2::HOSTS_DOWN)
57
54
  #
58
55
  # @example for service objects
59
56
  # s_objects = @icinga.service_objects
60
- # all_services = s_objects.dig(:nodes)
61
- # warning = @icinga.handled_problems(all_services, Icinga2::HANDLED_WARNING)
62
- # critical = @icinga.handled_problems(all_services, Icinga2::HANDLED_CRITICAL)
63
- # unknown = @icinga.handled_problems(all_services, Icinga2::HANDLED_UNKNOWN)
57
+ # warning = @icinga.handled_problems(s_objects, Icinga2::SERVICE_STATE_WARNING)
58
+ # critical = @icinga.handled_problems(s_objects, Icinga2::SERVICE_STATE_CRITICAL)
59
+ # unknown = @icinga.handled_problems(s_objects, Icinga2::SERVICE_STATE_UNKNOWN)
64
60
  #
65
61
  # @return [Integer]
66
62
  #
@@ -69,9 +65,9 @@ module Icinga2
69
65
  problems = 0
70
66
 
71
67
  objects = JSON.parse(objects) if objects.is_a?(String)
72
- nodes = objects.dig(:nodes)
68
+ nodes = objects.dig(:nodes)
73
69
 
74
- unless !nodes
70
+ unless( nodes.nil? )
75
71
 
76
72
  nodes.each do |n|
77
73
 
@@ -11,7 +11,7 @@ module Icinga2
11
11
  # minor part of version
12
12
  MINOR = 6
13
13
  # tiny part of version
14
- TINY = 4
14
+ TINY = 6
15
15
  # patch part
16
16
  PATCH = 0
17
17
 
data/lib/icinga2.rb CHANGED
@@ -31,12 +31,15 @@ require_relative 'icinga2/usergroups'
31
31
  # Namespace for classes and modules that handle all Icinga2 API calls
32
32
  module Icinga2
33
33
 
34
+ # static variable for hosts down
35
+ HOSTS_DOWN = 1
36
+
34
37
  # static variables for handled warning
35
- HANDLED_WARNING = 1
38
+ SERVICE_STATE_WARNING = 1
36
39
  # static variables for handled critical
37
- HANDLED_CRITICAL = 2
40
+ SERVICE_STATE_CRITICAL = 2
38
41
  # static variables for handled unknown
39
- HANDLED_UNKNOWN = 3
42
+ SERVICE_STATE_UNKNOWN = 3
40
43
 
41
44
  # Abstract base class for the API calls.
42
45
  # Provides some helper methods
@@ -48,7 +51,7 @@ module Icinga2
48
51
  attr_reader :version, :revision, :node_name, :start_time, :uptime
49
52
  attr_reader :avg_latency, :avg_execution_time
50
53
  attr_reader :hosts_up, :hosts_down, :hosts_in_downtime, :hosts_acknowledged
51
- attr_reader :hosts_all, :hosts_problems, :hosts_handled_warning_problems, :hosts_handled_critical_problems, :hosts_handled_unknown_problems
54
+ attr_reader :hosts_all, :hosts_problems, :hosts_problems_down, :hosts_handled_warning_problems, :hosts_handled_critical_problems, :hosts_handled_unknown_problems
52
55
  attr_reader :hosts_handled_problems, :hosts_down_adjusted
53
56
 
54
57
  attr_reader :services_ok, :services_warning, :services_critical, :services_unknown, :services_in_downtime, :services_acknowledged
@@ -56,8 +59,6 @@ module Icinga2
56
59
  attr_reader :services_warning_adjusted, :services_critical_adjusted, :services_unknown_adjusted
57
60
  attr_reader :hosts_active_checks_1min, :hosts_passive_checks_1min, :services_active_checks_1min, :services_passive_checks_1min
58
61
 
59
-
60
-
61
62
  include Logging
62
63
 
63
64
  include Icinga2::Version
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: icinga2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.4.0
4
+ version: 0.6.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bodo Schulz