Actions

Nagios

From Rabbi Blog

Revision as of 02:05, 1 September 2010 by Rabbi Bob (talk | contribs) (Updated Nagios Install Directions)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Nagios Install

I knew I had a discussion on this somewhere, found it in GoogleWave. Time to rescue that...

You don't need to go down the road of using the install script, but through reading I kept running into
dependencies that weren't included in every setup instructional I found, so I balled it all together and kept
installing Ubuntu server from scratch & running the script until I had a working Nagios install, then called
it a day. Your mileage may vary....
  1. Install Ubuntu Server (v 9.10)
    1. Install LAMP, Mail, OpenSSL, Postgres [HEY LOOK, A LAMP REFERENCE!]
  2. Username: nagios
  3. Password: [make one up]
  4. After installation and reboot, SSH to the device
    1. ifconfig to get IP from terminal if required
  5. Get Nagios Installation and Plugins Files
      1. Get the latest fromhttp://www.nagios.org/download/
      2. Copy the shortcut from the site
      3. wgethttp://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.0.tar.gz
      4. wgethttp://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.14.tar.gz
    1. Unpack Nagios
    2. tar xvzf [name of the nagios tar file above]
    3. Unpack plugins and install the version you have downloaded
      1. tar xvzf nagios-plugins-1.4.[xxx].tar.gz
    4. Create a file called nagiosinstall.sh and paste the following commands in the file. BE SURE TO CHANGE THE NAMES OF NAGIOS-3.2.0 and nagios-plugins-1.4.14 to be EXACTLY WHAT THE UNPACKED DIRECTORY NAMES ARE (from above).
      1. [**See part 2 for current nagiosinstall.sh script**]
  6. Upload the file to your /home/nagios directory
  7. sudo chmod +x nagiosinstall.sh
  8. ./nagiosinstall.sh
    1. Set passwords as needed
  9. Check the last bit of output, it will be the preflight check. If no errors, continue:
  10. Make nagios a service
    1. sudo ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios
  11. Start Nagios
    1. sudo /etc/init.d/nagios start
  12. Browse tohttp://[IPAddress]/nagios
    1. Login with nagiosadmin and the password designated in 7.k.i

References:

  1. ghacks.net
  2. ubuntugeek.com

nagiosinstall.sh

# Add the names below of the downloaded packages
echo off
echo "Unpacking Nagios files"
tar xvzf nagios-3.2.0.tar.gz
tar xvzf nagios-plugins-1.4.14.tar.gz
tar xvzf net-snmp_5.4.1~dfsg.orig.tar.gz
###########################################################
### Uncomment the next part to use (rather long in testing)
echo "installing Net::SNMP for Perl"
cd /home/nagios/net-snmp-5.4.1
sudo apt-get install libperl-dev
sudo ./configure
sudo make
sudo make install
cd /home/nagios/
###########################################################
echo "starting apt-get updates and installations"
sudo apt-get update
sudo apt-get install apache2
sudo apt-get install build-essential
sudo apt-get install ncurses-dev
sudo apt-get install libgd2-xpm-dev
sudo apt-get install php5-gd
sudo apt-get install gcc
sudo apt-get install make
sudo apt-get install openssl
sudo apt-get install openssl
sudo apt-get install freeradius
#sudo apt-get install slapd ldap-utils libnss-ldap libpam-ldap
sudo apt-get install samba smbldap-tools samba-doc smbclient
sudo apt-get install qstat
sudo apt-get install fping
sudo apt-get install libpq-dev
sudo apt-get install snmpd
sudo apt-get install snmp
sudo apt-get install libsnmp
sudo apt-get install libsnmp9-dev
sudo apt-get install libsnmp-base
sudo apt-get install libsnmp-perl
sudo apt-get upgrade
echo "adding user nagios"
sudo useradd -m nagios
sudo passwd nagios
echo "adding group nagios"
sudo groupadd nagios
sudo usermod -G nagios nagios
sudo groupadd nagcmd
sudo usermod -a -G nagcmd nagios
sudo usermod -a -G nagcmd www-data
# Remove the comment line below and set path name to your download file
cd /home/nagios/nagios-3.2.0
sudo ./configure --with-command-group=nagcmd
sudo make all
sudo make install
sudo make install-init
sudo make install-config
sudo make install-commandmode
sudo make install-webconf
sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
sudo /etc/init.d/apache2 reload
cd /home/nagios
# Remove the comment line below and set path name to your download file
cd /home/nagios/nagios-plugins-1.4.14
sudo ./configure --with-nagios-user=nagios --with-nagios-group=nagios
sudo make
sudo make install
sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
cd /home/nagios