Nagios : Différence entre versions
(→Nagios) |
(→Nagios) |
||
| Ligne 64 : | Ligne 64 : | ||
# wget http://switch.dl.sourceforge.net/sourceforge/nagios/nagios-3.0b3.tar.gz | # wget http://switch.dl.sourceforge.net/sourceforge/nagios/nagios-3.0b3.tar.gz | ||
| − | |||
# wget http://belnet.dl.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.9.tar.gz | # wget http://belnet.dl.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.9.tar.gz | ||
| Ligne 89 : | Ligne 88 : | ||
# make all | # make all | ||
# make full install | # make full install | ||
| + | |||
| + | Installation des plugins : | ||
| + | |||
| + | # cd .. | ||
| + | # tar xvzf nagios-plugins-1.4.9.tar.gz | ||
| + | # cd nagios-plugins-1.4.9 | ||
| + | # ./configure | ||
| + | # make | ||
| + | # make install | ||
==== Install Oreon 1.4 ==== | ==== Install Oreon 1.4 ==== | ||
Version du 7 septembre 2007 à 10:27
This howto provides a step by step walkthrough on installing the required components, and setting the default parameters (file paths, etc.) for Oreon to work with the default Nagios from Debian.
Sommaire
Installer le serveur virtuel
Creation de l'image :
# xen-create-image --hostname nagios --debootstrap --ip 193.49.133.77 --memory 1024MB --swap 2048Mb --vcpu 2
Demarrage de l'image :
# xm create -c nagios.cfg
Mot de passe root :
# passwd
Install required Debian packages
apache2
# apt-get install sudo apache2
mysql
# apt-get install mysql-server-5.0
php5
# apt-get install php5 # apt-get install php-db php-date # apt-get install php5-gd php5-mysql php5-snmp php5-ldap # apt-get install php-mail php-mail-mime php-net-smtp php-net-socket # apt-get install php5-xmlrpc
rrdtool
# apt-get install rrdtool librrds-perl
snmp
# apt-get install snmp snmpd libnet-snmp-perl
Eventually configure snmpd on this machine:
# vi /etc/snmp/snmpd.conf com2sec readonly default public # /etc/init.d/snmpd restart # snmpwalk -v1 -c public localhost SNMPv2-MIB::sysDescr.0 = STRING: Linux debian 2.6.18-4-686 #1 SMP Wed May 9 23:03:12 UTC 2007 i686 SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10 DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (1339340) 3:43:13.40 [...] IPV6-MIB::ipv6IfAdminStatus.2 = INTEGER: up(1) IPV6-MIB::ipv6IfOperStatus.1 = INTEGER: up(1) IPV6-MIB::ipv6IfOperStatus.2 = INTEGER: up(1)
Additionnal PEAR modules
# pear upgrade pear # pear install -o -f --alldeps DB_DataObject DB_DataObject_FormBuilder MDB2 Numbers_Roman \ Numbers_Words HTML_Common HTML_QuickForm HTML_QuickForm_advmultiselect HTML_Table Auth_SASL \ HTTP Image_Canvas Image_Color Image_Graph Image_GraphViz Net_Traceroute Net_Ping Validate XML_RPC SOAP
Nagios
telecharger les archives :
# wget http://switch.dl.sourceforge.net/sourceforge/nagios/nagios-3.0b3.tar.gz # wget http://belnet.dl.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.9.tar.gz
decompresser nagios
# tar xvzf nagios-3.0b3.tar.gz # cd nagios-3.0b3
on install :
# adduser nagios # groupadd nagcmd # usermod -G nagcmd www-data # usermod -G nagcmd nagios
# apt-get install gcc make g++ libpar-perl # apt-get install libcache-cache-perl libcache-memcached-perl libcache-perl libmemcache-dev memcached libsdl-perl
Il y a un probleme avec des librairies :
# ln -s /usr/lib/libperl.so.5.8.8 /usr/lib/libperl.so
# ./configure --with-command-group=nagcmd --with-default-perfdata --enable-embedded-perl --with-perlcache
# make all # make full install
Installation des plugins :
# cd .. # tar xvzf nagios-plugins-1.4.9.tar.gz # cd nagios-plugins-1.4.9 # ./configure # make # make install
Install Oreon 1.4
`install.sh' script
# http://download.oreon-project.org/centreon/centreon-1.4.1.tar.gz # tar zxf centreon-1.4.1.tar.gz # cd centreon-1.4.1 # ./install.sh Where is installed Nagios ? /usr/lib/cgi-bin/nagios2 Where are your nagios etc directory ? /etc/nagios2 Where are your nagios plugins / libexec directory ? /usr/lib/nagios/plugins Where are your nagios bin directory ? /usr/sbin Where do I install Oreon ? /usr/local/oreon Where is sudo ? /etc/sudoers Where is installed RRD perl modules (RRDs.pm) ? /usr/lib/perl5 Where is rrdtool binary ? /usr/bin/rrdtool Where is mail binary ? /usr/bin/mail Where is PEAR Path ? /usr/share/php Do you want to install Oreon Plugins ? y Do you want to install Oreon Traps Plugins ? y Where is your SNMP configuration file? /etc/snmp/ Do you want overwrite this file ? You must regenerate this one from Oreon interface. y By default, oreon use nagios user, it's correct ? y You must specify cron user : y
Apply patches
Retrieve patches:
# mkdir oreon-1.4-patches
# cd oreon-1.4-patches
# (I=1; STATUS=0;
while [ $STATUS -eq 0 ]; do
wget http://download.oreon-project.org/patch/oreon-patch-1.4-$I.tgz;
STATUS=$?;
I=$(($I+1));
done)
Note: This script has a small error since it will try to download oreon-patch-1.4-6.tgz as well
Unpack patches:
# (for TARGZ in *.tgz; do
mkdir $TARGZ.unpack && tar -C $TARGZ.unpack -zxf $TARGZ;
done)
Apply all the patches:
# (for UNPACK in *.unpack; do
for PATCH in $UNPACK/*.patch $UNPACK/*/*.patch; do
echo "Applying patch $PATCH";
cat "$PATCH" | (cd /usr/local/oreon && patch -p1);
done;
done)
Web install
Restart apache/mysql
# /etc/init.d/mysql restart # /etc/init.d/apache2 restart
and finalize the installation with the Oreon Web interface:
http://your_server/oreon/
Parameters:
Nagios Version = [2.x]
Oreon Database Name = [oreon] Oreon Data Storage Database Name = [ods] Oreon Database Password = [******] MySQL Client version (Password Haching Changes) = [>=4.1 - PASSWORD()]
Administrator login for Oreon = [admin] Administrator password for Oreon = [******] Administrator Email for Oreon = [someone@somewhere]
Fix paths in Oreon database for Debian Nagios
Now we need to change some default parameters to follow the layout from Nagios:
# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 18 Server version: 5.0.32-Debian_7etch1-log Debian etch distribution Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> use oreon Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> UPDATE general_opt SET nagios_path_img = '/usr/share/nagios/htdocs/images/logos/'; mysql> UPDATE general_opt SET nagios_path_bin = '/usr/sbin/nagios2'; mysql> UPDATE cfg_cgi SET main_config_file = '/etc/nagios2/nagios.cfg'; mysql> UPDATE cfg_cgi SET physical_html_path = '/usr/share/nagios2/htdocs'; mysql> UPDATE cfg_cgi SET url_html_path = '/nagios2'; mysql> UPDATE cfg_cgi SET nagios_check_command = 'nagios_check_command=/usr/lib/nagios/plugins/check_nagios /var/cache/nagios2/ status.dat 5 '/usr/sbin/nagios2''; mysql> UPDATE cfg_nagios SET log_file = '/var/log/nagios2/nagios.log'; mysql> UPDATE cfg_nagios SET cfg_dir = '/etc/nagios2/'; mysql> UPDATE cfg_nagios SET temp_file = '/var/tmp/nagios.tmp'; mysql> UPDATE cfg_nagios SET status_file = '/var/cache/nagios2/status.dat'; mysql> UPDATE cfg_nagios SET p1_file = '/usr/lib/nagios2/p1.pl'; mysql> UPDATE cfg_nagios SET log_archive_path = '/var/log/nagios2/archives/'; mysql> UPDATE cfg_nagios SET command_file = '/var/lib/nagios2/rw/nagios.cmd'; mysql> UPDATE cfg_nagios SET downtime_file = '/var/lib/nagios2/downtime.dat'; mysql> UPDATE cfg_nagios SET comment_file = '/var/lib/nagios2/comments.dat'; mysql> UPDATE cfg_nagios SET lock_file = '/var/run/nagios2/nagios2.pid'; mysql> UPDATE cfg_nagios SET state_retention_file = '/var/lib/nagios2/retention.dat'; mysql> use ods Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> UPDATE config SET RRDdatabase_path = '/usr/local/oreon/OreonDataStorage/'; mysql> UPDATE config SET drop_file = '/var/log/nagios2/service-perfdata.tmp'; mysql> UPDATE config SET perfdata_file = '/var/log/nagios2/service-perfdata'; mysql> UPDATE config SET nagios_log_file = '/var/log/nagios2/nagios.log'; mysql> QUIT
Final fixes
# apt-get install libconfig-inifiles-perl # sed -ie 's,/srv/nagios/libexec,/usr/lib/nagios/plugins,g' /usr/lib/nagios/plugins/check_graph_traffic.pl
# chown nagios:www-data /var/lib/nagios2/rw/ # chmod g+rx /var/lib/nagios2/rw/