Actions

Nagios: Difference between revisions

From Rabbi Blog

m (New page: After 2+ years of uptime, my Nagios box went down unexpectedly and I decided to take the opportunity to create a new box. I used the following instructions from start to finish with mino...)
 
m (Updated Nagios Install Directions)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
After 2+ years of uptime, my Nagios box went down unexpectedly and I decided to take the opportunity to create a new box.
=Nagios Install=


I used the following instructions from start to finish with minor alterations and had good success:
I knew I had a discussion on this somewhere, found it in GoogleWave.  Time to rescue that...


http://www.wallpaperama.com/forums/how-to-install-nagios-on-fedora-core-t6078.html
<pre>
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....
</pre>
 
# Install Ubuntu Server (v 9.10)
## Install LAMP, Mail, OpenSSL, Postgres [HEY LOOK, A LAMP REFERENCE!]
# Username: nagios
# Password: [make one up]
# After installation and reboot, SSH to the device
## ifconfig to get IP from terminal if required
# Get Nagios Installation and Plugins Files
### Get the latest fromhttp://www.nagios.org/download/
### Copy the shortcut from the site
### wgethttp://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.0.tar.gz
### wgethttp://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.14.tar.gz
## Unpack Nagios
## tar xvzf [name of the nagios tar file above]
## Unpack plugins and install the version you have downloaded
### tar xvzf nagios-plugins-1.4.[xxx].tar.gz
##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).
###[**See part 2 for current nagiosinstall.sh script**]
# Upload the file to your /home/nagios directory
# sudo chmod +x nagiosinstall.sh
# ./nagiosinstall.sh
## Set passwords as needed
# Check the last bit of output, it will be the preflight check. If no errors, continue:
# Make nagios a service
## sudo ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios
# Start Nagios
## sudo /etc/init.d/nagios start
# Browse tohttp://[IPAddress]/nagios
## Login with nagiosadmin and the password designated in 7.k.i
 
References:
#[http://www.ghacks.net/2009/06/08/how-to-install-nagios-on-ubuntu-server/ ghacks.net]
#[http://www.ubuntugeek.com/nagios-network-monitoring-system-setup-in-ubuntu.html ubuntugeek.com]


For my reference, here are the steps I used (minus passwords)
=nagiosinstall.sh=


<pre>
<pre>
yum install httpd
# Add the names below of the downloaded packages
yum install gcc
echo off
yum install glibc glibc-common
echo "Unpacking Nagios files"
yum install gd gd-devel
tar xvzf nagios-3.2.0.tar.gz
/usr/sbin/useradd -m nagios
tar xvzf nagios-plugins-1.4.14.tar.gz
passwd nagios  
tar xvzf net-snmp_5.4.1~dfsg.orig.tar.gz
/usr/sbin/groupadd nagcmd
###########################################################
/usr/sbin/usermod -G nagcmd nagios
### Uncomment the next part to use (rather long in testing)
/usr/sbin/usermod -G nagcmd apache
echo "installing Net::SNMP for Perl"
mkdir ~/downloads
cd /home/nagios/net-snmp-5.4.1
cd ~/downloads
sudo apt-get install libperl-dev
wget http://osdn.dl.sourceforge.net/sourceforge/nagios/nagios-3.0.3.tar.gz
sudo ./configure
wget http://osdn.dl.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.12.tar.gz
sudo make
cd ~/downloads
sudo make install
tar xzf nagios-3.0.3.tar.gz
cd /home/nagios/
cd nagios-3.0.3
###########################################################
./configure --with-command-group=nagcmd  
echo "starting apt-get updates and installations"
make all  
sudo apt-get update
make install
sudo apt-get install apache2
make install-init
sudo apt-get install build-essential
make install-config
sudo apt-get install ncurses-dev
make install-commandmode  
sudo apt-get install libgd2-xpm-dev
make install-webconf  
sudo apt-get install php5-gd
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin  
sudo apt-get install gcc
service httpd restart
sudo apt-get install make
cd ~/downloads
sudo apt-get install openssl
tar xzf nagios-plugins-1.4.12.tar.gz
sudo apt-get install openssl
cd nagios-plugins-1.4.12
sudo apt-get install freeradius
./configure --with-nagios-user=nagios --with-nagios-group=nagios
#sudo apt-get install slapd ldap-utils libnss-ldap libpam-ldap
make
sudo apt-get install samba smbldap-tools samba-doc smbclient
make install  
sudo apt-get install qstat
chkconfig --add nagios
sudo apt-get install fping
chkconfig nagios on
sudo apt-get install libpq-dev
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg  
sudo apt-get install snmpd
# import backed up cfg files to /usr/local/nagios/etc
sudo apt-get install snmp
service nagios start
sudo apt-get install libsnmp
# check http://localhost/nagios
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
</pre>
</pre>
[[Category:Linux]]
[[Category:Weblog-2008-08]]

Latest revision as of 02:05, 1 September 2010

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