Child pages
  • Merlin Readme

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Fixed broken link

...

Note
titleNote

This article is imported from merlin's git repository, you can find the document in git here.

 

Requirements
------------
Merlin requires Nagios 4, and needs the libnagios-devel package
for building, as well as for running.

For running merlin with its default configuration, you'll need
to have libdbi-dbd-mysql and all of its dependencies (generally
libdbi-drivers, libdbi and mysql-libs) installed.

You will ofcourse also need an sql database supported by libdbi
(refer to the libdbi documentation for further information about
supported databases), as well as a Nagios installation that the
merlin module can plug in to. The import script is currently
limited to MySQL only, so that's currently the only database
supported.

For the import script to work, you need to have php-cli and
php-mysql installed. They may be named differently in your
distribution, but I'm sure you get the idea.

The install script requires administration privileges to create
its installation directories and copy files there, as well as
sql administration privileges in order to create the database
that merlin will populate for you.

GNU sed 4.0.9 or better is required for the install script to
be able to modify your nagios configuration files.


Compilation
-----------
Merlin doesn't support autoconf (and I'm reluctant to take
patches that makes it do so). You'll need to have libdbi-devel
installed. If it's not in a default location, please amend the
CPPFLAGS manually while running make, like so:

     make CPPFLAGS="-I/usr/local/include"


Installation
------------
There is an install-script provided here which will attempt to
make all the necessary modifications to your nagios.cfg file
as well as installing merlin on your system. Please run

  sh install-merlin.sh --dest-dir=/path/to/merlin \
           --nagios-cfg=/path/to/nagios.cfg \
		   --db-type=mysql --db-user=merlin --db-pass=merlin \
		   --db-name=merlin

Note that the install-merlin.sh script requires write access to
whatever directory you choose as --dest-dir, as well as access
to write to your nagios.cfg file.
Also note that the install script can only handle setting up
mysql databases at the moment. Patches welcome to make it also
handle postgresql and whatever else you feel there is a need for.
If a different database type is selected, the install script will
still work, but it will not create the database for you.

Configuration
-------------
Configuring merlin is pretty straight-forward. Check the example.conf
file that accompanies this release and you'll see most of the common
examples available.

The syntax is fairly standard, being made up of a key without
spaces and a value containing arbitrary characters (although no
semi-colons). A configuration statement is terminated either by a
newline or a semi-colon. A configuration statement starting with a
hash-character (#) is considered a comment. Thus,

  key = value; # comment

makes "key" the key, "value" the value, terminated by the semi-colon,
and "# comment" all of the comment.
Leading and trailing whitespace is ignored.

The thing it doesn't really cover very well is how to configure masters,
peers and pollers, which is described more in-depth here.

In order to set up a loadbalanced system (ie, 2 or more peers), all
you need to do is add a section similar to the following to your
merlin configuration files on your merlin-empowered Nagios systems.
Let's pretend we have "nagios1" and "nagios2" in the network and
you wish for them to be set up in loadbalanced/redundancy mode.
nagios1 has 192.168.1.1 as IP. nagios2 has 192.168.1.2. Both use
port 15551 (the default).

On nagios1, add the following section to your merlin.conf file:
  --------------
  peer nagios2 {
    address = 192.168.1.2;
    port = 15551; # optional, since 15551 is the default
  }
  --------------

On nagios2, add the following section to your merlin.conf file:
  --------------
  peer nagios1 {
    address = 192.168.1.1;
    port = 15551; # optional, since 15551 is the default
  }
  --------------

Assuming nagios2 is a poller-node instead, responsible for checking
hosts in germany, you need to create a hostgroup in Nagios containing
all the hosts in germany that you want nagios2 to check for you. Let's
assume you call that hostgroup "germany-hosts". Then you need to add
following sections to your merlin.conf files.

On nagios1 (the "master" server), add the following section:
  --------------
  poller nagios2 {
    address = 192.168.1.2;
	port = 15551;
	hostgroup = germany-hosts; # name of the hostgroup containing all
	                           # the hosts you want this poller to check
  }
  --------------

On nagios2 (the slave server), add the following section:
  --------------
  master nagios1 {
    address = 192.168.1.1;
	port = 15551;
  }
  --------------

Note that these configuration sections need to be in the base section
of the configuration file. They must *not* be inside the daemon section.
This is because the master server will disable checks for all its pollers
once those pollers connect, and therefore it needs to read the list of
available nodes at configuration time.

A merlin node can have up to 65534 neighbours (assuming your system
lets a single program have that many file-descriptors open). A neighbour
is, in merlin terminology, a node that merlin connects to directly, so
you can build arbitrarily large networks by just specifying multiple
tiers of pollers.

A single merlin node can have pollers, peers and master nodes in its own
neighbourhood. As such, a single merlin node can, at the same time be
a peer (to its peers), a master (to its pollers) and a poller (to its
masters). One section has to be added to the merlin.conf file for each
of the hosts in its neighbourhood. The section must contain the
address of the neighbour, the port the neighbour is listening to
(unless it's the default port 15551) and, if the neighbour is a poller,
the section *must* contain a hostgroup statement declaring which
hostgroup the poller is responsible for checking.

...