Changes

Jump to: navigation, search

How to Setup and configure Nagios

259 bytes added, 21:36, 8 December 2010
no edit summary
== 2.0 Server Installation (using tarball) ==
 
This guide will provide you with instructions on how to install Nagios from source (code) on Fedora 13 and have it monitoring your local and client machines.
* Monitor Nagios clients
 
'''2.2 Prerequisites'''
<code>wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.15.tar.gz </code>
 
'''2.5 Compile and Install Nagios'''
<pre>Note: DO NOT start Nagios yet</pre>
 
'''2.6 Customize Configuration'''
define contact{
contact_name nagiosadmin ; Short name of user
use generic-contact ; Inherit default values from generic-contact template(defined above)
alias Nagios Admin ; Full name of user
email email@learn.senecac.on.ca ; ß *****CHANGE THIS TO YOUR EMAIL ADDRESS ******
}
</pre>
 
'''2.7 Configure the Web Interface'''
3. Restart Apache to make the new settings take effect.
 
<code>service httpd restart</code>
 
'''2.8 Compile and Install the Nagios Plugins'''
<code>make install</code>
 
'''2.9 Start Nagios'''
3. If there are no errors, start Nagios. If you got errors, please check nagios.cfg file in step 2, and try it again.
 
<code>service nagios start </code>
 
'''2.10 Modify SELinux Settings'''
<code>chcon -R -t httpd_sys_content_t /usr/local/nagios/share/ </code>
 
'''2.11 Login to the Web Interface'''
Click on the "Service Detail" navigational bar link to see details of what's being monitored on your local machine. It will take a few minutes for Nagios to check all the services associated with your machine, as the checks are spread out over time.
 
'''2.12 Open Port 5666 on Firewall'''
<code>service iptables save</code>
 
'''2.13 You're Done'''
1. Create a Nagios_NRPE folder.
 
<code>mkdir -p ~/Nagios/Nagios_NRPE</code>
2. Add the following at the end of the file:
<pre>define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
<code>vi /usr/local/nagios/etc/objects/linux-box-remote.cfg</code>
 
<pre>Note: Information below is just an example of the template file.</pre>
notification_options d,r
contact_groups admins
register 0 ; DONT DO NOT REGISTER THIS - ITS A TEMPLATE
}
<code>yum -y install nrpe </code>
'''4.2 Create Account Information'''
<code>usermod -a -G nagcmd apache </code>
 
'''4.3 Configure the Web Interface'''
#Definitions for monitoring the local (Linux) host
cfg_file=/etc/nagios/objects/localhost.cfg
#Definitions for monitoring a Remote (Linux) machine
cfg_file=/etc/nagios/objects/linux-remote.cfg
#Definitions for monitoring second Remote (Linux) machine
cfg_file=/etc/nagios/objects/linux-romania.cfg
</pre>
<code>define command{</code>
<code> command_name check_nrpe</code>
<code> command_line /usr/lib64/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c $ARG1$</code>
<code>}</code>
define host{
use linux-server ; Name of host template$
; This host definition $
; in (or inherited by) $
host_name localhost
alias chile #Example machine in this scenario
check_interval 5
retry_interval 1
max_check_attempts 10
check_command check-host-alive
notification_period 24x7
notification_interval 24x7
notification_options d,r
contact_groups admins
address 127.0.0.1
}
define contact{
contact_name nagiosadmin ; Short name of user
use generic-contact ; Inherit default values from generic-contact template(defined above)
alias Nagios Admin ; Full name of user
email email@learn.senecac.on.ca ; ß CHANGE THIS TO YOUR EMAIL ADDRESS ******
}
== 7.0 Client Installation ==
 
'''7.1 Create Account Information on Client Machine'''
<code>yum -y install openssl-devel</code>
3. Instal Plugins:
1
edit

Navigation menu