icinga2 0.9.2.8 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -9
- data/doc/downtimes.md +39 -0
- data/lib/icinga2/actions.rb +152 -0
- data/lib/icinga2/client.rb +29 -22
- data/lib/icinga2/configuration_management.rb +312 -0
- data/lib/icinga2/downtimes.rb +72 -4
- data/lib/icinga2/hostgroups.rb +6 -6
- data/lib/icinga2/hosts.rb +23 -23
- data/lib/icinga2/network.rb +115 -10
- data/lib/icinga2/notifications.rb +17 -9
- data/lib/icinga2/servicegroups.rb +5 -5
- data/lib/icinga2/services.rb +32 -30
- data/lib/icinga2/statistics.rb +17 -14
- data/lib/icinga2/tools.rb +31 -10
- data/lib/icinga2/usergroups.rb +5 -5
- data/lib/icinga2/users.rb +5 -5
- data/lib/icinga2/validator.rb +40 -34
- data/lib/icinga2/version.rb +1 -3
- data/lib/monkey_patches.rb +67 -14
- data/spec/icinga2_spec.rb +1013 -0
- data/spec/spec_helper.rb +13 -0
- metadata +9 -22
- data/doc/Array.html +0 -200
- data/doc/Boolean.html +0 -122
- data/doc/FalseClass.html +0 -132
- data/doc/Hash.html +0 -332
- data/doc/Icinga2.html +0 -247
- data/doc/Logging.html +0 -328
- data/doc/Object.html +0 -286
- data/doc/Time.html +0 -200
- data/doc/TrueClass.html +0 -132
- data/doc/_index.html +0 -352
- data/doc/class_list.html +0 -51
- data/doc/examples +0 -122
- data/doc/file.README.html +0 -349
- data/doc/file_list.html +0 -56
- data/doc/frames.html +0 -17
- data/doc/index.html +0 -349
- data/doc/method_list.html +0 -755
- data/doc/top-level-namespace.html +0 -112
data/doc/class_list.html
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
5
|
-
<meta charset="utf-8" />
|
6
|
-
|
7
|
-
<link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" charset="utf-8" />
|
8
|
-
|
9
|
-
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
14
|
-
|
15
|
-
<script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
|
16
|
-
|
17
|
-
|
18
|
-
<title>Class List</title>
|
19
|
-
<base id="base_target" target="_parent" />
|
20
|
-
</head>
|
21
|
-
<body>
|
22
|
-
<div id="content">
|
23
|
-
<div class="fixed_header">
|
24
|
-
<h1 id="full_list_header">Class List</h1>
|
25
|
-
<div id="full_list_nav">
|
26
|
-
|
27
|
-
<span><a target="_self" href="class_list.html">
|
28
|
-
Classes
|
29
|
-
</a></span>
|
30
|
-
|
31
|
-
<span><a target="_self" href="method_list.html">
|
32
|
-
Methods
|
33
|
-
</a></span>
|
34
|
-
|
35
|
-
<span><a target="_self" href="file_list.html">
|
36
|
-
Files
|
37
|
-
</a></span>
|
38
|
-
|
39
|
-
</div>
|
40
|
-
|
41
|
-
<div id="search">Search: <input type="text" /></div>
|
42
|
-
</div>
|
43
|
-
|
44
|
-
<ul id="full_list" class="class">
|
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_Array' class='even'><div class='item' style='padding-left:30px'><span class='object_link'><a href="Array.html" title="Array (class)">Array</a></span> < Object<small class='search_info'>Top Level Namespace</small></div></li><li id='object_Boolean' class='odd'><div class='item' style='padding-left:30px'><span class='object_link'><a href="Boolean.html" title="Boolean (module)">Boolean</a></span><small class='search_info'>Top Level Namespace</small></div></li><li id='object_FalseClass' class='even'><div class='item' style='padding-left:30px'><span class='object_link'><a href="FalseClass.html" title="FalseClass (class)">FalseClass</a></span> < Object<small class='search_info'>Top Level Namespace</small></div></li><li id='object_Hash' class='odd'><div class='item' style='padding-left:30px'><span class='object_link'><a href="Hash.html" title="Hash (class)">Hash</a></span> < Object<small class='search_info'>Top Level Namespace</small></div></li><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> < 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::Validator' class='collapsed even'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Icinga2/Validator.html" title="Icinga2::Validator (module)">Validator</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><li id='object_Object' class='even'><div class='item' style='padding-left:30px'><span class='object_link'><a href="Object.html" title="Object (class)">Object</a></span> < BasicObject<small class='search_info'>Top Level Namespace</small></div></li><li id='object_Time' class='odd'><div class='item' style='padding-left:30px'><span class='object_link'><a href="Time.html" title="Time (class)">Time</a></span> < Object<small class='search_info'>Top Level Namespace</small></div></li><li id='object_TrueClass' class='even'><div class='item' style='padding-left:30px'><span class='object_link'><a href="TrueClass.html" title="TrueClass (class)">TrueClass</a></span> < Object<small class='search_info'>Top Level Namespace</small></div></li>
|
47
|
-
|
48
|
-
</ul>
|
49
|
-
</div>
|
50
|
-
</body>
|
51
|
-
</html>
|
data/doc/examples
DELETED
@@ -1,122 +0,0 @@
|
|
1
|
-
|
2
|
-
To add hostgroup :
|
3
|
-
|
4
|
-
curl -k -s -u icingaadmin:icinga 'https://localhost:5665/v1/objects/hostgroups/testgrp' \
|
5
|
-
-X PUT -d '{ "attrs": { "name" : "testgrp" ,"display_name" : "testgrp" , "state_loaded" :true }}'
|
6
|
-
|
7
|
-
To add host :
|
8
|
-
|
9
|
-
curl -k -s -u icingaadmin:icinga 'https://localhost:5665/v1/objects/hosts/8.8.8.8' \
|
10
|
-
-X PUT -d '{ "templates": [ "generic-host" ], "attrs": { "address": "8.8.8.8" , "groups" : [ "testgrp" ]} }'
|
11
|
-
|
12
|
-
|
13
|
-
https://localhost:5665/v1/objects/users
|
14
|
-
https://localhost:5665/v1/objects/usergroups
|
15
|
-
|
16
|
-
|
17
|
-
https://localhost:5665/v1/objects/hostgroups
|
18
|
-
https://localhost:5665/v1/objects/servicegroups
|
19
|
-
|
20
|
-
https://localhost:5665/v1/objects/hosts
|
21
|
-
https://localhost:5665/v1/objects/services
|
22
|
-
|
23
|
-
# list service from host
|
24
|
-
curl -k -u root:icinga -H 'Accept: application/json' -X GET 'https://localhost:5665/v1/objects/services/pandora-17-01!Runlevel-master-live-server'
|
25
|
-
|
26
|
-
|
27
|
-
https://localhost:5665/v1/objects/notifications
|
28
|
-
|
29
|
-
# get usergroups:
|
30
|
-
curl -k -s -u root:icinga -H 'Accept: application/json' -X GET 'https://localhost:5665/v1/objects/usergroups'
|
31
|
-
|
32
|
-
# add usergroup:
|
33
|
-
curl -k -s -u root:icinga -H 'Accept: application/json' -X PUT 'https://localhost:5665/v1/objects/usergroups/foo' --data '{ "attrs": {"display_name": "Foo Bar" } }'
|
34
|
-
|
35
|
-
# delete usergroup:
|
36
|
-
curl -k -s -u root:icinga -H 'Accept: application/json' -H 'X-HTTP-Method-Override: DELETE' -X POST 'https://localhost:5665/v1/objects/usergroups/foo'
|
37
|
-
|
38
|
-
|
39
|
-
# delete user:
|
40
|
-
curl -k -s -u root:icinga -H 'Accept: application/json' -H 'X-HTTP-Method-Override: DELETE' -X POST 'https://localhost:5665/v1/objects/users/foo'
|
41
|
-
|
42
|
-
# add user:
|
43
|
-
curl -k -s -u root:icinga -H 'Accept: application/json' -X PUT 'https://localhost:5665/v1/objects/users/foo' --data '{ "attrs": {"display_name": "Foo Bar", "email": "foo.bar@coremedia.com","enable_notifications": false, "groups": [ "coreme
|
44
|
-
dia" ] } }'
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
# add notification
|
49
|
-
curl -k -s -u root:icinga -H 'Accept: application/json' \
|
50
|
-
-X PUT 'https://localhost:5665/v1/objects/notifications/debian7.example.com!jabber' -d '{
|
51
|
-
"attrs": {
|
52
|
-
"command":"mail-service-notification",
|
53
|
-
"service_name":"apt",
|
54
|
-
"user_groups": ["icingaadmins"] } }'
|
55
|
-
|
56
|
-
|
57
|
-
# delete notification
|
58
|
-
curl -k -s -u root:icinga -H 'Accept: application/json' \
|
59
|
-
-H 'X-HTTP-Method-Override: DELETE' \
|
60
|
-
-X POST 'https://localhost:5665/v1/objects/notifications/debian7.example.com!apt!jabber?cascade=1'
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
# enable notification für host:
|
67
|
-
curl -k -s -u root:icinga -H 'Accept: application/json' -X POST 'https://localhost:5665/v1/objects/hosts/api_dummy_host_1' --data '{ "attrs": { "enable_notifications": true } }'
|
68
|
-
|
69
|
-
# disable notification für host:
|
70
|
-
curl -k -s -u root:icinga -H 'Accept: application/json' -X POST 'https://localhost:5665/v1/objects/hosts/api_dummy_host_1' --data '{ "attrs": { "enable_notifications": false } }'
|
71
|
-
|
72
|
-
# enable notification für service x von host:
|
73
|
-
curl -k -s -u root:icinga -H 'Accept: application/json' -X POST 'https://localhost:5665/v1/objects/services' --data '{ "filter": "host.name==\"api_dummy_host_1\"", "attrs": { "enable_notifications": true } }'
|
74
|
-
|
75
|
-
# disable notification für service x von host:
|
76
|
-
curl -k -s -u root:icinga -H 'Accept: application/json' -X POST 'https://localhost:5665/v1/objects/services' --data '{ "filter": "host.name==\"api_dummy_host_1\"", "attrs": { "enable_notifications": false } }'
|
77
|
-
|
78
|
-
# enable notification für hostgroup:
|
79
|
-
curl -k -s -u root:icinga -H 'Accept: application/json' -X POST 'https://localhost:5665/v1/objects/services' --data '{ "filter": "\"api_dummy_hostgroup\" in host.groups", "attrs": { "enable_notifications": true } }'
|
80
|
-
|
81
|
-
# disable notification für hostgroup:
|
82
|
-
curl -k -s -u root:icinga -H 'Accept: application/json' -X POST 'https://localhost:5665/v1/objects/services' --data '{ "filter": "\"api_dummy_hostgroup\" in host.groups", "attrs": { "enable_notifications": false } }'
|
83
|
-
|
84
|
-
|
85
|
-
# get downtimes
|
86
|
-
curl -k -s -u root:icinga -H 'Accept: application/json' -X GET 'https://localhost:5665/v1/objects/downtimes'
|
87
|
-
|
88
|
-
# delete named downtime
|
89
|
-
curl -k -s -u root:icinga -H 'Accept: application/json' -H 'X-HTTP-Method-Override: DELETE' -X POST 'https://localhost:5665/v1/objects/downtimes/icinga2-master!load!icinga2-master-1496045418-0'
|
90
|
-
|
91
|
-
|
92
|
-
# schedule downtime for a host
|
93
|
-
|
94
|
-
# current_time=$(date +%s)
|
95
|
-
# 1449057010
|
96
|
-
# current_time_add_30_second=$(date +%s --date="+30 seconds")
|
97
|
-
# 1449057040
|
98
|
-
curl -k -s -u root:icinga -H 'Accept: application/json' -X POST 'https://localhost:5665/v1/actions/schedule-downtime' \
|
99
|
-
--data '{ "type": "Host", "filter": "host.name==\"api_dummy_host_1\"", "start_time": 1449057685, "end_time": 1449057715, "author": "api_user", "comment": "api_comment", "fixed": true, "duration": 30 }'
|
100
|
-
|
101
|
-
# schedule downtime for all services of a host - change the timestamps accordingly
|
102
|
-
curl -k -s -u root:icinga -H 'Accept: application/json' -X POST 'https://localhost:5665/v1/actions/schedule-downtime' \
|
103
|
-
--data '{ "type": "Service", "filter": "host.name==\"api_dummy_host_1\"", "start_time": 1449064981, "end_time": 1449065129, "author": "api_user", "comment": "api_comment", "fixed": true, "duration": 30 }'
|
104
|
-
|
105
|
-
|
106
|
-
# schedule downtime for all hosts and services in a hostgroup - change the timestamps accordingly
|
107
|
-
curl -k -s -u root:icinga -H 'Accept: application/json' -X POST 'https://localhost:5665/v1/actions/schedule-downtime' \
|
108
|
-
--data '{ "type": "Host", "filter": "\"api_dummy_hostgroup\" in host.groups", "start_time": 1449065680, "end_time": 1449065823, "author": "api_user", "comment": "api_comment", "duration": 120, "fixed": true, "duration": 30 }'
|
109
|
-
|
110
|
-
curl -k -s -u root:icinga -H 'Accept: application/json' -X POST 'https://localhost:5665/v1/actions/schedule-downtime' \
|
111
|
-
--data '{ "type": "Service", "filter": "\"api_dummy_hostgroup\" in host.groups)", "start_time": 1449065680, "end_time": 1449065823, "author": "api_user", "comment": "api_comment", "duration": 120, "fixed": true, "duration": 30 }'
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
data/doc/file.README.html
DELETED
@@ -1,349 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<meta charset="UTF-8">
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
-
<title>
|
7
|
-
File: README
|
8
|
-
|
9
|
-
— Documentation by YARD 0.9.11
|
10
|
-
|
11
|
-
</title>
|
12
|
-
|
13
|
-
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
|
14
|
-
|
15
|
-
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
16
|
-
|
17
|
-
<script type="text/javascript" charset="utf-8">
|
18
|
-
pathId = "README";
|
19
|
-
relpath = '';
|
20
|
-
</script>
|
21
|
-
|
22
|
-
|
23
|
-
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
24
|
-
|
25
|
-
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
26
|
-
|
27
|
-
|
28
|
-
</head>
|
29
|
-
<body>
|
30
|
-
<div class="nav_wrap">
|
31
|
-
<iframe id="nav" src="file_list.html?1"></iframe>
|
32
|
-
<div id="resizer"></div>
|
33
|
-
</div>
|
34
|
-
|
35
|
-
<div id="main" tabindex="-1">
|
36
|
-
<div id="header">
|
37
|
-
<div id="menu">
|
38
|
-
|
39
|
-
<a href="_index.html">Index</a> »
|
40
|
-
<span class="title">File: README</span>
|
41
|
-
|
42
|
-
</div>
|
43
|
-
|
44
|
-
<div id="search">
|
45
|
-
|
46
|
-
<a class="full_list_link" id="class_list_link"
|
47
|
-
href="class_list.html">
|
48
|
-
|
49
|
-
<svg width="24" height="24">
|
50
|
-
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
51
|
-
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
52
|
-
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
-
</svg>
|
54
|
-
</a>
|
55
|
-
|
56
|
-
</div>
|
57
|
-
<div class="clear"></div>
|
58
|
-
</div>
|
59
|
-
|
60
|
-
<div id="content"><div id='filecontents'>
|
61
|
-
<h1 id="label-ruby-icinga2">ruby-icinga2</h1>
|
62
|
-
|
63
|
-
<p>An enhanced ruby gem to communicate with Icinga2 API</p>
|
64
|
-
|
65
|
-
<p><a href="https://badge.fury.io/rb/icinga2"><img
|
66
|
-
src="https://badge.fury.io/rb/icinga2.svg"></a></p>
|
67
|
-
|
68
|
-
<p><a href="https://travis-ci.org/bodsch/ruby-icinga2"><img
|
69
|
-
src="https://travis-ci.org/bodsch/ruby-icinga2.svg"></a> <a
|
70
|
-
href="http://ruby-gem-downloads-badge.herokuapp.com/icinga2"><img
|
71
|
-
src="http://ruby-gem-downloads-badge.herokuapp.com/icinga2"></a> <a
|
72
|
-
href="http://ruby-gem-downloads-badge.herokuapp.com/icinga2"><img
|
73
|
-
src="http://ruby-gem-downloads-badge.herokuapp.com/icinga2?type=total&metric=true&label=downloads-total"></a>
|
74
|
-
<a href="https://gemnasium.com/github.com/bodsch/ruby-icinga2"><img
|
75
|
-
src="https://gemnasium.com/badges/github.com/bodsch/ruby-icinga2.svg"></a></p>
|
76
|
-
|
77
|
-
<h2 id="label-Requirements">Requirements</h2>
|
78
|
-
<ul><li>
|
79
|
-
<p>ruby version => 2.0</p>
|
80
|
-
</li><li>
|
81
|
-
<p>rest-client ~> 2.0</p>
|
82
|
-
</li><li>
|
83
|
-
<p>json ~> 2.1</p>
|
84
|
-
</li><li>
|
85
|
-
<p>openssl ~> 2.0 (only with ruby >= 2.3)</p>
|
86
|
-
</li><li>
|
87
|
-
<p>ruby_dig (only with ruby < 2.3)</p>
|
88
|
-
</li></ul>
|
89
|
-
|
90
|
-
<h2 id="label-Install">Install</h2>
|
91
|
-
|
92
|
-
<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>
|
93
|
-
</code></pre>
|
94
|
-
|
95
|
-
<h2 id="label-Usage">Usage</h2>
|
96
|
-
|
97
|
-
<p>create an instance</p>
|
98
|
-
|
99
|
-
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>icinga2</span><span class='tstring_end'>'</span></span>
|
100
|
-
|
101
|
-
<span class='id identifier rubyid_config'>config</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
102
|
-
<span class='label'>icinga:</span> <span class='lbrace'>{</span>
|
103
|
-
<span class='label'>host:</span> <span class='id identifier rubyid_icinga_host'>icinga_host</span><span class='comma'>,</span>
|
104
|
-
<span class='label'>api:</span> <span class='lbrace'>{</span>
|
105
|
-
<span class='label'>port:</span> <span class='id identifier rubyid_icinga_api_port'>icinga_api_port</span><span class='comma'>,</span>
|
106
|
-
<span class='label'>username:</span> <span class='id identifier rubyid_icinga_api_user'>icinga_api_user</span><span class='comma'>,</span>
|
107
|
-
<span class='label'>password:</span> <span class='id identifier rubyid_icinga_api_pass'>icinga_api_pass</span>
|
108
|
-
<span class='rbrace'>}</span>
|
109
|
-
<span class='rbrace'>}</span>
|
110
|
-
<span class='rbrace'>}</span>
|
111
|
-
|
112
|
-
<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>
|
113
|
-
</code></pre>
|
114
|
-
|
115
|
-
<h3 id="label-Use+the+examples">Use the examples</h3>
|
116
|
-
|
117
|
-
<p>You can use the <a href="https://github.com/Icinga/icinga-vagrant">Icinga
|
118
|
-
Vagrant-Box</a> from the Icinga Team or my own <a
|
119
|
-
href="https://hub.docker.com/r/bodsch/docker-icinga2/">Docker Container</a>
|
120
|
-
as Datasource.</p>
|
121
|
-
|
122
|
-
<p><strong>Remember</strong> Change the exported Environment Variables to your
|
123
|
-
choosed Datasource!</p>
|
124
|
-
|
125
|
-
<p>you can find many examples under the directory <code>examples</code>:</p>
|
126
|
-
|
127
|
-
<pre class="code ruby"><code class="ruby">$ export ICINGA_HOST=localhost ; export ICINGA_API_USER=root ; export ICINGA_API_PASSWORD=icinga
|
128
|
-
$ ruby examples/informations.rb
|
129
|
-
$ ruby examples/statistics.rb
|
130
|
-
$ ruby examples/users.rb</code></pre>
|
131
|
-
|
132
|
-
<p>and so on.</p>
|
133
|
-
|
134
|
-
<h3 id="label-Test+via+CLI">Test via CLI</h3>
|
135
|
-
|
136
|
-
<pre class="code ruby"><code class="ruby">$ irb
|
137
|
-
irb(main):001:0> require 'icinga2'
|
138
|
-
=> true
|
139
|
-
irb(main):002:0> config = { icinga: { host: 'localhost', api: { username: 'root', password: 'icinga' } } }
|
140
|
-
=> {:icinga=>{:host=>"localhost", :api=>{:username=>"root", :password=>"icinga"}}}
|
141
|
-
irb(main):003:0> i = Icinga2::Client.new( config )
|
142
|
-
irb(main):004:0> i.available?
|
143
|
-
=> true
|
144
|
-
irb(main):005:0></code></pre>
|
145
|
-
|
146
|
-
<h2 id="label-Create+a+own+gem+file">Create a own gem file</h2>
|
147
|
-
|
148
|
-
<pre class="code ruby"><code class="ruby">$ gem build icinga2.gemspec
|
149
|
-
Successfully built RubyGem
|
150
|
-
Name: icinga2
|
151
|
-
Version: 0.9.2.7
|
152
|
-
File: icinga2-0.9.2.7.gem</code></pre>
|
153
|
-
|
154
|
-
<h2 id="label-Install+local+gem">Install local gem</h2>
|
155
|
-
|
156
|
-
<pre class="code ruby"><code class="ruby">$ gem install icinga2
|
157
|
-
Successfully installed icinga2-0.9.2.7
|
158
|
-
1 gem installed</code></pre>
|
159
|
-
|
160
|
-
<h2 id="label-Status">Status</h2>
|
161
|
-
|
162
|
-
<p>supports the following API Calls:</p>
|
163
|
-
<ul><li>
|
164
|
-
<p><a href="doc/users.md">Users</a></p>
|
165
|
-
<ul><li>
|
166
|
-
<p><a href="doc/users.md#add-user">add user</a></p>
|
167
|
-
</li><li>
|
168
|
-
<p><a href="doc/users.md#delete-dser">delete user</a></p>
|
169
|
-
</li><li>
|
170
|
-
<p><a href="doc/users.md#list-users">list users</a></p>
|
171
|
-
</li><li>
|
172
|
-
<p><a href="doc/users.md#user-exists">check if user exists</a></p>
|
173
|
-
</li><li>
|
174
|
-
<p><a href="doc/users.md#add-user">add user</a></p>
|
175
|
-
</li><li>
|
176
|
-
<p><a href="doc/users.md#delete-dser">delete user</a></p>
|
177
|
-
</li><li>
|
178
|
-
<p><a href="doc/users.md#list-users">list users</a></p>
|
179
|
-
</li><li>
|
180
|
-
<p><a href="doc/users.md#user-exists">check if user exists</a></p>
|
181
|
-
</li></ul>
|
182
|
-
</li><li>
|
183
|
-
<p><a href="doc/usergroups.md">Usergroups</a></p>
|
184
|
-
<ul><li>
|
185
|
-
<p><a href="doc/usergroups.md#add-usergroup">add usergroup</a></p>
|
186
|
-
</li><li>
|
187
|
-
<p><a href="doc/usergroups.md#delete-usergroup">delete usergroup</a></p>
|
188
|
-
</li><li>
|
189
|
-
<p><a href="doc/usergroups.md#list-usergroups">list usergroups</a></p>
|
190
|
-
</li><li>
|
191
|
-
<p><a href="doc/usergroups.md#usergroup-exists">check if usergroup exists</a></p>
|
192
|
-
</li></ul>
|
193
|
-
</li><li>
|
194
|
-
<p><a href="doc/hosts.md">Hosts</a></p>
|
195
|
-
<ul><li>
|
196
|
-
<p><a href="doc/hosts.md#add-host">add host</a></p>
|
197
|
-
</li><li>
|
198
|
-
<p><a href="doc/hosts.md#delete-host">delete host</a></p>
|
199
|
-
</li><li>
|
200
|
-
<p><a href="doc/hosts.md#modify-host">modify host</a></p>
|
201
|
-
</li><li>
|
202
|
-
<p><a href="doc/hosts.md#list-hosts">list hosts</a></p>
|
203
|
-
</li><li>
|
204
|
-
<p><a href="doc/hosts.md#host-exists">check if host exists</a></p>
|
205
|
-
</li><li>
|
206
|
-
<p><a href="doc/hosts.md#list-host-objects">list host objects</a></p>
|
207
|
-
</li><li>
|
208
|
-
<p><a href="doc/hosts.md#count-hosts-with-problems">count of hosts with
|
209
|
-
problems</a></p>
|
210
|
-
</li><li>
|
211
|
-
<p><a href="doc/hosts.md#list-hosts-with-problems">list of hosts with
|
212
|
-
problems</a></p>
|
213
|
-
</li><li>
|
214
|
-
<p><a href="doc/hosts.md#count-all-hosts">count of all hosts</a></p>
|
215
|
-
</li><li>
|
216
|
-
<p><a href="doc/hosts.md#count-host-problems">count hosts with problems</a></p>
|
217
|
-
</li><li>
|
218
|
-
<p>calculate host severity (protected)</p>
|
219
|
-
</li></ul>
|
220
|
-
</li><li>
|
221
|
-
<p><a href="doc/hostgroups.md">Hostgroups</a></p>
|
222
|
-
<ul><li>
|
223
|
-
<p><a href="doc/hostgroups.md#add-usergroup">add hostgroup</a></p>
|
224
|
-
</li><li>
|
225
|
-
<p><a href="doc/hostgroups.md#delete-usergroup">delete hostgroup</a></p>
|
226
|
-
</li><li>
|
227
|
-
<p><a href="doc/hostgroups.md#list-usergroups">list hostgroups</a></p>
|
228
|
-
</li><li>
|
229
|
-
<p><a href="doc/hostgroups.md#usergroup-exists">check if hostgroup exists</a></p>
|
230
|
-
</li></ul>
|
231
|
-
</li><li>
|
232
|
-
<p><a href="doc/services.md">Services</a></p>
|
233
|
-
<ul><li>
|
234
|
-
<p><a href="doc/services.md#add-service">add service</a></p>
|
235
|
-
</li><li>
|
236
|
-
<p><a href="doc/services.md#delete-service">delete service</a></p>
|
237
|
-
</li><li>
|
238
|
-
<p><a href="doc/services.md#unhandled-services">list unhandled services</a></p>
|
239
|
-
</li><li>
|
240
|
-
<p><a href="doc/services.md#list-services">list services</a></p>
|
241
|
-
</li><li>
|
242
|
-
<p><a href="doc/services.md#service-exists">check if service exists</a></p>
|
243
|
-
</li><li>
|
244
|
-
<p><a href="doc/services.md#list-service-objects">list service objects</a></p>
|
245
|
-
</li><li>
|
246
|
-
<p><a href="doc/services.md#count-services-with-problems">count services with
|
247
|
-
problems</a></p>
|
248
|
-
</li><li>
|
249
|
-
<p><a href="doc/services.md#list-services-with-problems">list of services with
|
250
|
-
problems</a></p>
|
251
|
-
</li><li>
|
252
|
-
<p><a href="doc/services.md#count-all-services">count of all services</a></p>
|
253
|
-
</li><li>
|
254
|
-
<p><a href="doc/services.md#count-all-services-handled">count all services
|
255
|
-
with handled problems</a></p>
|
256
|
-
</li><li>
|
257
|
-
<p>calculate service severity (protected)</p>
|
258
|
-
</li></ul>
|
259
|
-
</li><li>
|
260
|
-
<p><a href="doc/servicegroups.md">Servicegroups</a></p>
|
261
|
-
<ul><li>
|
262
|
-
<p><a href="doc/servicegroups.md#add-servicegroup">add servicegroup</a></p>
|
263
|
-
</li><li>
|
264
|
-
<p><a href="doc/servicegroups.md#delete-servicegroup">delete servicegroup</a></p>
|
265
|
-
</li><li>
|
266
|
-
<p><a href="doc/servicegroups.md#list-servicegroup">list servicegroups</a></p>
|
267
|
-
</li><li>
|
268
|
-
<p><a href="doc/servicegroups.md#servicegroup-exists">check if servicegroup
|
269
|
-
exists</a></p>
|
270
|
-
</li></ul>
|
271
|
-
</li><li>
|
272
|
-
<p><a href="doc/downtimes.md">Downtimes</a></p>
|
273
|
-
<ul><li>
|
274
|
-
<p><a href="doc/downtimes.md#add-downtime">add downtime</a></p>
|
275
|
-
</li><li>
|
276
|
-
<p><a href="doc/downtimes.md#list-downtimes">list downtimes</a></p>
|
277
|
-
</li></ul>
|
278
|
-
</li><li>
|
279
|
-
<p><a href="doc/notifications.md">Notifications</a></p>
|
280
|
-
<ul><li>
|
281
|
-
<p><a href="doc/notifications.md#enable-host-notification">enable host
|
282
|
-
notifications</a></p>
|
283
|
-
</li><li>
|
284
|
-
<p><a href="doc/notifications.md#disable-host-notification">disable host
|
285
|
-
notifications</a></p>
|
286
|
-
</li><li>
|
287
|
-
<p><a href="doc/notifications.md#enable-service-notification">enable service
|
288
|
-
notifications</a></p>
|
289
|
-
</li><li>
|
290
|
-
<p><a href="doc/notifications.md#disable-service-notification">disable service
|
291
|
-
notifications</a></p>
|
292
|
-
</li><li>
|
293
|
-
<p><a href="doc/notifications.md#enable-hostgroup-notification">enable
|
294
|
-
hostgroup notifications</a></p>
|
295
|
-
</li><li>
|
296
|
-
<p><a href="doc/notifications.md#disable-hostgroup-notification">disable
|
297
|
-
hostgroup notifications</a></p>
|
298
|
-
</li><li>
|
299
|
-
<p><a href="doc/notifications.md#list-notifications">list all
|
300
|
-
notifications</a></p>
|
301
|
-
</li><li>
|
302
|
-
<p>host notification (protected)</p>
|
303
|
-
</li><li>
|
304
|
-
<p>hostgroup notification (protected)</p>
|
305
|
-
</li><li>
|
306
|
-
<p>service notification (protected)</p>
|
307
|
-
</li></ul>
|
308
|
-
</li><li>
|
309
|
-
<p><a href="doc/statistics.md">Statistics</a></p>
|
310
|
-
<ul><li>
|
311
|
-
<p><a href="doc/statistics.md#stats-avg">statistic data for latence and
|
312
|
-
execution time</a></p>
|
313
|
-
</li><li>
|
314
|
-
<p><a href="doc/statistics.md#stats-interval">statistic data for interval
|
315
|
-
data</a></p>
|
316
|
-
</li><li>
|
317
|
-
<p><a href="doc/statistics.md#stats-services">statistic data for services</a></p>
|
318
|
-
</li><li>
|
319
|
-
<p><a href="doc/statistics.md#stats-hosts">statistic data for hosts</a></p>
|
320
|
-
</li><li>
|
321
|
-
<p><a href="doc/statistics.md#stats-work-queue">queue statistics from the
|
322
|
-
api</a></p>
|
323
|
-
</li></ul>
|
324
|
-
</li></ul>
|
325
|
-
|
326
|
-
<h2 id="label-Contributing">Contributing</h2>
|
327
|
-
<ol><li>
|
328
|
-
<p>Fork it</p>
|
329
|
-
</li><li>
|
330
|
-
<p>Create your feature branch (<code>git checkout -b my-new-feature</code>)</p>
|
331
|
-
</li><li>
|
332
|
-
<p>Commit your changes (<code>git commit -am 'Add some
|
333
|
-
feature'</code>)</p>
|
334
|
-
</li><li>
|
335
|
-
<p>Push to the branch (<code>git push origin my-new-feature</code>)</p>
|
336
|
-
</li><li>
|
337
|
-
<p>Create new Pull Request</p>
|
338
|
-
</li></ol>
|
339
|
-
</div></div>
|
340
|
-
|
341
|
-
<div id="footer">
|
342
|
-
Generated on Sat Dec 9 20:28:06 2017 by
|
343
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
344
|
-
0.9.11 (ruby-2.2.8).
|
345
|
-
</div>
|
346
|
-
|
347
|
-
</div>
|
348
|
-
</body>
|
349
|
-
</html>
|