Install and configure Nagios in RHEL6

Source: Internet
Author: User
The software required in this article: Taobao split line -------------------------------------- FTP address: ftp://ftp1.linuxidc.com User name: www.6688.cc password: www.linuxidc.com in 2013 LinuxIDC.com \ October \ RHEL

Software required in this article:

------------------------------------------ Split line ------------------------------------------

FTP address: ftp://ftp1.linuxidc.com

Username: www.6688.cc

Password: www.linuxidc.com

Install and configure Nagios under LinuxIDC.com/2013/RHEL6 on April 9, October

Download Method see http://www.linuxidc.com/Linux/2013-10/91140.htm

------------------------------------------ Split line ------------------------------------------

Here are all the software resources required for configuring nagios, including fetion resources.

1. experiment environment:
Nagios HOST: ipv32.example.com 192.168.122.32 \
Mysql HOST: ipv3.example.com 192.168.122.3
2. nagios installation:
Nagios uses some commands to return the collected information after running on the monitored host.
Compile the required dependency package:
Yum install httpd gcc make gd-devel perl-ExtUtils-Embed.x86_64-y
Yum-y localinstall gd-devel-2.0.35-10.el6.x86_64
Useradd nagios # users running the nagios Service
Usermod-G nagios apache # grant the apache user the write permission on the nagios directory. Otherwise, the web page operation fails.
Tar jxf nagios-cn-3.2.3.tar.bz2
Cd nagios-cn-3.2.3
Useradd nagios
Usermod-G nagios apache
./Configure -- prefix =/usr/local/nagios -- enable-embedded-perl
Make all
Make install
Make install-init
Make install-commandmode
Make install-config
Make install-webconf

 

Bin Nagios execution program Directory, which has only one file nagios
The location of the etc Nagios configuration file. After initial installation, there are only a few *. cfg-sample files.
The directory where the sbin Nagios Cgi file is located, that is, the directory where the file needed to execute External commands is located
Share the directory of the Nagios webpage File
Directory where var Nagios log files, spids, and other files are located

 

3. Install the nagios-plugin plug-in:
Install the dependency package:

Yum-y install mysql-devel openssl-devel
[Root @ override 32 nagios-plugins-1.4.16] #./configure -- with-nagios-user = nagios -- with-nagios-group = nagios -- enable-extra-opts -- enable-perl-modules
[Root @ override 32 nagios-plugins-1.4.16] # make & make install

 

Before installing the plug-in, there is nothing in/usr/local/nagios/libexec. After the installation, the nagios Command is installed in the directory for check.

[Root @ nag32 nagios-plugins-1.4.16] # cd/usr/local/nagios/
[Root @ handle 32 nagios] # ls
Bin etc include libexec perl sbin share var
[Root @ handle 32 nagios] # ls libexec/
........... Check_apt check_file_age check_jabber check_nt check_rpc check_time check_breeze check_flexlm check_load check_ntp ..............


The main configuration file nagios. cfg needs to be modified to define and control nagios Behavior
The Cgi configuration file cgi. cfg Browser needs to be modified to restart the nagios service.
Macro definition file Resource. cfg definition plug-in path does not need to be modified
The command definition file Commands. cfg defines how to send text messages, emails, and so on.
Other files include contactgroups. cfg and contacts. cfg monitoring object configuration files, such as the host master configuration file, including and manual contact configuration files.

[Root @ override 32 etc] # vim nagios. cfg
# Comment out or delete this line
# Pai_file =/usr/local/nagios/etc/localhost. cfg
# Host configuration file path
Export _file =/usr/local/nagios/etc/objects/hosts. cfg
Export _file =/usr/local/nagios/etc/objects/service. cfg
// Separate the service from the host
# // Host group configuration file path
Export _file =/usr/local/nagios/etc/hostgroups. cfg
# Contact configuration file path
Export _file =/usr/local/nagios/etc/contacts. cfg
# Contact group configuration file path
Export _file =/usr/local/nagios/etc/contactgroups. cfg
# Service configuration file path
Export _file =/usr/local/nagios/etc/services. cfg
# Configuration file path during monitoring period
Export _file =/usr/local/nagios/etc/timeperiods. cfg
# Restart nagios and stop host/service check on the web interface. The default value is 0.
Check_external_commands = 1
# Set the command Check Interval Based on your own situation. The default value is 1 second.
Command_check_interval = 10 s

Note: the location of some of the above files is incorrect. The file location has some adjustments due to software upgrades and other reasons.
[Root @ objects 32] # cp localhost. cfg hosts. cfg # create a host definition file
[Root @ objects 32] # cp localhost. cfg service. cfg # create a service definition file
[Root @ objects 32] # vim hosts. cfg # Delete the service definition only for the host and Host group definitions
######################################## #
# HOST DEFINITION
######################################## #
# Define a host for the local machine
Define host {
Use linux-server
Host_name 255.32.example.com
Alias ngios Server
Address 127.0.0.1
Icon_image switch.gif
Statusmap_image switch. gd2
2d_coords 100,200
3d_coords 100,200,100
}
Define host {
Use linux-server
Host_name Wang zyin Jia Motor
Alias home machine
Parents versions 32.example.com
Address 127.0.0.1
Icon_image web.gif
Statusmap_image web. gd2
2d_coords 100,300
3d_coords 100,300,100
}
######################################## #############################
# HOST GROUP DEFINITION
######################################## #############################
# Define an optional hostgroup for Linux machines
Define hostgroup {
Hostgroup_name linux-servers
Alias Linux Servers
Members * # The Host "*" contained indicates that all hosts defined on it are included.
}
Define hostgroup {
Hostgroup_name home machine group
Alias PC for home use
Members Wang Z Yin Jia motor # only contains the host "Wang Z Yin Jia motor"
# Members *
# Including all hosts
}

 

The following are the differences between host groups:


The following definitions of services:
[Root @ objects 32] # vim/usr/local/nagios/etc/objects/service. cfg
######################################## #
# SERVICE DEFINITIONS
######################################## #
Define service {
Use local-service
Host_name *
# Indicates that this service will monitor all hosts
Service_description PING
}
Define service {
Use local-service
Host_name *
Service_description root Partition
}
Define service {
Use local-service
Host_name 255.32.example.com
# This service only monitors ipv32
Service_description Number of logon users
}
Define service {
Use local-service
Host_name 255.32.example.com
Service_description process count
}
Define service {
Use local-service
Host_name 255.32.example.com
Service_description system load
}
Define service {
Use local-service
Host_name 255.32.example.com
Service_description swap space utilization
}
Define service {
Use local-service
Host_name 255.32.example.com
Service_description SSH
}
Define service {
Use local-service
Host_name 255.32.example.com
Service_description HTTP
}
######################################## #
# DEFINE SERVICEGROUP
######################################## #
Define servicegroup {
Servicegroup_name system check
Alias system status
Embers logs, PING, ipv32.example.com, root partition, ipv32.example.com, number of logon users, ipv32.example.com, system load, ipv32.example.com
}


Ot @ register 32 objects] #/usr/local/nagios/bin/nagios-v/usr/local/nagios/etc/nagios. cfg
Total Warnings: 0
Total Errors: 0
# Ensure that the syntax of the configuration file is correct
[Root @ override 32 etc] #/etc/init. d/nagios start

For more details, refer to the highlights on the next page.: Http://www.linuxidc.com/Linux/2013-10/91139p2.htm

Recommended reading:

Cacti building document http://www.linuxidc.com/Linux/2013-06/86595.htm under CentOS 6

Http://www.linuxidc.com/Linux/2013-06/85427.htm of Cacti monitoring deployment under RHEL5.9

CentOS 6.3 Cacti Installation Details http://www.linuxidc.com/Linux/2013-05/84279.htm

Quick installation and configuration of Cacti Chinese http://www.linuxidc.com/Linux/2013-03/81627.htm in CentOS Linux

Nagios details: Click here
Nagios: Click here

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.