This repository has been archived by the owner on Jan 15, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathTESTING
356 lines (226 loc) · 11.2 KB
/
TESTING
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
============
Icinga Tests
============
Found something?
Then please let us know by opening an issue: dev.icinga.org
More information about testing can be found in the Icinga Wiki: https://wiki.icinga.org/display/testing/Home
=====================================================================================================================
= Build Tests
=====================================================================================================================
t/ for cgis and core functionality
RHEL
$ sudo yum install perl-HTML-Lint
$ sudo yum install perl-Test-WWW-Mechanize
Debian
$ sudo apt-get install libipc-run3-perl libtest-most-perl libhtml-lint-perl libtest-www-mechanize-cgiapp-perl
$ ./configure
$ make test
tests/ contains a variety of test config files, which can be installed into sysconfdir/icinga/tests and then included
in your icinga.cfg for keeping resolved issues tested while implementing new stuff.
$ sudo make install-testconfig
=====================================================================================================================
= Using GIT for providing Diffs/Patches
=====================================================================================================================
Get the first GIT clone using
$ git clone git://git.icinga.org/icinga-core.git
then chdir to icinga-core and init/update submodules
$ git submodules init
$ git submodules update
create your local fixes branch.
$ git branch fixes master
do a checkout and merge latest master (in case you need to).
$ git checkout master
$ git pull origin master
$ git checkout fixes
$ git merge master
now create your patch.
$ vi ...
$ git commit -a
$ vi ..subject..commitmsg
$ git format-patch -1
Attach the gotten patch to the new issue you may create at dev.icinga.org in the appropriate section.
Or via mail onto our mailinglists - http://www.icinga.org/support/
Thanks :)
PS: Checkout the more advanced GIT guide in the development wiki!
=====================================================================================================================
= CORE
=====================================================================================================================
Debug Hints
If you are debugging with gdb or common tools, make sure that you are running the compiled binaries, not the installed ones. make install normally strips the debug symbols.
A gdb cheatsheet can be found here: http://www.yolinux.com/TUTORIALS/GDB-Commands.html
Building the source
Configure
./configure behavior with different flags:
* enable modules
* set prefix
* set users
* set libs/includes
Make
Compiling different things, just type 'make' to see all available options
Make Install
Test if different installing options do what they are expected to do e.g. fullinstall should do everything.
Check Configuration
* Backup your current configuration and try to set several things.
* Change literals, strings, does it resolve in the expected behavior, or do you encounter something strange?
* Does e.g. setting the retry_interval to a test value really result like desired?
* Check back on the docs and try to set suggested values and configurations - does it really work?
* Try to set extrem values (absolute minimum/maximum) and watch the resulting behavior.
* Generate a test configuration with e.g. http://search.cpan.org/dist/Monitoring-Generator-TestConfig/
* Play around with random host behaviour
Debugging
icinga.cfg provides debug settings. Set them to those values to get everything:
* debug_level=-1 (everything)
* debug_verbosity=2 (very detailed)
* debug_file=/where/you/have/enough/storage/icinga.debug
* max_debug_file_size=1000000000 (1GB)
Running the Core
* Are Macros processed correctly?
* How do the illegal chars in macros affect the string escaping?
* Host States are expected - e.g. host is down when you disable the network route temporarly?
* Service checks behave correctly
* External Commands are being processed
* Passive checks are working?
* Are the permissions on the command pipe set correctly, does it work like expected?
* Is the daemon running, but a dead daemon not processing any checks and results - what might have caused that, why does it hang?
* States are going from soft to hard, state changes are happening correctly?
* Notifications are being sent correctly
* Escalations are being handled they way they are expected, Escalation conditions defined work as they should
Errors
* Segfault on the Core - why this?
* Faulty modules being loaded?
* Are there any noticable memory leaks
* gcc -Wall on Makefile.in if not already set
* gdb, strace, valgrind
Plugins
* Matches the check config for the plugins, is there anything different from the docs to the real config for check commands?
=====================================================================================================================
= IDOUTILS
=====================================================================================================================
Configure
./configure --enable-idoutils
* --enable-ssl
* --enable-oracle
* oracle libs/includes
Make
* make idoutils shows warnings/errors?
Make Install
* make install-idoutils does install all files needed to run?
* configs are not overwritten, check on the sample ones.
Check Configuration
* Backup your current configuration and try to set several things.
* Change literals, strings, does it resolve in the expected behavior, or do you encounter something strange?
* Does e.g. setting the max_servicechecks_age to a test value really result like desired?
* Check back on the docs and try to set suggested values and configurations - does it really work?
* Try to set extrem values (absolute minimum/maximum) and watch the resulting behavior.
Debugging
ido2db.cfg and idomod.cfg provide debug settings. Set them to those values to get everything:
* debug_level=-1 (everything)
* debug_verbosity=2 (very detailed)
* debug_file=/where/you/have/enough/storage/ido2db.debug / idomod.debug
* max_debug_file_size=1000000000 (1GB)
idomod
The output is rather larger as it's directly the functions being called when new data gets there through from the core. Afterwards this data is being processed on the socket.
ido2db
The debugfile only get's written, if iodmod connects correctly through the socket. So if it's not updated, this is a reminder, that there's something wrong with idomod or the socket being created/used.
Setup
IDOUtils consisting of idomod and ido2db can be setup in different combinations.
Sockets
Set different sockets in idomod.cfg and ido2db.cfg, but make sure they match.
Also if they don't check on the erorr messages and look forward to "how to improve the error messages"?
* Unix socket both on local machine, database local too
* Unix socket both on local machine, database extern
* TCP socket (with and without SSL) idomod and ido2db local, db local or extern
* TCP socket (with and without SSL) idomod local and ido2db extern, db extern
Databases
Configure different databases in the background and apply different settings on ido2db.cfg (create e.g. ido2db.cfg-pgsql and just copying them over as new ido2db.cfg).
* MySQL
* Postgres
* Oracle
Data
Initial connection
* check if connection to database is established
* check on the table [icinga_]instances, if the same name is in idomod.cfg is there
* check [icinga_]conninfo if idomod and idomod trimming thread left their entries
Config data
* Stop ido2db, stop Icinga
* Start ido2db, start Icinga
* check syslog if everythings fine
* check tables [icinga_]services/hosts/contacts //groups etc if the information matches
* check [icinga_]objects for matching objects from your config
Actual state information
* check [icinga_]host/servicestatus for the hostinformation and compare to those from status.dat and the cgis
* check the debug log for updates happening (insert_or_update functions on those tables
Historical Data
* Check if all rows get correctly updated
* Check over period if all checks get into the database
Other data
* Check if output and long_output are being written
Queries
* Check on the RDBMS if there are queries causing performance issues
* do queries fail or produce strange output (what you might get through the database or the debug log)
* compare MySQL, Postgres and Oracle regarding their performance
=====================================================================================================================
= CLASSIC UI / CGIS
=====================================================================================================================
* Run the compiled cgis on the shell to get an idea, which environment variables need to be exported. examples are:
export REMOTE_USER=icinga
export QUERY_STRING=host=test1
export REQUEST_METHOD=GET
* Run the cgis (from source) on shell and call installed ones via apache - differences?
* Run the cgis with an empty QUERY_STRING
* Run strace (or truss -f on Solaris) or gdb like this
$ export REQUEST_METHOD=GET ; gdb /home/icinga/icinga-core/cgi/status.cgi
=====================================================================================================================
= GET TEST CONFIGS
=====================================================================================================================
The easiest way to create a test config is Monitoring-Generator-TestConfig - a nifty Library written by Sven Nierlein.
http://search.cpan.org/dist/Monitoring-Generator-TestConfig/
# perl -MCPAN -e shell
CPAN> install Monitoring::Generator::TestConfig
CPAN> quit
or without interacting with the shell:
# perl -MCPAN -e 'install Monitoring::Generator::TestConfig'
Afterwards create this little Perl script:
# vim gen_icinga_testconf.pl
#!/usr/bin/perl
use Monitoring::Generator::TestConfig;
my $ngt = Monitoring::Generator::TestConfig->new(
'output_dir' => '/tmp/test_icinga' ,
layout => 'icinga',
binary => '/usr/local/icinga/bin/icinga',
overwrite_dir => 1,
verbose => 1,
hostcount => 200,
routercount => 1,
services_per_host => 10,
host_settings => {
check_period => '24x7',
},
host_types => {
'down' => 2, # percentage
'up' => 96,
'flap' => 1,
'pending' => 1,
'random' => 0,
},
service_types => {
'ok' => 96, # percentage
'warning' => 2,
'critical' => 1,
'pending' => 1,
'random' => 0,
},
service_settings => {
check_interval => 1,
retry_interval => 1,
},
'main_cfg' => {
'nagios_user' => 'icinga',
'nagios_group' => 'icinga',
},
);
$ngt->create();
# chmod +x gen_icinga_testconf.pl
Adapt it for your needs as described over here: http://search.cpan.org/dist/Monitoring-Generator-TestConfig/lib/Monitoring/Generator/TestConfig.pm
Running this script will create a complete configuration including test plugins in /tmp/test_icinga. You can then start the tests with
# /usr/local/icinga/bin/icinga -d /tmp/test_icinga/icinga.cfg