-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathobsess.README
51 lines (39 loc) · 1.85 KB
/
obsess.README
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
nagios.cfg:
===========
obsess_over_services=1
ocsp_command=ocsp2out
obsess_over_hosts=1
ochp_command=ochp2out
commands:
=========
define command {
command_name ocsp2out
command_line echo >>/tmp/nagixsc.spool/new/$TIMET$ LASTSERVICECHECK::$LASTSERVICECHECK$ HOSTNAME::\'$HOSTNAME$\' SERVICEDESC::\'$SERVICEDESC$\' SERVICESTATEID::$SERVICESTATEID$ SERVICEOUTPUT::\'$SERVICEOUTPUT$\' LONGSERVICEOUTPUT::\'$LONGSERVICEOUTPUT$\'
}
define command {
command_name ochp2out
command_line echo >>/tmp/nagixsc.spool/new/$TIMET$ LASTHOSTCHECK::$LASTHOSTCHECK$ HOSTNAME::\'$HOSTNAME$\' HOSTSTATEID::$HOSTSTATEID$ HOSTOUTPUT::\'$HOSTOUTPUT$\' LONGHOSTOUTPUT::\'$LONGHOSTOUTPUT$\'
}
Advantages/benefits:
====================
- Do NOT start a shell to analyse the return-code and then format a string
using "printf" as documented in the original documentation.
- Block the Nagios process for a minimum amount of time. The original script
calls "send_nsca" directly, thus blocking Nagios until the NSCA network
packet has been sent (which might include a timeout in case the server is
unreachable). Here, we only write a single spool-file from the shell started
by Nagios.
- Send multiple check results at once. Nagios writes multiple check results
basically at the same time. While NSCA uses one network connection for every
single one of those (which requires a TCP handshake, etc. for each of them),
Nag(ix)SC creates a single XML file from all entries in the spool file.
- A separate, stand-alone process ("obsess_daemon.py") takes care of sending
the XML file.
Caveats:
========
- "obsess_daeon.py" is not a real daemon yet. Start it in a terminal (and
watch the debugging output).
- Watch what's going on:
% cd /tmp/nagixsc.spool
% watch -n2 "cat */*[0-9] | wc -l; (for F in xmlout/*; do
~/src/nagixsc/nagixsc_read_xml.py -f \$F; done) | grep -c RetCode"