How to" install, configure and secure your monitoring server the most simply possible.
- Download the nagios and plugins
- Take care of the prerequisites
- Create user and group for nagios
- Install nagios
- Configure the web interface
- Compile and install nagios plugins
- Start Nagios
- Login to web interface
Download the nagios and plugins
from the website : http://www.nagios.org/download/core/thanks/
Take care of the prerequisites
yum install gcc gd
Create user and group for nagios
useradd nagios
groupadd nagios
usermod -G nagios nagios
usermod -G nagios apache
Install nagios
tar xvf nagios-3.x.x.tar.gz
cd nagios
/configure --with-command-group=nagios
make all
make install
make install-config
make install-commandmode
Configure the web interface.
make install-webconf
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
Compile and install nagios plugins
tar xvf nagios-plugins-1.4.xx.tar.gz
cd nagios-plugins
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install
Start Nagios
chkconfig --add nagios
chkconfig nagios on
command line
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
service nagios start
Login to web interface
http://localhost/nagios/
Configuration File located at /usr/local/nagios/etc/
- nagios.cfg – This is the primary Nagios configuration file where lot of global parameters that controls the nagios can be defined.
- cgi.cfg - This files has configuration information for nagios web interface.
- resource.cfg – If you have to pass some sensitive information (username, password etc.) to a plugin to monitor a specific service, you can define them here. This file is readable only by nagios user and group.
Following are the other configuration files under /usr/local/nagios/etc/objects directory:
- contacts.cfg: All the contacts who needs to be notified should be defined here. You can specify name, email address, what type of notifications they need to receive and what is the time period this particular contact should be receiving notifications etc.
- commands.cfg – All the commands to check services are defined here. You can use $HOSTNAME$ and $HOSTADDRESS$ macro on the command execution that will substitute the corresponding hostname or host ip-address automatically.
- timeperiods.cfg – Define the timeperiods. for e.g. if you want a service to be monitored only during the business hours, define a time period called businesshours and specify the hours that you would like to monitor.
- templates.cfg – Multiple host or service definition that has similar characteristics can use a template, where all the common characteristics can be defined. Use template is a time saver.
- localhost.cfg – Defines the monitoring for the local host. This is a sample configuration file that comes with nagios installation that you can use as a baseline to define other hosts that you would like to monitor.
- printer.cfg – Sample config file for printer
- switch.cfg – Sample config file for switch
- windows.cfg – Sample config file for a windows machine
No comments:
Post a Comment