Open main menu

CDOT Wiki β

Changes

How to Setup and configure Nagios

26 bytes added, 08:54, 8 December 2010
no edit summary
== 4.0 Server Installation (using yum utility)==
 
'''4.1 Required packages'''
Make sure you've installed the following packages on your Fedora 13 installation before continuing.
 
'''4.3 Configure the Web Interface'''
<code>htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin </code>
 
Type the password: (your password is here)
<code>cfg_file=/etc/nagios/objects/linux-romania.cfg</code>
 
</pre>
2. Open nrpe.cfg and edit it with your favourite editor.
<code>vi /etc/nagios/nrpe.cfg</code>
 
<pre>
Note: In the nrpe.cfg the following lines can be modified to meet the current system needs
</pre>
 
<code>command[check_users]=/usr/lib64/nagios/plugins/check_users -w 5 -c 10</code>
and add the following definition to the file:
 
<code>define command{</code>
</pre>
 
'''4.7 Contacts Configuration File'''
}
 
</pre>
<code>ScriptAlias /nagios/cgi-bin/ "/usr/local/sbin/"</code>
<code><Directory "/usr/local/sbin"></code>
<code># SSLRequireSSL</code>
<code>Alias /nagios "/usr/share/nagios/html"</code>
<code><Directory "/usr/share/nagios/html"></code>
<code># SSLRequireSSL</code>
<code>vi /etc/nagios/nrpe.cfg</code>
<code>allowed_hosts=<IP Address to that of the monitoring hosts></code>
comment out the line:
<code>#allowed_hosts=127.0.0.1</code>
2. Change ownership on the plugins directory to reflect ownership to nagios.
<code>chown nagios.nagios /usr/lib64/nagios/plugins</code>
 
== 5.0 Setting up the Remote Host (using yum utility) ==
1. To install the nrpe daemon and nagios plugins run the following commands.
<code>yum –y -y install nrpe</code>
<code>yum -y install Nagios-plugins-all</code>
Add an allowed_hosts IP Address to nrpe.cfg file eg. 142.204.133.123 (chile’s IP Address):
<code>Allowed_hosts=142.204.133.123<code>
3. Test the nrpe daemon locally using the command:
<code>netstat -at | grep nrpe</code>
<pre>Note: The output of the command should look something like this:
4. Add a firewall rule to the INPUT chain
<code>iptables -I INPUT -p tcp -m tcp --dport 5666 –j -j ACCEPT</code>
5. Save the firewall settings so it survives reboot
<code>service iptables save</code>
<pre>Note: Files locations after install:
<code>/etc/nagios/</code> -> contains the nrpe.cfg
<code>/etc/nrpe.d</code> -> contains the daemon
<code>/usr/share/docs/nrpe-2.12</code> -> contains the related README, Changelog files and .pdf etc
 
</pre>
6. Check to make sure the NRPE daemon is functioning properly. To accomplish this, run the check_nrpe plugin that was installed for testing purposes. The directory make be different depending OS.
<code>/usr/local/nagios/libexec/check_nrpe -H localhost <ip of the Remote host></code>
Or
<code>/usr/lib64/naigos/plugins/check_nrpe -H localhost <ip of the Remote host></code>
7. Some of these commands can be executed on the Remote host for testing daemon functionality
== 46.0 IRC Notification Bot Configuration (Server configuration) ==
<pre>Note: please keep in mind this was done on Fedora 13 with Nagios 3.2.3 and NagIRCBot 0.0.30.</pre>
[[File:IrcBot.png|400px|thumb|centre|Nagios IRC Bot]]
== 57.0 Client Installation ==
'''57.1 Create Account Information on Client Machine'''
SSH to Iraq machine (142.204.133.98) and issue the following commands:
<code>make install-plugin</code>
'''57.2 Compile and Configure Nagios Plugins'''
<pre>
<code>service xinetd start</code>
'''57.3 Downlad and Install NRPE Daemon'''
1. Create a forlder ~/Nagios/Nagios_NRPE.
<code>cd nrpe-2.12</code>
'''57.4 Compile and Configure NRPE'''
1. Install NRPE:
<code>make install-xinetd</code>
'''57.5 Post NRPE Configuration'''
1. Edit Xinetd NRPE entry:
<code>service xinetd restart</code>
'''57.6 Test NRPE Daemon Install'''
1. Check NRPE daemon is running and listening on port 5666:
<pre>NRPE v2.12</pre>
'''57.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.
<code>service iptables save</code>
'''57.8 Congratulations'''
Congratulations! You have successfully completed the configuration of the Nagios Server/Client setup.
== 68.0 Demonstration ==
1
edit