icinga2 0.5.2 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +63 -38
- data/doc/downtimes.md +4 -3
- data/doc/hostgroups.md +10 -7
- data/doc/hosts.md +19 -7
- data/doc/notifications.md +24 -7
- data/doc/servicegroups.md +11 -8
- data/doc/services.md +29 -6
- data/doc/usergroups.md +8 -4
- data/doc/users.md +12 -11
- data/examples/test.rb +117 -113
- data/lib/icinga2.rb +71 -61
- data/lib/icinga2/converts.rb +68 -53
- data/lib/icinga2/downtimes.rb +73 -90
- data/lib/icinga2/hostgroups.rb +50 -73
- data/lib/icinga2/hosts.rb +133 -170
- data/lib/icinga2/network.rb +182 -117
- data/lib/icinga2/notifications.rb +82 -79
- data/lib/icinga2/servicegroups.rb +50 -71
- data/lib/icinga2/services.rb +144 -162
- data/lib/icinga2/status.rb +32 -32
- data/lib/icinga2/tools.rb +10 -4
- data/lib/icinga2/usergroups.rb +49 -67
- data/lib/icinga2/users.rb +65 -70
- data/lib/icinga2/version.rb +7 -3
- data/lib/logging.rb +10 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c01377a17aeaff33b892aa1ee1969eebba5a3a6
|
4
|
+
data.tar.gz: e11000a8b8dfbbbe64db0337580526b2872046e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb1d5cb4779a5e9bbf4e8dc233c50f50a83721133d16f2a80098e21d77c4d83367e40b574a04dae797385b802ccef3115c98df68dc6b9f8aaadabc64e9a31050
|
7
|
+
data.tar.gz: c2cb76059fe23caaebd136ffc81361eeab3c3626c60b952fea3345cf5701bd3c65b0393568acff52f31417143ddba541a7f29dfc678fb010a52cfb76b4a40772
|
data/README.md
CHANGED
@@ -26,53 +26,78 @@ create an instance and get information about the Icinga2 Server
|
|
26
26
|
}
|
27
27
|
|
28
28
|
i = Icinga::Client.new( config )
|
29
|
-
puts i.
|
29
|
+
puts i.application_data()
|
30
|
+
|
30
31
|
|
31
32
|
## Status
|
32
33
|
|
33
34
|
supports the following API Calls:
|
34
35
|
|
36
|
+
- [Users](doc/status.md)
|
37
|
+
* application_data
|
38
|
+
* cib_data
|
39
|
+
* api_listener
|
40
|
+
|
35
41
|
- [Users](doc/users.md)
|
36
|
-
*
|
37
|
-
*
|
38
|
-
*
|
39
|
-
*
|
42
|
+
* add_user( params = {} )
|
43
|
+
* delete_user( params = {} )
|
44
|
+
* users( params = {} )
|
45
|
+
* exists_user?( name )
|
46
|
+
|
40
47
|
- [Usergroups](doc/usergroups.md)
|
41
|
-
*
|
42
|
-
*
|
43
|
-
*
|
44
|
-
*
|
48
|
+
* add_usergroup( params = {} )
|
49
|
+
* delete_usergroup( params = {} )
|
50
|
+
* usergroups( params = {} )
|
51
|
+
* exists_usergroup?( name )
|
52
|
+
|
45
53
|
- [Hosts](doc/hosts.md)
|
46
|
-
*
|
47
|
-
*
|
48
|
-
*
|
49
|
-
*
|
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 )
|
62
|
+
|
50
63
|
- [Hostgroups](doc/hostgroups.md)
|
51
|
-
*
|
52
|
-
*
|
53
|
-
*
|
54
|
-
*
|
64
|
+
* add_hostgroup(params = {})
|
65
|
+
* delete_hostgroup(params = {})
|
66
|
+
* hostgroups(params = {})
|
67
|
+
* exists_hostgroup?(name)
|
68
|
+
|
55
69
|
- [Services](doc/services.md)
|
56
|
-
*
|
57
|
-
*
|
58
|
-
*
|
59
|
-
*
|
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 )
|
79
|
+
|
60
80
|
- [Servicegroups](doc/servicegroups.md)
|
61
|
-
*
|
62
|
-
*
|
63
|
-
*
|
64
|
-
*
|
81
|
+
* add_servicegroup( params = {} )
|
82
|
+
* delete_servicegroup( params = {} )
|
83
|
+
* servicegroups( params = {} )
|
84
|
+
* exists_servicegroup?( name )
|
85
|
+
|
65
86
|
- [Downtimes](doc/downtimes.md)
|
66
|
-
*
|
67
|
-
*
|
87
|
+
* add_downtime( params = {} )
|
88
|
+
* downtimes( params = {} )
|
89
|
+
|
68
90
|
- [Notifications](doc/notifications.md)
|
69
|
-
*
|
70
|
-
*
|
71
|
-
*
|
72
|
-
*
|
73
|
-
*
|
74
|
-
*
|
75
|
-
*
|
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 = {} )
|
76
101
|
|
77
102
|
|
78
103
|
## create a own gem File
|
@@ -80,13 +105,13 @@ supports the following API Calls:
|
|
80
105
|
#$ gem build icinga2.gemspec
|
81
106
|
Successfully built RubyGem
|
82
107
|
Name: icinga2
|
83
|
-
Version:
|
84
|
-
File: icinga2-
|
108
|
+
Version: 0.6.0
|
109
|
+
File: icinga2-0.6.0.gem
|
85
110
|
|
86
111
|
## install gem
|
87
112
|
|
88
|
-
#$ gem install
|
89
|
-
Successfully installed icinga2-
|
113
|
+
#$ gem install icinga2
|
114
|
+
Successfully installed icinga2-0.6.0
|
90
115
|
1 gem installed
|
91
116
|
|
92
117
|
## test via CLI
|
data/doc/downtimes.md
CHANGED
data/doc/hostgroups.md
CHANGED
@@ -1,19 +1,22 @@
|
|
1
1
|
# Icinga2 - Hostgroups
|
2
2
|
|
3
|
-
## check
|
4
|
-
existsHostgroup()
|
5
3
|
|
6
4
|
## add
|
7
|
-
|
5
|
+
add_hostgroup()
|
6
|
+
|
7
|
+
|
8
|
+
## delete
|
9
|
+
delete_hostgroup()
|
10
|
+
|
8
11
|
|
9
12
|
## list
|
10
13
|
|
11
14
|
### named
|
12
|
-
|
15
|
+
hostgroups()
|
13
16
|
|
14
17
|
### all
|
15
|
-
|
18
|
+
hostgroups()
|
16
19
|
|
17
|
-
## delete
|
18
|
-
deleteHostgroup()
|
19
20
|
|
21
|
+
## check
|
22
|
+
exists_hostgroup()
|
data/doc/hosts.md
CHANGED
@@ -1,8 +1,5 @@
|
|
1
1
|
# Icinga2 - Hosts
|
2
2
|
|
3
|
-
## check
|
4
|
-
existsHost()
|
5
|
-
|
6
3
|
## add
|
7
4
|
vars = {
|
8
5
|
'aws' => false
|
@@ -10,13 +7,28 @@
|
|
10
7
|
|
11
8
|
addHost( 'foo-bar.lan', vars )
|
12
9
|
|
10
|
+
## delete
|
11
|
+
deleteHost( 'foo-bar.lan' )
|
12
|
+
|
13
13
|
## list
|
14
14
|
|
15
15
|
### named
|
16
|
-
|
16
|
+
hosts( 'foo-bar.lan' )
|
17
17
|
|
18
18
|
### all
|
19
|
-
|
19
|
+
hosts()
|
20
20
|
|
21
|
-
##
|
22
|
-
|
21
|
+
## check
|
22
|
+
existsHost()
|
23
|
+
|
24
|
+
##
|
25
|
+
host_objects
|
26
|
+
|
27
|
+
##
|
28
|
+
host_problems
|
29
|
+
|
30
|
+
##
|
31
|
+
problem_hosts
|
32
|
+
|
33
|
+
##
|
34
|
+
host_severity
|
data/doc/notifications.md
CHANGED
@@ -1,15 +1,32 @@
|
|
1
1
|
# Icinga2 - Notifications
|
2
2
|
|
3
|
-
enableHostNotification()
|
4
3
|
|
5
|
-
|
4
|
+
## -
|
5
|
+
enable_host_notification( host )
|
6
6
|
|
7
|
-
|
7
|
+
## -
|
8
|
+
disable_host_notification( host )
|
8
9
|
|
9
|
-
|
10
|
+
## -
|
11
|
+
enable_service_notification( params = {} )
|
10
12
|
|
11
|
-
|
13
|
+
## -
|
14
|
+
disable_service_notification( host )
|
12
15
|
|
13
|
-
|
16
|
+
## -
|
17
|
+
enable_hostgroup_notification( group )
|
14
18
|
|
15
|
-
|
19
|
+
## -
|
20
|
+
disable_hostgroup_notification( group )
|
21
|
+
|
22
|
+
## -
|
23
|
+
notifications( params = {} )
|
24
|
+
|
25
|
+
## -
|
26
|
+
host_notification( params = {} )
|
27
|
+
|
28
|
+
## -
|
29
|
+
hostgroup_notification( params = {} )
|
30
|
+
|
31
|
+
## -
|
32
|
+
service_notification( params = {} )
|
data/doc/servicegroups.md
CHANGED
@@ -1,19 +1,22 @@
|
|
1
1
|
# Icinga2 - Servicegroups
|
2
2
|
|
3
|
-
## check
|
4
|
-
existsServicegroup()
|
5
3
|
|
6
4
|
## add
|
7
|
-
|
5
|
+
add_servicegroup()
|
6
|
+
|
7
|
+
|
8
|
+
## delete
|
9
|
+
delete_servicegroup()
|
10
|
+
|
11
|
+
|
12
|
+
## check
|
13
|
+
exists_servicegroup?
|
8
14
|
|
9
15
|
## list
|
10
16
|
|
11
17
|
### named
|
12
|
-
|
18
|
+
servicegroups()
|
13
19
|
|
14
20
|
### all
|
15
|
-
|
16
|
-
|
17
|
-
## delete
|
18
|
-
deleteServicegroup()
|
21
|
+
servicegroups()
|
19
22
|
|
data/doc/services.md
CHANGED
@@ -1,9 +1,6 @@
|
|
1
1
|
# Icinga2 - Services
|
2
2
|
|
3
3
|
|
4
|
-
## check
|
5
|
-
existsService()
|
6
|
-
|
7
4
|
## add
|
8
5
|
services = {
|
9
6
|
'service-heap-mem' => {
|
@@ -12,15 +9,41 @@
|
|
12
9
|
}
|
13
10
|
}
|
14
11
|
|
15
|
-
i.
|
12
|
+
i.add_services( 'foo-bar.lan', services )
|
13
|
+
|
14
|
+
## -
|
15
|
+
|
16
|
+
unhandled_services
|
17
|
+
|
16
18
|
|
17
19
|
## list
|
18
20
|
|
19
21
|
### named
|
20
|
-
|
22
|
+
services( 'foo-bar.lan' )
|
21
23
|
|
22
24
|
### all
|
23
|
-
|
25
|
+
services()
|
24
26
|
|
25
27
|
## delete
|
26
28
|
**not yet implemented**
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
## check
|
33
|
+
exists_service?
|
34
|
+
|
35
|
+
##
|
36
|
+
service_objects( params = {} )
|
37
|
+
|
38
|
+
|
39
|
+
##
|
40
|
+
service_problems
|
41
|
+
|
42
|
+
##
|
43
|
+
problem_services( max_items = 5 )
|
44
|
+
|
45
|
+
##
|
46
|
+
update_host( hash, host )
|
47
|
+
|
48
|
+
##
|
49
|
+
service_severity( service )
|
data/doc/usergroups.md
CHANGED
data/doc/users.md
CHANGED
@@ -1,10 +1,5 @@
|
|
1
1
|
# Icinga2 - Users
|
2
2
|
|
3
|
-
## check, if User exists
|
4
|
-
|
5
|
-
existsUser?( $USERNAME )
|
6
|
-
|
7
|
-
return `true` or `false`
|
8
3
|
|
9
4
|
## add User
|
10
5
|
|
@@ -16,7 +11,13 @@ return `true` or `false`
|
|
16
11
|
:groups => ['icingaadmins']
|
17
12
|
}
|
18
13
|
|
19
|
-
|
14
|
+
add_user var
|
15
|
+
|
16
|
+
return `Hash`
|
17
|
+
|
18
|
+
## delete User
|
19
|
+
|
20
|
+
delete_user { :name => $USERNAME }
|
20
21
|
|
21
22
|
return `Hash`
|
22
23
|
|
@@ -24,18 +25,18 @@ return `Hash`
|
|
24
25
|
|
25
26
|
### named User
|
26
27
|
|
27
|
-
|
28
|
+
users { :name => $USERNAME }
|
28
29
|
|
29
30
|
return `Hash`
|
30
31
|
|
31
32
|
### all Users
|
32
33
|
|
33
|
-
|
34
|
+
users
|
34
35
|
|
35
36
|
return `Hash`
|
36
37
|
|
37
|
-
##
|
38
|
+
## check, if User exists
|
38
39
|
|
39
|
-
|
40
|
+
exists_user? $USERNAME
|
40
41
|
|
41
|
-
return `
|
42
|
+
return `true` or `false`
|
data/examples/test.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
#
|
3
4
|
# 23.01.2017 - Bodo Schulz
|
4
5
|
#
|
@@ -11,26 +12,26 @@ require_relative '../lib/icinga2'
|
|
11
12
|
|
12
13
|
# -----------------------------------------------------------------------------
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
15
|
+
icinga_host = ENV.fetch( 'ICINGA_HOST' , 'icinga2' )
|
16
|
+
icinga_api_port = ENV.fetch( 'ICINGA_API_PORT' , 5665 )
|
17
|
+
icinga_api_user = ENV.fetch( 'ICINGA_API_USER' , 'admin' )
|
18
|
+
icinga_api_pass = ENV.fetch( 'ICINGA_API_PASSWORD' , nil )
|
19
|
+
icinga_cluster = ENV.fetch( 'ICINGA_CLUSTER' , false )
|
20
|
+
icinga_satellite = ENV.fetch( 'ICINGA_CLUSTER_SATELLITE', nil )
|
20
21
|
|
21
22
|
# convert string to bool
|
22
|
-
|
23
|
+
icinga_cluster = icinga_cluster.to_s.eql?('true') ? true : false
|
23
24
|
|
24
25
|
config = {
|
25
|
-
:
|
26
|
-
:
|
27
|
-
:
|
28
|
-
:
|
29
|
-
:
|
30
|
-
:
|
26
|
+
icinga: {
|
27
|
+
host: icinga_host,
|
28
|
+
api: {
|
29
|
+
port: icinga_api_port,
|
30
|
+
user: icinga_api_user,
|
31
|
+
password: icinga_api_pass
|
31
32
|
},
|
32
|
-
:
|
33
|
-
:
|
33
|
+
cluster: icinga_cluster,
|
34
|
+
satellite: icinga_satellite
|
34
35
|
}
|
35
36
|
}
|
36
37
|
|
@@ -38,109 +39,112 @@ config = {
|
|
38
39
|
|
39
40
|
i = Icinga2::Client.new( config )
|
40
41
|
|
41
|
-
|
42
|
-
|
43
|
-
# run tests ...
|
44
|
-
#
|
45
|
-
#
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
puts i.
|
50
|
-
puts i.
|
51
|
-
puts
|
52
|
-
|
53
|
-
puts "check if Host 'icinga2-master' exists:"
|
54
|
-
puts i.
|
55
|
-
puts "get host Objects from 'icinga2-master'"
|
56
|
-
puts i.
|
57
|
-
puts
|
58
|
-
puts i.
|
59
|
-
puts
|
60
|
-
puts i.
|
61
|
-
|
62
|
-
puts
|
63
|
-
puts i.
|
64
|
-
puts
|
65
|
-
puts i.
|
66
|
-
puts
|
67
|
-
|
68
|
-
puts "check if Hostgroup 'linux-servers' exists:"
|
69
|
-
puts i.
|
70
|
-
puts "add hostgroup 'foo'"
|
71
|
-
puts i.
|
72
|
-
puts "list named Hostgroup 'foo'"
|
73
|
-
puts i.
|
74
|
-
puts
|
75
|
-
puts i.
|
76
|
-
puts "delete Hostgroup 'foo'"
|
77
|
-
puts i.
|
78
|
-
puts
|
79
|
-
|
80
|
-
puts "check if service 'users' on host 'icinga2-master' exists:"
|
81
|
-
puts i.
|
82
|
-
|
83
|
-
puts
|
84
|
-
puts i.
|
85
|
-
puts
|
86
|
-
puts i.
|
87
|
-
puts
|
88
|
-
puts i.
|
89
|
-
|
90
|
-
puts "list named Service 'ping4' from Host 'icinga2-master'"
|
91
|
-
puts i.
|
92
|
-
puts
|
93
|
-
puts i.
|
94
|
-
puts
|
95
|
-
|
96
|
-
puts "check if Servicegroup 'disk' exists:"
|
97
|
-
puts i.
|
98
|
-
puts "add Servicegroup 'foo'"
|
99
|
-
puts i.
|
100
|
-
puts "list named Servicegroup 'foo'"
|
101
|
-
puts i.
|
102
|
-
puts
|
103
|
-
puts i.
|
104
|
-
puts "delete Servicegroup 'foo'"
|
105
|
-
puts i.
|
106
|
-
puts
|
107
|
-
|
108
|
-
puts "check if Usergroup 'icingaadmins' exists:"
|
109
|
-
puts i.
|
110
|
-
puts "add Usergroup 'foo'"
|
111
|
-
puts i.
|
112
|
-
puts "list named Usergroup 'foo'"
|
113
|
-
puts i.
|
114
|
-
puts
|
115
|
-
puts i.
|
116
|
-
puts "delete Usergroup 'foo'"
|
117
|
-
puts i.
|
118
|
-
puts
|
119
|
-
|
120
|
-
puts "check if User 'icingaadmin' exists:"
|
121
|
-
puts i.
|
122
|
-
puts "add User 'foo'"
|
123
|
-
puts i.
|
124
|
-
puts "list named User 'foo'"
|
125
|
-
puts i.
|
126
|
-
puts
|
127
|
-
puts i.
|
128
|
-
puts "delete User 'foo'"
|
129
|
-
puts i.
|
130
|
-
puts
|
42
|
+
unless( i.nil? )
|
43
|
+
|
44
|
+
# # run tests ...
|
45
|
+
# #
|
46
|
+
# #
|
47
|
+
#
|
48
|
+
puts 'Information about Icinga2:'
|
49
|
+
puts i.application_data
|
50
|
+
# puts i.cib_data()
|
51
|
+
# puts i.api_listener
|
52
|
+
# puts ''
|
53
|
+
#
|
54
|
+
# puts "check if Host 'icinga2-master' exists:"
|
55
|
+
# puts i.exists_host?( 'icinga2-master' ) ? 'true' : 'false'
|
56
|
+
# puts "get host Objects from 'icinga2-master'"
|
57
|
+
# puts i.host_objects
|
58
|
+
# puts 'Host problems:'
|
59
|
+
# puts i.host_problems
|
60
|
+
# puts 'Problem Hosts:'
|
61
|
+
# puts i.problem_hosts
|
62
|
+
#
|
63
|
+
# puts 'list named Hosts:'
|
64
|
+
# puts i.hosts( name: 'icinga2-master' )
|
65
|
+
# puts 'list all Hosts:'
|
66
|
+
# puts i.hosts
|
67
|
+
# puts ''
|
68
|
+
#
|
69
|
+
# puts "check if Hostgroup 'linux-servers' exists:"
|
70
|
+
# puts i.exists_hostgroup?( 'linux-servers' ) ? 'true' : 'false'
|
71
|
+
# puts "add hostgroup 'foo'"
|
72
|
+
# puts i.add_hostgroup( name: 'foo', display_name: 'FOO' )
|
73
|
+
# puts "list named Hostgroup 'foo'"
|
74
|
+
# puts i.hostgroups( name: 'foo' )
|
75
|
+
# puts 'list all Hostgroups:'
|
76
|
+
# puts i.hostgroups
|
77
|
+
# puts "delete Hostgroup 'foo'"
|
78
|
+
# puts i.delete_hostgroup( name: 'foo' )
|
79
|
+
# puts ''
|
80
|
+
#
|
81
|
+
# puts "check if service 'users' on host 'icinga2-master' exists:"
|
82
|
+
# puts i.exists_service?( host: 'icinga2-master', service: 'users' ) ? 'true' : 'false'
|
83
|
+
#
|
84
|
+
# puts 'get service Objects'
|
85
|
+
# puts i.service_objects
|
86
|
+
# puts 'Service problems:'
|
87
|
+
# puts i.service_problems
|
88
|
+
# puts 'Problem Services:'
|
89
|
+
# puts i.problem_services
|
90
|
+
#
|
91
|
+
# puts "list named Service 'ping4' from Host 'icinga2-master'"
|
92
|
+
# puts i.services( host: 'icinga2-master', service: 'ping4' )
|
93
|
+
# puts 'list all Services:'
|
94
|
+
# puts i.services
|
95
|
+
# puts ''
|
96
|
+
#
|
97
|
+
# puts "check if Servicegroup 'disk' exists:"
|
98
|
+
# puts i.exists_servicegroup?( 'disk' ) ? 'true' : 'false'
|
99
|
+
# puts "add Servicegroup 'foo'"
|
100
|
+
# puts i.add_servicegroup( name: 'foo', display_name: 'FOO' )
|
101
|
+
# puts "list named Servicegroup 'foo'"
|
102
|
+
# puts i.servicegroups( name: 'foo' )
|
103
|
+
# puts 'list all Servicegroup:'
|
104
|
+
# puts i.servicegroups
|
105
|
+
# puts "delete Servicegroup 'foo'"
|
106
|
+
# puts i.delete_servicegroup( name: 'foo' )
|
107
|
+
# puts ''
|
108
|
+
#
|
109
|
+
# puts "check if Usergroup 'icingaadmins' exists:"
|
110
|
+
# puts i.exists_usergroup?( 'icingaadmins' ) ? 'true' : 'false'
|
111
|
+
# puts "add Usergroup 'foo'"
|
112
|
+
# puts i.add_usergroup( name: 'foo', display_name: 'FOO' )
|
113
|
+
# puts "list named Usergroup 'foo'"
|
114
|
+
# puts i.usergroups( name: 'foo' )
|
115
|
+
# puts 'list all Usergroup:'
|
116
|
+
# puts i.usergroups
|
117
|
+
# puts "delete Usergroup 'foo'"
|
118
|
+
# puts i.delete_usergroup( name: 'foo' )
|
119
|
+
# puts ''
|
120
|
+
#
|
121
|
+
# puts "check if User 'icingaadmin' exists:"
|
122
|
+
# puts i.exists_user?( 'icingaadmin' ) ? 'true' : 'false'
|
123
|
+
# puts "add User 'foo'"
|
124
|
+
# puts i.add_user( name: 'foo', display_name: 'FOO', email: 'foo@bar.com', pager: '0000', groups: ['icingaadmins'] )
|
125
|
+
# puts "list named User 'foo'"
|
126
|
+
# puts i.users( name: 'foo' )
|
127
|
+
# puts 'list all User:'
|
128
|
+
# puts i.users
|
129
|
+
# puts "delete User 'foo'"
|
130
|
+
# puts i.delete_user( name: 'foo' )
|
131
|
+
# puts ''
|
131
132
|
|
132
133
|
puts "add Downtime 'test':"
|
133
|
-
puts i.
|
134
|
-
puts
|
135
|
-
puts i.
|
134
|
+
puts i.add_downtime( name: 'test', type: 'service', host: 'icinga2', comment: 'test downtime', author: 'icingaadmin', start_time: Time.now.to_i, end_time: Time.now.to_i + 20 )
|
135
|
+
puts 'list all Downtimes:'
|
136
|
+
puts i.downtimes
|
136
137
|
|
137
|
-
puts
|
138
|
-
puts i.
|
138
|
+
puts 'list all Notifications:'
|
139
|
+
puts i.notifications
|
139
140
|
|
140
|
-
puts
|
141
|
-
puts i.
|
141
|
+
puts 'enable Notifications for host:'
|
142
|
+
puts i.enable_host_notification( 'icinga2' )
|
143
|
+
puts 'disable Notifications for host:'
|
144
|
+
puts i.disable_host_notification( 'icinga2' )
|
142
145
|
|
143
|
-
|
146
|
+
puts 'disable Notifications for host and services:'
|
147
|
+
puts i.disable_service_notification( 'icinga2' )
|
144
148
|
|
145
149
|
|
146
150
|
end
|