daemon: Distribute packets marked with DEST_BROADCAST to all pollers
[nagios/merlin.git] / README
1 Requirements
2 ------------
3 Merlin requires Nagios 3.2.4 or later.
4 Since (at the time of this writing), Nagios 3.2.4 is not yet
5 released, you'll have to use the latest sources from CVS head
6 or cloned from git, using the following command:
7
8    git clone git://git.op5.org/nagios.git
9
10
11 For running merlin with its default configuration, you'll need
12 to have libdbi-dbd-mysql and all of its dependencies (generally
13 libdbi-drivers, libdbi and mysql-libs) installed.
14
15 You will ofcourse also need an sql database supported by libdbi
16 (refer to the libdbi documentation for further information about
17 supported databases), as well as a Nagios installation that the
18 merlin module can plug in to. The import script is currently
19 limited to MySQL only, so that's currently the only database
20 supported.
21
22 For the import script to work, you need to have php-cli and
23 php-mysql installed. They may be named differently in your
24 distribution, but I'm sure you get the idea.
25
26 The install script requires administration privileges to create
27 its installation directories and copy files there, as well as
28 sql administration privileges in order to create the database
29 that merlin will populate for you.
30
31 GNU sed 4.0.9 or better is required for the install script to
32 be able to modify your nagios configuration files.
33
34
35 Compilation
36 -----------
37 Merlin doesn't support autoconf (and I'm reluctant to take
38 patches that makes it do so). You'll need to have libdbi-devel
39 installed. If it's not in a default location, please amend the
40 CPPFLAGS manually while running make, like so:
41
42      make CPPFLAGS="-I/usr/local/include"
43
44
45 Installation
46 ------------
47 There is an install-script provided here which will attempt to
48 make all the necessary modifications to your nagios.cfg file
49 as well as installing merlin on your system. Please run
50
51   sh install-merlin.sh --dest-dir=/path/to/merlin \
52            --nagios-cfg=/path/to/nagios.cfg \
53                    --db-type=mysql --db-user=merlin --db-pass=merlin \
54                    --db-name=merlin
55
56 Note that the install-merlin.sh script requires write access to
57 whatever directory you choose as --dest-dir, as well as access
58 to write to your nagios.cfg file.
59 Also note that the install script can only handle setting up
60 mysql databases at the moment. Patches welcome to make it also
61 handle postgresql and whatever else you feel there is a need for.
62 If a different database type is selected, the install script will
63 still work, but it will not create the database for you.
64
65 Configuration
66 -------------
67 Configuring merlin is pretty straight-forward. Check the example.conf
68 file that accompanies this release and you'll see most of the common
69 examples available.
70
71 The syntax is fairly standard, being made up of a key without
72 spaces and a value containing arbitrary characters (although no
73 semi-colons). A configuration statement is terminated either by a
74 newline or a semi-colon. A configuration statement starting with a
75 hash-character (#) is considered a comment. Thus,
76
77   key = value; # comment
78
79 makes "key" the key, "value" the value, terminated by the semi-colon,
80 and "# comment" all of the comment.
81 Leading and trailing whitespace is ignored.
82
83 The thing it doesn't really cover very well is how to configure masters,
84 peers and pollers, which is described more in-depth here.
85
86 In order to set up a loadbalanced system (ie, 2 or more peers), all
87 you need to do is add a section similar to the following to your
88 merlin configuration files on your merlin-empowered Nagios systems.
89 Let's pretend we have "nagios1" and "nagios2" in the network and
90 you wish for them to be set up in loadbalanced/redundancy mode.
91 nagios1 has 192.168.1.1 as IP. nagios2 has 192.168.1.2. Both use
92 port 15551 (the default).
93
94 On nagios1, add the following section to your merlin.conf file:
95   --------------
96   peer nagios2 {
97     address = 192.168.1.2;
98     port = 15551; # optional, since 15551 is the default
99   }
100   --------------
101
102 On nagios2, add the following section to your merlin.conf file:
103   --------------
104   peer nagios1 {
105     address = 192.168.1.1;
106     port = 15551; # optional, since 15551 is the default
107   }
108   --------------
109
110 Assuming nagios2 is a poller-node instead, responsible for checking
111 hosts in germany, you need to create a hostgroup in Nagios containing
112 all the hosts in germany that you want nagios2 to check for you. Let's
113 assume you call that hostgroup "germany-hosts". Then you need to add
114 following sections to your merlin.conf files.
115
116 On nagios1 (the "master" server), add the following section:
117   --------------
118   poller nagios2 {
119     address = 192.168.1.2;
120         port = 15551;
121         hostgroup = germany-hosts; # name of the hostgroup containing all
122                                    # the hosts you want this poller to check
123   }
124   --------------
125
126 On nagios2 (the slave server), add the following section:
127   --------------
128   master nagios1 {
129     address = 192.168.1.1;
130         port = 15551;
131   }
132   --------------
133
134 Note that these configuration sections need to be in the base section
135 of the configuration file. They must *not* be inside the daemon section.
136 This is because the master server will disable checks for all its pollers
137 once those pollers connect, and therefore it needs to read the list of
138 available nodes at configuration time.
139
140 A merlin node can have up to 65534 neighbours (assuming your system
141 lets a single program have that many file-descriptors open). A neighbour
142 is, in merlin terminology, a node that merlin connects to directly, so
143 you can build arbitrarily large networks by just specifying multiple
144 tiers of pollers.
145
146 A single merlin node can have pollers, peers and master nodes in its own
147 neighbourhood. As such, a single merlin node can, at the same time be
148 a peer (to its peers), a master (to its pollers) and a poller (to its
149 masters). One section has to be added to the merlin.conf file for each
150 of the hosts in its neighbourhood. The section must contain the
151 address of the neighbour, the port the neighbour is listening to
152 (unless it's the default port 15551) and, if the neighbour is a poller,
153 the section *must* contain a hostgroup statement declaring which
154 hostgroup the poller is responsible for checking.