- Log in with root or use sudo
- Create a downloads folder : mkdir ~/downloads
- Download the tarball with "wget" : wget http://prdownload.sourceforge.net/nagios/nagios-2.9.tar.gz?download
- Create a "src" folder if necessary to put the nagios into in : mkdir /usr/local/src
- Extract the tarball into the "src" folder : tar xvfz ~/downloads/nagios-2.9.tar.gz
- groupadd -g 9000 nagios (Create the group nagios)
- groupadd -g 9001 nagcmd (Create the group nagcmd)
- useradd -u 9000 -g nagios -G nagioscmd -d /usr/local/nagios -c "Nagios Admin" nagios (Create the user nagios, member of nagios, nagioscmd, and home directory)
- Install the tools needed for the compilation : apt-get install build-essential
- Install the PNG, JPEG libraries : apt-get install libpng12-0 libpng12-dev libjpeg62 libjpeg62-dev
- Install the last GD library into the downloads diretory : wget http://www.libgd.org/releases/gd-2.0.35.tar.gz
- Uncompress the tarball : tar xvfz ~/downloads/gd-2.0.35.tar.gz
- ./configure in the GD directory
- make all
- make install
- Install Apache2 with apt-get install apache2
- You need to find the user for Apache2, you can do it with the following command : grep "^User" /etc/apache2/apache2.conf. Normally you will see www-data
- Add "www-data" to the "nagcmd" group : usermod -G nagcmd www-data
- Create the following directories : mkdir /usr/local/nagios /etc/nagios /var/nagios
- Change the owner of these directories : chown nagios.nagios /usr/local/nagios /etc/nagios /var/nagios
- Go to the source directory : ./configure --sysconfigdir=/etc/nagios --localstatedir=/var/nagios --with-command-groupe=nagcmd
- make all
- make install
- make install-init
- make install-commandmode
- make install-config
- Create symbolic link to run Nagios at the startup : ln -s /etc/init.d/nagios /etc/rc2.d/S99nagios
- Create symbolic link to stop Nagios : ln -s /etc/init.d/nagios /etc/rc2.d/K99nagios
- Repeat these steps for rc3 and rc5
- We need to install the plugings, download it into ~/downloads : wget http://downloads.sourceforge.net/nagiosplug/nagios-plugins-1.4.9.tar.gz
- Uncompress into the "src" folder : tar xvfz ~/downloads/nagios-plugins-1.4.9
- apt-get install fping
- apt-get install smbclient
- apt-get install libradius1 libradius1-dev
- apt-get install libldap2 libldap2-dev
- apt-get install libsnmp-base libsnmp9 libsnmp9-dev snmp
- apt-get install libssl-dev libssl0.9.8
- apt-get install postgresql-dev
- apt-get install mysql-client libmysql++-dev
- perl -MCPAN -e 'install Net::SNMP'
- ./configure --sysconfdir=/etc/nagios --localstatedir=/var/nagios
- make all
- make install
The plugin check_icmp must have the SUID bit to function correctly.
- chown root.nagios /usr/local/nagios/libexec/check_icmp
- chmod 4711 /usr/local/nagios/libexec/check_icmp
- Go to the /etc/apache2/conf.d
- Create the nagios.conf and follow the instructions from there http://nagios.sourceforge.net/docs/2_0/installweb.html
- Edit the cgi.cfg to use the authentication : use_authentication=1
- Create a .htaccess in the following directory /usr/local/nagios/sbin with the following content :
AuthName "Nagios-Monitoring"
AuthType Basic
AuthUserFile /etc/nagios/htpasswd
require valid-user - In /etc/nagios : htpasswd -c htpasswd nagios
- Change the owner of the file to www-data : chown www-data.www.data htpasswd
- Give "rw" to the user www-data only : chmod 600 htpasswd
No comments:
Post a Comment