line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Monitoring::Generator::TestConfig::Modules::Shinken; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
9
|
use strict; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
63
|
|
4
|
3
|
|
|
3
|
|
6
|
use warnings; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
49
|
|
5
|
3
|
|
|
3
|
|
7
|
use Carp; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
121
|
|
6
|
3
|
|
|
3
|
|
9
|
use Data::Dumper; |
|
3
|
|
|
|
|
2
|
|
|
3
|
|
|
|
|
1164
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Monitoring::Generator::TestConfig::Modules::Shinken - shinken specificy functions |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 METHODS |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=over 4 |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=item new |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
returns a shinken module object |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=back |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=cut |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
######################################## |
26
|
|
|
|
|
|
|
sub new { |
27
|
0
|
|
|
0
|
1
|
|
my($class,%options) = @_; |
28
|
0
|
|
|
|
|
|
my $self = {}; |
29
|
0
|
|
|
|
|
|
bless $self, $class; |
30
|
0
|
|
|
|
|
|
return $self; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 METHODS |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=over 4 |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=cut |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
######################################## |
41
|
|
|
|
|
|
|
sub _get_shinken_specific_cfg { |
42
|
0
|
|
|
0
|
|
|
my $self = shift; |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
my $max_workers = ($self->{'hostcount'} * $self->{'services_per_host'}) / 256 / 10; # 100000 services -> 39 |
45
|
0
|
0
|
|
|
|
|
$max_workers = ($max_workers < 10) ? 10 : abs($max_workers); |
46
|
0
|
|
|
|
|
|
my $cfg = " |
47
|
|
|
|
|
|
|
define scheduler{ |
48
|
|
|
|
|
|
|
scheduler_name scheduler-All |
49
|
|
|
|
|
|
|
address localhost |
50
|
|
|
|
|
|
|
port 7768 |
51
|
|
|
|
|
|
|
spare 0 |
52
|
|
|
|
|
|
|
realm All |
53
|
|
|
|
|
|
|
weight 1 |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
define reactionner{ |
56
|
|
|
|
|
|
|
reactionner_name reactionner-All |
57
|
|
|
|
|
|
|
address localhost |
58
|
|
|
|
|
|
|
port 7769 |
59
|
|
|
|
|
|
|
spare 0 |
60
|
|
|
|
|
|
|
realm All |
61
|
|
|
|
|
|
|
manage_sub_realms 0 |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
define poller{ |
64
|
|
|
|
|
|
|
poller_name poller-All |
65
|
|
|
|
|
|
|
address localhost |
66
|
|
|
|
|
|
|
port 7771 |
67
|
|
|
|
|
|
|
realm All |
68
|
|
|
|
|
|
|
manage_sub_realms 0 |
69
|
|
|
|
|
|
|
min_workers 4 |
70
|
|
|
|
|
|
|
max_workers $max_workers |
71
|
|
|
|
|
|
|
processes_by_worker 256 |
72
|
|
|
|
|
|
|
polling_interval 1 |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
define broker{ |
75
|
|
|
|
|
|
|
broker_name broker-All |
76
|
|
|
|
|
|
|
address localhost |
77
|
|
|
|
|
|
|
port 7772 |
78
|
|
|
|
|
|
|
spare 0 |
79
|
|
|
|
|
|
|
realm All |
80
|
|
|
|
|
|
|
manage_sub_realms 0 |
81
|
|
|
|
|
|
|
modules Simple-log,Status-Dat,Livestatus |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
define module{ |
84
|
|
|
|
|
|
|
module_name Simple-log |
85
|
|
|
|
|
|
|
module_type simple_log |
86
|
|
|
|
|
|
|
path $self->{'output_dir'}/var/shinken.log |
87
|
|
|
|
|
|
|
archive_path $self->{'output_dir'}/archives/ |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
define module{ |
90
|
|
|
|
|
|
|
module_name Status-Dat |
91
|
|
|
|
|
|
|
module_type status_dat |
92
|
|
|
|
|
|
|
status_file $self->{'output_dir'}/var/status.dat |
93
|
|
|
|
|
|
|
object_cache_file $self->{'output_dir'}/var/objects.cache |
94
|
|
|
|
|
|
|
status_update_interval 15 ; update status.dat every 15s |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
define module{ |
97
|
|
|
|
|
|
|
module_name Livestatus |
98
|
|
|
|
|
|
|
module_type livestatus |
99
|
|
|
|
|
|
|
host * ; * = listen on all configured ip addresses |
100
|
|
|
|
|
|
|
port 50000 |
101
|
|
|
|
|
|
|
database_file $self->{'output_dir'}/var/livestatus.db |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
define realm { |
104
|
|
|
|
|
|
|
realm_name All |
105
|
|
|
|
|
|
|
default 1 |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
"; |
108
|
0
|
|
|
|
|
|
return($cfg); |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
######################################## |
112
|
|
|
|
|
|
|
sub _get_shinken_schedulerd_cfg { |
113
|
0
|
|
|
0
|
|
|
my $self = shift; |
114
|
|
|
|
|
|
|
|
115
|
0
|
|
|
|
|
|
my $cfg = "[daemon] |
116
|
|
|
|
|
|
|
workdir=$self->{'output_dir'}/var |
117
|
|
|
|
|
|
|
pidfile=%(workdir)s/schedulerd.pid |
118
|
|
|
|
|
|
|
port=7768 |
119
|
|
|
|
|
|
|
host=0.0.0.0 |
120
|
|
|
|
|
|
|
user=$self->{'user'} |
121
|
|
|
|
|
|
|
group=$self->{'group'} |
122
|
|
|
|
|
|
|
idontcareaboutsecurity=0 |
123
|
|
|
|
|
|
|
"; |
124
|
0
|
|
|
|
|
|
return($cfg); |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
######################################## |
128
|
|
|
|
|
|
|
sub _get_shinken_pollerd_cfg { |
129
|
0
|
|
|
0
|
|
|
my $self = shift; |
130
|
|
|
|
|
|
|
|
131
|
0
|
|
|
|
|
|
my $cfg = "[daemon] |
132
|
|
|
|
|
|
|
workdir=$self->{'output_dir'}/var |
133
|
|
|
|
|
|
|
pidfile=%(workdir)s/pollerd.pid |
134
|
|
|
|
|
|
|
interval_poll=5 |
135
|
|
|
|
|
|
|
maxfd=1024 |
136
|
|
|
|
|
|
|
port=7771 |
137
|
|
|
|
|
|
|
host=0.0.0.0 |
138
|
|
|
|
|
|
|
user=$self->{'user'} |
139
|
|
|
|
|
|
|
group=$self->{'group'} |
140
|
|
|
|
|
|
|
idontcareaboutsecurity=no |
141
|
|
|
|
|
|
|
"; |
142
|
0
|
|
|
|
|
|
return($cfg); |
143
|
|
|
|
|
|
|
} |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
######################################## |
146
|
|
|
|
|
|
|
sub _get_shinken_brokerd_cfg { |
147
|
0
|
|
|
0
|
|
|
my $self = shift; |
148
|
|
|
|
|
|
|
|
149
|
0
|
|
|
|
|
|
($self->{'shinken_dir'} = $self->{'binary'}) =~ s/\/[^\/]*?\/[^\/]*?$//mxg; |
150
|
0
|
|
|
|
|
|
my $cfg = "[daemon] |
151
|
|
|
|
|
|
|
workdir=$self->{'output_dir'}/var |
152
|
|
|
|
|
|
|
pidfile=%(workdir)s/brokerd.pid |
153
|
|
|
|
|
|
|
interval_poll=5 |
154
|
|
|
|
|
|
|
maxfd=1024 |
155
|
|
|
|
|
|
|
port=7772 |
156
|
|
|
|
|
|
|
host=0.0.0.0 |
157
|
|
|
|
|
|
|
user=$self->{'user'} |
158
|
|
|
|
|
|
|
group=$self->{'group'} |
159
|
|
|
|
|
|
|
idontcareaboutsecurity=no |
160
|
|
|
|
|
|
|
modulespath=$self->{'shinken_dir'}/modules |
161
|
|
|
|
|
|
|
"; |
162
|
0
|
|
|
|
|
|
return($cfg); |
163
|
|
|
|
|
|
|
} |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
######################################## |
166
|
|
|
|
|
|
|
sub _get_shinken_reactionnerd_cfg { |
167
|
0
|
|
|
0
|
|
|
my $self = shift; |
168
|
|
|
|
|
|
|
|
169
|
0
|
|
|
|
|
|
my $cfg = "[daemon] |
170
|
|
|
|
|
|
|
workdir=$self->{'output_dir'}/var |
171
|
|
|
|
|
|
|
pidfile=%(workdir)s/reactionnerd.pid |
172
|
|
|
|
|
|
|
interval_poll=5 |
173
|
|
|
|
|
|
|
maxfd=1024 |
174
|
|
|
|
|
|
|
port=7769 |
175
|
|
|
|
|
|
|
host=0.0.0.0 |
176
|
|
|
|
|
|
|
user=$self->{'user'} |
177
|
|
|
|
|
|
|
group=$self->{'group'} |
178
|
|
|
|
|
|
|
idontcareaboutsecurity=no |
179
|
|
|
|
|
|
|
"; |
180
|
0
|
|
|
|
|
|
return($cfg); |
181
|
|
|
|
|
|
|
} |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
######################################## |
184
|
|
|
|
|
|
|
sub _get_shinken_initscript { |
185
|
0
|
|
|
0
|
|
|
my $self = shift; |
186
|
0
|
|
|
|
|
|
return ""; |
187
|
|
|
|
|
|
|
} |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
1; |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
__END__ |