Hi, if you have a large number of machines to check, distant sites (or for any other reason), it may be interresting to use distributed architecture.
For that, we will use satelittes.
You could find further explanations on Centreon offitial wiki here:
http://en.doc.centreon.com/DistributedArchitecture
The installation process is simpler (and faster) as you’ll only need the nagios part.
Here is a spreadsheet for the different login and passwords that will be used for the installation process (some of them are used in further post):
Account role | Login | Password |
Nagios | nagios | nagaccess03 |
User account | activlan | remoteaccess03 |
Web Nagios | nagiosadmin | nagwebaccess03 |
Let’s start the installation process
Insert you CD, boot from it and proceed for a minimal install.
For the partition scheme let the system choose one for you (I recommend using LVM because in case of “out of disk space” it will be easier to extend disk).
When asked, disable the automatic update.
DO NOT INSTALL ANY ROLE EXCEPT SSH.
System update
Once it’s installed, proceed with a system update
sudo aptitude update sudo aptitude full-upgrade -y
Switch to fixed IP address
sudo nano /etc/network/interfaces
Please verify that you are working with fixed IP address. If not, please change your settings. You should see something like this at the end of the file (the value should be different for you):
auto eth0 iface eth0 inet static address 192.168.1.101 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.1.1
REBOOT
Compilation component install
sudo aptitude install build-essential -y sudo aptitude install linux-headers-$(uname -r) -y
The headers should be already present.
If you are using a virtual machine, it’s time to install the appropriate tools (it’s up to you).
System
sudo aptitude install sysutils policykit ntp -y
Web and php5
sudo aptitude install apache2 apache2-mpm-prefork libapache2-mod-php5 -y sudo aptitude install php5 php5-mysql -y sudo aptitude install php-pear php5-ldap php5-snmp php5-gd -y
RRDTool
sudo aptitude install rrdtool librrds-perl -y
Perl
sudo aptitude install libconfig-inifiles-perl libcrypt-des-perl libdigest-hmac-perl libdigest-sha1-perl libgd-gd2-perl -y
SNMP
sudo aptitude install snmp snmpd libnet-snmp-perl libsnmp-perl -y
GD-Libraries
sudo aptitude install libgd2-xpm libgd2-xpm-dev libpng12-dev -y
Other needed library
sudo aptitude install libldap2-dev libssl-dev libsnmp-dev -y
Now we are ready to install Nagios.
User install
PS: use “nagaccess03” as password for nagios account.
sudo useradd -m -s /bin/bash nagios sudo passwd nagios sudo groupadd nagcmd sudo usermod -G nagios,nagcmd nagios sudo usermod -a -G nagios,nagcmd www-data
Nagios Core
cd /usr/local/src sudo wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.1.tar.gz sudo tar xvzf nagios-3.2.1.tar.gz cd nagios-3.2.1 sudo ./configure --prefix=/usr/local/nagios --with-nagios-user=nagios --with-nagios-group=nagios --with-command-group=nagcmd --enable-nanosleep --enable-event-broker sudo make all sudo make install sudo make install-init sudo make install-commandmode sudo make install-config sudo update-rc.d -f nagios defaults cd ..
Nagios plugins 1.4.14
sudo wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.14.tar.gz sudo tar xvfz nagios-plugins-1.4.14.tar.gz cd nagios-plugins-1.4.14 sudo ./configure --prefix=/usr/local/nagios --with-nagios-user=nagios --with-nagios-group=nagios sudo make sudo make install cd /usr/local/src
Ndoutils 1.4b9
sudo wget http://prdownloads.sourceforge.net/sourceforge/nagios/ndoutils-1.4b9.tar.gz sudo tar xvfz ndoutils-1.4b9.tar.gz cd ndoutils-1.4b9 sudo ./configure --prefix=/usr/local/nagios/ --enable-mysql --disable-pgsql --with-ndo2db-user=nagios --with-ndo2db-group=nagios sudo cp ./config/ndo2db.cfg-sample /usr/local/nagios/etc/ndo2db.cfg sudo cp ./config/ndomod.cfg-sample /usr/local/nagios/etc/ndomod.cfg sudo chown nagios:nagios /usr/local/nagios/etc/ndo*
It apears that with large monitoring system, ndoutils use a lot of IO and slows down drasticly the system. It’s better to installe the patched version.
cd /usr/local/src sudo wget -r -k -np http://svn.centreon.com/trunk/Patch-NDOutils/ cd svn.centreon.com/trunk/Patch-NDOutils sudo bash ./configure --prefix=/usr/local/nagios/ --enable-mysql --disable-pgsql --with-ndo2db-user=nagios --with-ndo2db-group=nagios sudo make sudo cp src/ndomod-3x.o /usr/local/nagios/bin/ndomod.o sudo cp src/ndo2db-3x /usr/local/nagios/bin/ndo2db sudo chmod 775 /usr/local/nagios/bin/ndo2db sudo chmod 755 /usr/local/nagios/bin/ndomod.o sudo chown nagios:nagios /usr/local/nagios/bin/ndo2db sudo chown nagios:nagios /usr/local/nagios/bin/ndomod.o
Nagios web interface
I also recommend installing Nagios web interface as it could help you comparing your centreon checks and nagios exported configuration.
Use “nagwebaccess03” as password
cd /usr/local/src/nagios-3.2.1 sudo make install-webconf sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
SNMP settings
Please edit /etc/default/snmpd
sudo nano /etc/default/snmpd
and change these sections:
#SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1' SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1 192.168.0.148'
Replace 192.168.0.148 by your IP address.
#TRAPDRUN=no TRAPDRUN=yes
Edit snmpd configuration file:
sudo nano /etc/snmp/snmpd.conf
and change this section:
# sec.name source community #com2sec paranoid default public com2sec readonly default public com2sec readonly 127.0.0.1 public com2sec readonly 192.168.0.0/24 public #com2sec readwrite default private
Edit ndomod configuration file:
sudo nano /usr/local/nagios/etc/ndomod.cfg
find and replace these sections:
#instance_name=default instance_name=Central
output_type=tcpsocket #output_type=unixsocket
output=CENTREON_CENTRAL_IP_ADDRESS #output=/usr/local/nagios/var/ndo.sock
#reconnect_warning_interval=15 reconnect_warning_interval=900
#config_output_options=2 config_output_options=3
Edit sudoers grant file:
sudo nano /etc/sudoers
and add nagios user account after root account:
nagios ALL=(ALL) ALL
Create missing folder:
sudo mkdir -p /var/lib/centreon/centplugins/ sudo chown nagios:nagios /var/lib/centreon/centplugins/
The following steps have to be done on CENTRAL CENTREON SERVER
If you didn’t generate ssh key yet, proceed as follow.
Log you on Centreon Central server and switch to nagios account.
su nagios cd ~ ssh-keygen
Here is an example of produced output (just press ENTER to all questions):
Generating public/private rsa key pair. Enter file in which to save the key (/home/nagios/.ssh/id_rsa): Created directory '/home/nagios/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/nagios/.ssh/id_rsa. Your public key has been saved in /home/nagios/.ssh/id_rsa.pub. The key fingerprint is: 17:f1:f4:f3:2a:de:94:eb:36:8a:82:84:d3:cb:cf:ee nagios@act-centreon-test The key's randomart image is: +--[ RSA 2048]----+ | . . | | + . | | . . o | | . o | | o S . .| | o o . o | | + o . + | | +.. o +o. | | +E.. o++. | +-----------------+
After that, copy your public key to the satellite:
ssh-copy-id -i ~/.ssh/id_rsa.pub nagios@{SATELITTE_IP_ADDRESS}
Use nagaccess03 for accessing your satellite (or use your own password).
Verify that you could access to the satellite without password prompt:
ssh nagios@{SATELITTE_IP_ADDRESS}
Exit to came back to your central centreon server.
Synchronize commands with the satellite:
scp /usr/local/nagios/libexec/* nagios@{SATELITTE_IP_ADDRESS}:/usr/local/nagios/libexec scp /usr/local/nagios/bin/ndomod.o nagios@{SATELITTE_IP_ADDRESS}:/usr/local/nagios/bin
if you encounter access denied errors like:
scp: /usr/local/nagios/libexec/check_dhcp: Permission denied
Delete files from satellite and resync again with scp.
Optionnaly, if you use rsyslog module in Centreon, redirect your logs:
Edit rsyslog configuration file
sudo nano /etc/rsyslog.conf
Add at the end of the file log events redirection inside your database:
*.=notice;mail.*;\ *.=crit;*.=err;\ *.=warning @{CENTREON_CENTRAL_IP_ADDRESS}
Replace {CENTREON_CENTRAL_IP_ADDRESS} by the real IP address.
Edit 50-default.conf to correct the path
sudo nano /etc/rsyslog.d/50-default.conf
At the end of the file, comment the xconsole section:
#daemon.*;mail.*;\ # news.err;\ # *.=debug;*.=info;\ # *.=notice;*.=warn |/dev/xconsole
Optionnaly intall NRPE module:
cd /usr/local/src sudo wget http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.12/nrpe-2.12.tar.gz?use_mirror=kent sudo tar xzfv nrpe-2.12.tar.gz cd nrpe-2.12/ sudo ./configure sudo make all sudo make install-plugin
Reboot your satellite.
Connect to the web interface and proceed as follow:
Add a new pooler:
Your IP address may be different.
Add new satelittes ndomod configuration:
Output is your Centreon IP address.
Addin new nagios satelittes configuration file:
Duplicate the existing one then edit it:
Add a new host (your satelitte):
PS: Your IP address may be different.
Maybe you have noticed that I monitor my satellite from the central server. You should monitor your central server by your satelitte (it’s not advised to do a self monitoring)
Change the Centreon host. It has to be monitored by the satelitte:
Export once with debug:
You should see two tabs:
Check on both servers the result (you should not have errors):
If it’s ok, export your configurations:
Thanks so much for this document, it helped me a lot.
JT
Hi,
I’m glad it helped you.
Regards