Centreon and Nagios on Centos 6.2

Centreon and Nagios on Centos 6.2

Centreon and Nagios on Centos 6.2 150 150 Roderick Derks

A complete guide step by step on howto install Centreon on Centos 6.2. This is worth some money guys.

 

Install Centos using the ks.cfg

yum update

yum install perl libstdc++.i686 sysstat rsync ntp -y
sed -i ‘s/acpi=off/acpi=on/g’ /boot/grub/grub.conf

ntpdate nl.pool.ntp.org
chkconfig –level 345 ntpd on
scp root@10.0.2.3:/etc/ntp.conf /etc/ntp.conf
service ntpd start

Install VMtools

mount /dev/cdrom /mnt
cd /tmp
tar xzf /mnt/VMwareTools-8.6.0-425873.tar.gz
cd vmware-tools-distrib/
./vmware-install.pl

Add REPO

cd /tmp
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
rpm –import http://apt.sw.be/RPM-GPG-KEY.dag.txt
rpm -i rpmforge-release-0.5.2-2.el6.rf.*.rpm

PHP

yum install php -y
yum install php-pear -y
pear channel-update pear.php.net
pear upgrade-all

yum perl-CPAN -y

Prequisits

yum install libpng libpng-devel libjpg libjpg-devel
yum install php-soap.x86_64 -y

yum install perl-RRD-Simple perl-DBI perl-DBD-MySQL gd fontconfig-devel libjpeg-devel libpng-devel gd-devel perl-GD php php-mysql php-gd perl-DBI perl-DBD-MySQL gd fontconfig-devel libjpeg-devel libpng-devel gd-devel perl-GD rrdtool perl-rrdtool perl-Crypt-DES perl-Digest-SHA1 perl-Socket6 perl-IO-Socket-INET6 net-snmp net-snmp-libs php-snmp dmidecode lm_sensors perl-Net-SNMP net-snmp-perl perl-Digest-HMAC net-snmp-utils openssl-devel perl-DBD-MySQL mysql-server mysql-devel sudo php-ldap php-xml

yum install -y sendmail
service sendmail on
chkconfig –level 35 sendmail on

yum -y install gcc make kernel-devel

Download Nagios/Centreon/NDO software

wget http://sourceforge.net/projects/nagios/files/nagios-3.x/nagios-3.4.1/nagios-3.4.1.tar.gz/download
wget http://sourceforge.net/projects/nagios/files/ndoutils-1.x/ndoutils-1.5.2/ndoutils-1.5.2.tar.gz/download
Nagios plugins are already compiled and will be restored later.

Install some needed perl modules for the plugins

cpan Test::More
cpan ExtUtils::MakeMaker
cpan Perl::OSType

SNMPD

# cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.orig
# vi /etc/snmp/snmpd.conf
rocommunity public
syslocation R71 Datacenter
syscontact info@360viewpoint.nl
includeAllDisks 10%
# suppresses logging of connection attempts
dontLogTCPWrappersConnects 1

Suppressing SNMPD Logging
# vi /etc/sysconfig/snmpd
OPTIONS=”-LS 0-4 d -Lf /dev/null -p /var/run/snmpd.pid”

# service snmpd start

Install Nagios

tar xvzf nagios-3.4.1.tar.gz
cd nagios
adduser nagios
mkdir /usr/local/nagios
chown nagios:nagios /usr/local/nagios
grep “^User” /etc/httpd/conf/httpd.conf
/usr/sbin/groupadd nagcmd
/usr/sbin/usermod -G nagcmd apache
/usr/sbin/usermod -G nagcmd nagios
./configure –prefix=/usr/local/nagios –with-command-group=nagcmd
make all
make install
make install-init
make install-config
make install-webconf
chkconfig –add nagios
chkconfig –level 35 nagios on

mkdir -p /usr/local/nagios/var/rw
chown nagios:nagcmd /usr/local/nagios/var/rw
touch /usr/local/nagios/var/rw/nagios.cmd
chown nagios:nagcmd /usr/local/nagios/var/rw/nagios.cmd

# copy images
rsync -avu root@10.0.2.118:/usr/local/nagios/share/images/ /usr/local/nagios/share/images

Software en configuratiefiles overzetten

rsync -avu root@10.0.2.18:/root/centr* /root/
rsync -avu root@10.0.2.18:/root/nag* /root/
rsync -avu root@10.0.2.18:/etc/httpd/conf.d/* /etc/httpd/conf.d/
rsync -avu root@10.0.2.18:/var/www/php* /var/www/
rsync -avu root@10.0.2.18:/usr/local/weat* /usr/local/
rsync -avu root@10.0.2.18:/usr/local/mol* /usr/local/
rsync -avu root@10.0.2.18:/etc/init.d/ndo* /etc/init.d/

# Now the nagios config for Apache has been added
# Add First User and create htpasswd file:
mkdir /usr/local/nagios/etc/apache
htpasswd -c /usr/local/nagios/etc/apache/htpasswd.users nagiosadmin
# Add Second User and use existing htpasswd file:
htpasswd /usr/local/nagios/etc/apache/htpasswd.users roderick

Install NDO

cd /tmp
tar xvzf ndoutils-1.5.2.tar.gz
cd ndoutils-1.5.2
./configure –prefix=/usr/local/nagios/ –enable-mysql –disable-pgsql –with-ndo2db-user=nagios –with-ndo2db-group=nagios
make

chmod +x /etc/init.d/ndo2db
chkconfig –add ndo2db
chkconfig –level 345 ndo2db on

yum -y install mailx

MySQL

service mysqld start
chkconfig –level 345 mysqld on
/usr/bin/mysqladmin -u root password ‘root’

Install Centreon

visudo
#Defaults    requiretty

yum -y install mail
yum install php-mbstring
service httpd reload
mkdir /etc/cron.d

cd /tmp
wget http://download.centreon.com/index.php?id=181
tar centreon*.tar.gz
cd centreon-2.3.8
./install.sh -i

During install these paths are needed:

/usr/lib64/perl5/RRDs.pm
/usr/share/pear/PEAR.php
/usr/local/nagios/bin/ndomod.o

scp root@10.0.2.18:/etc/centreon/conf.pm /etc/centreon/
scp root@10.0.2.18:/usr/local/nagios/etc/ndo2db.cfg /usr/local/nagios/etc/ndo2db.cfg
scp root@10.0.2.18:/usr/local/nagios/etc/ndomod.cfg /usr/local/nagios/etc/ndomod.cfg

chmod 777 /usr/local/nagios/var
chmod 777 /usr/local/nagios/var/rw

mkdir /usr/local/nagios/libexec/360viewpoint
chown nagios:nagios /usr/local/nagios/libexec/360viewpoint
rsync -avu root@10.0.2.18:/usr/local/nagios/libexec/360viewpoint/* /usr/local/nagios/libexec/360viewpoint/

Apache adjustments

Configure apache and the files
yum install -y mod_ssl

Goto the website and configure Centreon
yum install -y php-posix
chown apache:apache /etc/centreon/conf.pm

Restore the Centreon files from backup.

API installation

Install WMI from Zenoss.

Install VMware Perl API:

yum install perl-XML-LibXML
yum install libuuid-devel
cd /tmp; wget http://search.cpan.org/CPAN/authors/id/C/CF/CFABER/UUID-0.03.tar.gz
tar xvzf UUID-0.03.tar.gz
cd UUID-0.03
perl Makefile.PL
make
make install
find /usr/ -name UUID.pm

Download the vSphere API like VMware-vSphere-Perl-SDK-5.0.0-615831.x86_64.tar.gz
export http_proxy=
export ftp_proxy=
./vmware-install.pl

/usr/bin/perl -MVMware::VIRuntime -e 'print $VMware::VIRuntime::VERSION' /usr/lib/vmware-vcli/apps/general/connect.pl --url https://10.0.2.31/sdk/webService 

Addd this line to the check_vmware_api.pl script to prevent the message: Server version unavailable at ‘https://esx01:443/sdk/vimService.wsdl’ at /usr/share/perl5/VMware/VICommon.pm line 545.:
$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;

Remove the API if needed: /usr/bin/vmware-uninstall-vSphere-CLI.pl 

Database restore

Backup the current centreon environment.

gunzip < backup/20120702154631.centreon.sql.gz | mysql -u root -proot centreon
gunzip < backup/20120702154631.centstorage.sql.gz | mysql -u root -proot centstorage

Testdrive

Export the nagios config from Centreon
chown -R apache:apache /usr/local/nagios/etc

Start Nagios and check plugins. Resultaat:

  1. Compileer de plugins van Nagios opnieuw.
  2. check_vmware_api.pl heeft nodig:
    cpan Nagios::Plugin
    cpan HTTP:Date
  3.  chmod 777 /usr/local/nagios/var/rw/nagios.cmd
  4. cpan Net:DNS voor check_iftrafic3.pl
  5. voor check_mysql_health
    cpan Time::HiRes
    scp /etc/freetds.conf root@10.0.2.18:/etc/
    en een nieuwe versie van check_mysql_health gecompileerd

Centreon Syslog server toevoeging

# vi /etc/rsyslog.conf

#RRD
$ModLoad MySQL
$AllowedSender UDP, 127.0.0.1, 10.0.0.0/8
$AllowedSender TCP, 127.0.0.1, 10.0.0.0/8
#RRD

#RRD
# Configuration changes for Windows/Snare/Centreon-E2S logs
$EscapeControlCharactersOnReceive off

$template sysMysql,"INSERT INTO logs (host,facility, priority,level,tag,datetime,program,msg) VALUES ('%HOSTNAME%','%syslogfacility%','%syslogpriority-text%','%syslogseverity-text%','%syslogtag%', '%timereported:::date-mysql%','%programname%', '%msg%')", SQL

*.* >127.0.0.1,syslog,syslogadmin,centreon;sysMysql

*.=notice;mail.*;\
       *.=crit;*.=err;\
       *.=warning >127.0.0.1,syslog,syslogadmin,centreon;sysMysql
#RRD

Roderick Derks

Liefhebber van fietsen, van het oplossen van IT puzzels, en van het delen van informatie om anderen te helpen.

All stories by:Roderick Derks

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

    Your Name (required)

    Your Email (required)

    Subject

    Your Message

      Your Name (required)

      Your Email (required)

      Subject

      Your Message