Installing Nagios and Munin
*************************************
Apache Instalation
sudo apt-get install apache2
sudo apt-get install libapache2-mod-php5
sudo apt-get install build-essential
sudo apt-get install libgd2-xpm-dev
****************************************
Create Account Information
Become the root user.
sudo -s
Password123
Create a new nagios user account and give it a password.
/usr/sbin/useradd -m -s /bin/bash nagios
passwd nagios
Enter new UNIX password:nagiosadmin
Retype new UNIX password:nagiosadmin
passwd: password updated successfully
root@stg-monitor:~# /usr/sbin/groupadd nagcmd
root@stg-monitor:~# /usr/sbin/usermod -a -G nagcmd nagios
root@stg-monitor:~# /usr/sbin/usermod -a -G nagcmd www-data
**************************************************
Download the tar ball for Nagios and Nagios Plugins
****************************************************
Configure
./configure --with-command-group=nagcmd
*** Configuration summary for nagios 3.2.3 10-03-2010 ***:
General Options:
-------------------------
Nagios executable: nagios
Nagios user/group: nagios,nagios
Command user/group: nagios,nagcmd
Embedded Perl: no
Event Broker: yes
Install ${prefix}: /usr/local/nagios
Lock file: ${prefix}/var/nagios.lock
Check result directory: ${prefix}/var/spool/checkresults
Init directory: /etc/init.d
Apache conf.d directory: /etc/apache2/conf.d
Mail program: /bin/mail
Host OS: linux-gnu
Web Interface Options:
------------------------
HTML URL: http://localhost/nagios/
CGI URL: http://localhost/nagios/cgi-bin/
Traceroute (used by WAP):
Review the options above for accuracy. If they look okay,
type 'make all' to compile the main program and CGIs.
*************************************************************
Compile the Nagios source code.
make all
*************************************************************
Install binaries, init script, sample config files and set permissions on the external command directory.
make install
make install-init
make install-config
make install-commandmode
*************************************************************
Configure the Web Interface
Install the Nagios web config file in the Apache conf.d directory.
make install-webconf
Create a nagiosadmin account for logging into the Nagios web interface. Remember the password you assign to this account - you'll need it later.
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
New password:nagios
Re-type new password:nagios
Restart Apache to make the new settings take effect.
/etc/init.d/apache2 reload
*************************************************************
Compile and Install the Nagios Plugins
cd /home/cybage/untar/nagios-plugins-1.4.11
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install
*************************************************************
Configure Nagios to automatically start when the system boots.
ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios
Verify the sample Nagios configuration files.
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
If there are no errors, start Nagios.
/etc/init.d/nagios start
*************************************************************
Check Nagios web interface at
http://monitor.dimestore.com/nagios/
*************************************************************
Configure NRPE plugins on PROD-Monitor server
NRPE require you install xinetd and libssl-dev so we’ll do that now
apt-get install xinetd
apt-get install libssl-dev
/home/cybage/untar/nrpe-2.12
make all
make install-plugin
make install-daemon
make install-daemon-config
make install-xinetd
now we need to configure the daemon so it will talk to our Nagios server, well do this buy editing /etc/xinetd.d/nrpe and adding our monitoring servers address:
only_from = ??.??.??.??
Then add “nrpe 5666/tcp # NRPE” to /etc/services as below
nrpe 5666/tcp # NRPE
Restart xinetd services
root@prod-monitor:~/untar/nrpe-2.12# /etc/init.d/xinetd restart
* Stopping internet superserver xinetd [ OK ]
* Starting internet superserver xinetd [ OK ]
Confirm NRPE is listening on port 5666
root@prod-monitor:~/untar/nrpe-2.12# netstat -at | grep nrpe
tcp 0 0 *:nrpe *:* LISTEN
Confirm check_nrpe is present in the Nagios libexec folder
ls -l /usr/local/nagios/libexec/check_nrpe
****************************************************************************
edit Nagios configuration to replace the localhost with actual nagios host name and new required cfg files
cd /usr/local/nagios/etc/objects/
sudo touch hosts.cfg services.cfg hostgroups.cfg
edit nagios.cfg so that nagios can use these newly added configuration files
and comment the localhosts.cfg file
cfg_file=/usr/local/nagios/etc/objects/hosts.cfg
cfg_file=/usr/local/nagios/etc/objects/hostgroups.cfg
cfg_file=/usr/local/nagios/etc/objects/contactgroups.cfg
cfg_file=/usr/local/nagios/etc/objects/services.cfg
Verify the sample Nagios configuration files.
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
If there are no errors, reload Nagios.
sudo /etc/init.d/nagios reload
****************************************************************************
Installing Munin and munin node
sudo apt-get install munin munin-node
edit munin.conf file and replace localhost with proper name
[prod-monitor]
address ??.??.??.??
use_node_name yes
and update the Munin server
sudo su - munin --shell=/bin/bash -c /usr/share/munin/munin-update
update munin-node.conf to add munin servers ip address
allow ^127\.0\.0\.1$
allow ^??\.??\.??\.??$
and restart munin node
sudo service munin-node restart
****************************************************************************
Add munin nodes in munin.conf
Restart Munin
sudo su - munin --shell=/bin/bash -c /usr/share/munin/munin-update
***********************************************************************************
Add entries in hosts.cfg
Add entries in hostgroups.cfg
Verify the sample Nagios configuration files.
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
sudo /etc/init.d/nagios reload
***********************************************************************************
Add nrpe command in commands.cfg
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
Add NRPE services </div>