Configure CentOS 5.5
cd /etc/sysconfig/network-scripts/
cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0.bak
scp root@10.0.2.16:/etc/sysconfig/network-scripts/ifcfg-eth0 .
cat ifcfg-eth0.bak |grep -i hw >> ifcfg-eth0
cat ifcfg-eth0.dhcp |grep -i Intel >> ifcfg-eth0
vi ifcfg-eth0
service network stop
service network start
vi /etc/resolv.conf
dig google.nl
yum update
vi /etc/sysconfig/network
service network reload
yum update
vi /etc/sysconfig/selinux
chkconfig –level 123456 ip6tables off
shutdown -r 0
install vmtools
yum install perl
mount /dev/cdrom /mnt/
ls /mnt/VMwareTools-8.3.2-257589.tar.gz /tmp/
cp /mnt/VMwareTools-8.3.2-257589.tar.gz /tmp/
umount /mnt/
yum install make gcc kernel-devel
tar xvzf VMwareTools-8.3.2-257589.tar.gz
cd vmware-tools-distrib/
./vmware-install.pl
service network restart
add repo
yum install wget
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm
mv rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm /tmp/
rpm –import http://apt.sw.be/RPM-GPG-KEY.dag.txt
rpm -i /tmp/rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm
yum check-update
yum update
PHP
yum install php
yum install php-pear
pear channel-update pear.php.net
pear upgrade-all
Other rpm's
yum -y install perl-Config-IniFiles
yum install libpng libpng-devel libjpg libjpg-devel
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 php-pear -y
yum install php-soap.x86_64 -y
yum install -y vixie-cron
service crond start
yum install -y sendmail
service sendmail on
chkconfig –level 35 sendmail on
[Don't edit the php.ini anymore]
vi /etc/php.ini
;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;
;RRD
extension=ldap.so
Download monitoringsoftware packages
cd /tmp
yum -y install wget
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.3.tar.gz
wget http://downloads.sourceforge.net/project/nagios/ndoutils-1.x/ndoutils-1.4b9/ndoutils-1.4b9.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fnagios%2Ffiles%2Fndoutils-1.x%2F&ts=1288691664&use_mirror=ovh
wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.15.tar.gz
wget http://download.centreon.com/index.php?id=143
Config services
cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.orig
scp root@10.0.2.11:/etc/snmp/snmpd.conf /etc/snmp/snmpd.conf
service snmpd start
chkconfig –level 35 snmpd on
chkconfig –level 345 mysqld on
chkconfig –level 345 httpd on
yum install -y ntp
chkconfig –level 345 ntpd on
scp root@10.0.2.8:/etc/ntp.conf /etc/ntp.conf
cat /etc/ntp.conf
service ntpd start
exit
Install Nagios
system-config-securitylevel-tui
service iptables stop
service httpd start
cd /tmp/
tar xvzf nagios-3.2.3.tar.gz
cd nagios-3.2.3
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
# Set some nagios rights
chown nagios:nagcmd /usr/local/nagios/var/rw
chown nagios:nagcmd /usr/local/nagios/var/rw/nagios.cmd
su – nagios
cd /usr/local/nagios/var
mkdir rw
exit
service nagios start
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
# configure apache and access
vi /etc/httpd/conf.d/nagios.conf
Nagios/Apache authetication against local htpasswd file
——————————————————-
# vi /etc/httpd/conf.d/nagios.conf
ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin"
<Directory "/usr/local/nagios/sbin">
AuthType Basic
AuthName "Nagios Access"
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
Require valid-user
# Lokale autenticatie file ipv LDAP
AuthUserFile /usr/local/nagios/etc/apache/htpasswd.users
</Directory>
Alias /nagios "/usr/local/nagios/share"
<Directory "/usr/local/nagios/share">
Options None
AllowOverride AuthConfig
Allow from all
</Directory>
# 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
——————————————————————————-
Nagios/Apache authetication against Windows Active Directory W2003R2 and higher
——————————————————————————-
# vi /etc/httpd/conf.d/nagios.conf
ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin"
<Directory "/usr/local/nagios/sbin">
AuthBasicProvider ldap
AuthType Basic
AuthzLDAPAuthoritative on
AuthName "Nagios Access"
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
Require valid-user
# Active Directory LDAP
AuthLDAPURL "ldap://elisabeth.nl:389/ou=Users,ou=admins,dc=elisabeth,dc=nl?sAMAccountName?sub?(objectClass=*)"
AuthLDAPBindDN "cn=sa_nagios,ou=Service Accounts,ou=admins,dc=elisabeth,dc=nl"
AuthLDAPBindPassword "wwwwachtwoord"
</Directory>
Alias /nagios "/usr/local/nagios/share"
<Directory "/usr/local/nagios/share">
Options None
AllowOverride AuthConfig
Allow from all
</Directory>
——————————————————————————-
service httpd reload
mkdir htpasswd -c /usr/local/nagios/etc/apache
mkdir /usr/local/nagios/etc/apache
htpasswd -c /usr/local/nagios/etc/apache/htpasswd.users nagiosadmin
htpasswd /usr/local/nagios/etc/apache/htpasswd.users roderick
htpasswd /usr/local/nagios/etc/apache/htpasswd.users nagioslook
vi /usr/local/nagios/etc/cgi.cfg
# install nagios plugins
cd /tmp/
tar xvzf nagios-plugins-1.4.15.tar.gz
cd nagios-plugins-1.4.15
./configure
make install
Install NDO
cd ..
tar xvzf ndoutils-1.4b9.tar.gz
cd ndoutils-1.4b9
ls
./configure –prefix=/usr/local/nagios/ –enable-mysql –disable-pgsql –with-ndo2db-user=nagios –with-ndo2db-group=nagios
make
cp ./src/ndomod-3x.o /usr/local/nagios/bin/ndomod.o
cp ./src/ndo2db-3x /usr/local/nagios/bin/ndo2db
chmod 774 /usr/local/nagios/bin/ndo*
chown nagios:nagios /usr/local/nagios/bin/ndo*
cp config/ndo* /usr/local/nagios/etc/
vi /usr/local/nagios/etc/nagios.cfg
event_broker_options=-1
broker_module=/usr/local/nagios/bin/ndomod.o config_file=/usr/local/nagios/etc/ndomod.cfg
vi /etc/init.d/ndo2db
voeg script toe onderaan bladzijde
chmod +x /etc/init.d/ndo2db
chkconfig –add ndo2db
chkconfig –level 345 ndo2db on
MySQL
service mysqld start
chkconfig –level 345 mysqld on
/usr/bin/mysqladmin -u root password 'root'
mysql -u root -p
Install Centreon and prequisits
visudo
#Defaults requiretty
yum -y install mail
yum install php-mbstring
service httpd reload
mkdir /etc/cron.d
cd /tmp/
tar xvzf centreon-2.1.9.tar.gz
cd centreon-2.1.9
./install.sh -i
During install these paths are needed:
/usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/RRDs.pm
/usr/share/pear/PEAR.php
/usr/local/nagios/bin/ndomod.o
#configure Nagios for NDO
cp /usr/local/nagios/etc/ndo2db.cfg-sample /usr/local/nagios/etc/ndo2db.cfg
# vi /usr/local/nagios/etc/ndo2db.cfg
socket_type=tcp
tcp_port=5669
db_name=ndo
db_prefix=nagios_
db_user=ndo
db_pass=ndo
/usr/local/nagios/bin/ndo2db -c /usr/local/nagios/etc/ndo2db.cfg
system-config-security
port 3306 en 5668 openen (tcp en ik heb ook udp geopend)
cp /usr/local/nagios/etc/ndomod.cfg-sample /usr/local/nagios/etc/ndomod.cfg
vi /usr/local/nagios/etc/ndomod.cfg
output_type=tcpsocket
output=127.0.0.1
tcp_port=5668
chmod 777 /usr/local/nagios/var
chmod 777 /usr/local/nagios/var/rw
service centstorage start
service centcore start
NDO Startup script /etc/init.d/ndo2db
#!/bin/sh
#
#
# chkconfig: 345 99 01
# description: Nagios to mysql
#
# Author : Gaëtan Lucas
# Realase : 07/02/08
# Version : 0.1 b
# File : ndo2db
# Description: Starts and stops the Ndo2db daemon
# used to provide network services status in a database.
#
status_ndo ()
{
if ps -p $NdoPID > /dev/null 2>&1; then
return 0
else
return 1
fi
return 1
}
printstatus_ndo()
{
if status_ndo $1 $2; then
echo "ndo (pid $NdoPID) is running…"
else
echo "ndo is not running"
fi
}
killproc_ndo ()
{
echo "kill $2 $NdoPID"
kill $2 $NdoPID
}
pid_ndo ()
{
if test ! -f $NdoRunFile; then
echo "No lock file found in $NdoRunFile"
echo -n " checking runing process…"
NdoPID=`ps h -C ndo2db -o pid`
if [ -z "$NdoPID" ]; then
echo " No ndo2db process found"
exit 1
else
echo " found process pid: $NdoPID"
echo -n " reinit $NdoRunFile …"
touch $NdoRunFile
chown $NdoUser:$NdoGroup $NdoRunFile
echo "$NdoPID" > $NdoRunFile
echo " done"
fi
fi
NdoPID=`head $NdoRunFile`
}
# Source function library
# Solaris doesn't have an rc.d directory, so do a test first
if [ -f /etc/rc.d/init.d/functions ]; then
. /etc/rc.d/init.d/functions
elif [ -f /etc/init.d/functions ]; then
. /etc/init.d/functions
fi
prefix=/usr/local/nagios
exec_prefix=${prefix}
NdoBin=${exec_prefix}/bin/ndo2db
NdoCfgFile=${prefix}/etc/ndo2db.cfg
NdoRunFile=${prefix}/var/ndo2db.run
NdoLockDir=/var/lock/subsys
NdoLockFile=ndo2db.lock
NdoUser=nagios
NdoGroup=nagios
# Check that ndo exists.
if [ ! -f $NdoBin ]; then
echo "Executable file $NdoBin not found. Exiting."
exit 1
fi
# Check that ndo.cfg exists.
if [ ! -f $NdoCfgFile ]; then
echo "Configuration file $NdoCfgFile not found. Exiting."
exit 1
fi
# See how we were called.
case "$1" in
start)
echo -n "Starting ndo:"
touch $NdoRunFile
chown $NdoUser:$NdoGroup $NdoRunFile
$NdoBin -c $NdoCfgFile
if [ -d $NdoLockDir ]; then
touch $NdoLockDir/$NdoLockFile;
fi
ps h -C ndo2db -o pid > $NdoRunFile
if [ $? -eq 0 ]; then
echo " done."
exit 0
else
echo " failed."
$0 stop
exit 1
fi
;;
stop)
echo -n "Stopping ndo: "
pid_ndo
killproc_ndo
# now we have to wait for ndo to exit and remove its
# own NdoRunFile, otherwise a following "start" could
# happen, and then the exiting ndo will remove the
# new NdoRunFile, allowing multiple ndo daemons
# to (sooner or later) run
#echo -n 'Waiting for ndo to exit .'
for i in 1 2 3 4 5 6 7 8 9 10 ; do
if status_ndo > /dev/null; then
echo -n '.'
sleep 1
else
break
fi
done
if status_ndo > /dev/null; then
echo
echo 'Warning – ndo did not exit in a timely manner'
else
echo 'done.'
fi
rm -f $NdoRunFile $NdoLockDir/$NdoLockFile
;;
status)
pid_ndo
printstatus_ndo ndo
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: ndo {start|stop|restart|status}"
exit 1
;;
esac
# End of this script
Leave a Reply