Nagios Remote Plugin Executor (NRPE) is a Nagios agent that allows remote systems monitoring using scripts that are hosted on the remote systems. It allows for monitoring resources such as disk usage, system load or number of users currently logged in. Nagios periodically polls the agent on the remote system using the check_nrpe
plugin.
Nagios Remote Data Processor (NDRP) is a Nagios agent with a flexible data transport mechanism and processor. It is designed with an architecture that allows it to be easily extended and customized. NRDP uses standard ports and protocols (HTTP(S) and XML) and can be implemented as a replacement for NSCA.
This program is mainly used to monitor Windows machines. Being installed on a remote system NSClient++ listens to port TCP 1248. Nagios plugin that is used to collect information from this addon is called check_nt
. As NRPE, NSClient++ allows to monitor the so called "private services" (memory usage, CPU load, disk usage, running processes, etc.)
Now We Will Disable AppArmor
/etc/init.d/apparmor stop
update-rc.d -f apparmor remove
aptitude remove apparmor apparmor-utils
Create Folder For Nagios And Nagios Plugins
mkdir /downloads
Now Let's Install The Required Programs For Nagios
Make sure you select Smarthost option when installing Postfix:
aptitude -y install apache2 libapache2-mod-php5 build-essential libgd2-xpm-dev postfix
Now let's update everything on this system:
aptitude update
aptitude safe-upgrade
Nagios User Setup
useradd -m -s /bin/bash nagios
passwd nagios
usermod -G nagios nagios
groupadd nagcmd
usermod -a -G nagcmd nagios
Download And Unzip Nagios And Nagios Plugins
cd /downloads
wget http://prdownloads.sourceforge.net/nagios/nagios-3.2.3.tar.gz
wget http://prdownloads.sourceforge.net/nagiosplug/nagios-plugins-1.4.15.tar.gz
tar -zxf /downloads/nagios-3.2.3.tar.gz
tar -zxf /downloads/nagios-plugins-1.4.15.tar.gz
Install Nagios
cd /downloads/nagios-3.2.3
./configure --with-command-group=nagcmd
make all
make install
make install-init
make install-config
make install-commandmode
make install-webconf
Nagios Password
This is the password you will need to look at the nagios pages. If you install Nagios to a different directory please change this command to where the Nagios etc. folder will be.
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
Enter your password when prompted.
Now we will restart Apache to make sure all of the changes take effect:
/etc/init.d/apache2 restart
Install Nagios Plugins
cd /downloads/nagios-plugins-1.4.15/
make
make install
Now we need to make Nagios start at bootup:
ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios
Change Default Email Address For Nagios Admin
Open your favorite editor and open /usr/local/nagios/etc/objects/contacts.cfg and change this:
nagios@localhost
To this:
You@yourdomain.com
Once you have saved your changes to the contacts.cfg we need to verify that there are no errors in the configuration of Nagios.
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Here is what you should see. It is okay to have a couple of warnings, but you can't have any errors.
Now we are going to start nagios:
/etc/init.d/nagios start
Postfix Configuration For A Smarthost Relay
postconf -e 'relayhost=yourmailserver.com'
postconf -e 'smtp_sasl_auth_enabled = yes'
postconf -e 'smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd'
postconf -e 'smtp_sasl_security_options ='
echo "yourmailserver.com emailusername:emailpassword" > /etc/postfix/sasl_passwd
Now we will need to change the password file attributes so only root has access to read it.
chown root:root /etc/postfix/sasl_passwd
chmod 600 /etc/postfix/sasl_passwd
postmap /etc/postfix/sasl_passwd
Now we are going to set the map that will change your outbound messages from nagios to your email server username/email address.
echo "nagios mailusername@yourmailserver.com" /etc/postfix/canonical
echo "canonical_maps = hash:/etc/postfix/canonical" >> /etc/postfix/main.cf
postmap /etc/postfix/canonical
Now we are going to restart Postfix:
/etc/init.d/postfix restart
Now that this all has been completed you can restart your system.
Once your system has come back up you will be able to login to the website and look at your first Nagios installation.
http://yourserver/nagios/
Now login with the nagiosadmin username and password we created earlier:
Now here is what you will see once you are logged in.
Installation Script For Nagios
Here is the installation script I have created to handle most of the work for installing Nagios. Please note the top of the script, you will need to define some of the variables for the installation to work correctly.
#!/bin/bash
#
# AUTHOR : rbishop
# DATE : 01.27.2011
#
# PROG.-NAME : nagios-setup.sh
#
# FUNCTION : Installing Nagios on your System
#
#
#######################################################################
#######################################################################
## ##
## Configurable Settings for this Script