Open main menu

CDOT Wiki β

Changes

How to Setup and configure Nagios

4,000 bytes added, 07:59, 24 November 2010
no edit summary
<code>service nagios restart</code>
 
 
 
 
 
== 4.0 Client Installation ==
 
 
'''4.1 Create Account Information on Client Machine'''
 
SSH to Iraq machine (142.204.133.98) and issue the following commands:
 
1. Become the root user.
 
<code>su - </code>
 
2. Create a new nagios user account and give it a password.
 
<code>useradd -m nagios</code>
 
<code>passwd senecaCdot </code>
 
3. Create a folder for Nagios plugins.
 
<code>mkdir ~/downloads</code>
 
<code>cd ~/downloads</code>
 
<pre>Note: For the next step make sure you are connected to the Internet to download nagios plugins.</pre>
 
3. Download the source code tarball of the NRPE addon (visit http://www.nagios.org/download/ for links to the latest versions).
 
<code>wget http://osdn.dl.sourceforge.net/sourceforge/nagios/nrpe-2.8.tar.gz</code>
 
4. Extract the NRPE source code tarball.
 
<code>tar xzf nrpe-2.8.tar.gz </code>
 
<code>cd nrpe-2.8</code>
 
5. Compile the NRPE add-on.
 
<code>./configure </code>
 
<code>make all</code>
 
6. Install the NRPE plug-in.
 
<code>make install-plugin</code>
 
'''4.2 Compile and Configure Nagios Plugins'''
 
<pre>
Note: You need openssl-devel package installed to compile plugins with ssl support.
 
You have to be root to issue make install commands.
</pre>
 
1. Become root user.
 
<code>su -</code>
 
2. Install openssl-devel package.
 
<code>yum -y install openssl-devel</code>
 
2. Instal Plugins:
 
<code>./configure --with-nagios-user=nagios --with-nagios-group=nagios</code>
 
<code>make</code>
 
<code>make install</code>
 
3. The permissions on the plugin directory and the plugins will need to be changed to nagios user.
 
<code>chown nagios.nagios /usr/local/nagios</code>
 
<code>chown -R nagios.nagios /usr/local/nagios/libexec</code>
 
4. Package xinted is needed.
 
<code>yum install xinetd</code>
 
5. Start xinetd service.
 
<code>service xinetd start</code>
'''4.3 Downlad and Install NRPE Daemon'''
 
1. Create a forlder ~/Nagios/Nagios_NRPE.
 
<code>mkdir -p ~/Nagios/Nagios_NRPE</code>
 
<code>cd ~/Nagios/Nagios_NRPE</code>
 
Save file to directory ~/Nagios
 
http://www.nagios.org/download/download.php
 
2. Extract the files:
 
<code>tar -xzf nrpe-2.12.tar.gz</code>
 
<code>cd nrpe-2.12</code>
 
'''4.4 Compile and Configure NRPE'''
 
1. Install NRPE:
 
<pre>Note: you have to be root to issue make install command.</pre>
 
<code>./configure</code>
 
<pre>
General Options:
-------------------------
NRPE port: 5666
NRPE user: nagios
NRPE group: nagios
Nagios user: nagios
Nagios group: nagios
</pre>
 
<code>make all </code>
 
<code>make install-plugin </code>
 
<code>make install-daemon </code>
 
<code>make install-daemon-config </code>
 
<code>make install-xinetd</code>
 
'''4.5 Post NRPE Configuration'''
 
1. Edit Xinetd NRPE entry:
 
Add Nagios Monitoring server to the “only_from” directive.
 
<code>vi /etc/xinetd.d/nrpe only_from = 127.0.0.1 <142.204.133.90 > </code>
 
2. Edit services file entry and add entry for nrpe daemon.
 
<code>vi /etc/services</code>
 
<pre>nrpe 5666/tcp # NRPE</pre>
 
3. Restart Xinetd and set to start at boot:
 
<code>chkconfig xinetd on </code>
<code>service xinetd restart</code>
 
'''4.6 Test NRPE Daemon Install'''
 
1. Check NRPE daemon is running and listening on port 5666:
 
<code>netstat -at |grep nrpe</code>
 
2. Output should be:
 
<pre>tcp 0 0 *:nrpe *.* LISTEN</pre>
 
3. Check NRPE daemon is functioning:
 
<code>/usr/local/nagios/libexec/check_nrpe -H localhost</code>
 
4. Output should be NRPE version:
 
<pre>NRPE v2.12</pre>
 
'''4.7 Open Port 5666 on Firewall'''
 
<pre>Note: Make sure to open port 5666 on the firewall of the remote server so that the Nagios monitoring server can access the NRPE daemon.
</pre>
 
1. Create a rule for iptables.
 
<code>iptables -I INPUT -p tcp -m tcp ---dport 5666 -j ACCEPT</code>
 
2. Save the new iptables rule so it will survive machine reboots.
 
<code>service iptables save</code>
 
'''4.8 Congratulations'''
 
Congratulations! You have successfully completed the configuration of the Nagios Server/Client setup.
1
edit