Nagios monitors Linux hosts

Source: Internet
Author: User
See this document http: blogcsdnnetxtdhqdhqarticledetails19197635 (Nagios monitoring server)

Refer to this document http://blog.csdn.net/xtdhqdhq/article/details/19197635 (Nagios monitoring server and client installation)

Assume that the supervisor: 192.168.0.10 server1

Monitored machine: 192.168.0.11 server2

Here are some notes:

On server2:

1. modify nrpe. cfg

The nagios monitoring host obtains information by calling the nrpe of the monitored host, so we first add the information to be searched on the nrpe configuration of the monitored host, that is, some commands, nagios then calls these commands through nrpe to obtain information. These commands are defined in the nrpe. cfg file:

Command [check_mysql_status] =/usr/local/nagios/libexec/check_mysql-H localhost-u nagios-p nagios-P 3306

2. start the nrpe service

 

/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
3. test whether the following command can be executed
/usr/local/nagios/libexec/check_mysql -H localhost -u nagios -p nagios -P 3306
On server1:
1. configure the configuration file of the nagios monitoring host
 /usr/local/nagios/etc/nagios.cfg
Export _file =/usr/local/nagios/etc/objects/commands. cfg # monitoring command callable by nagios: pai_file =/usr/local/nagios/etc/objects/contacts. cfg # configure the contact pai_file =/usr/local/nagios/etc/objects/timeperiods. cfg # monitoring time configuration: pai_file =/usr/local/nagios/etc/objects/templates. cfg # template configuration pai_dir =/usr/local/nagios/etc/servers # Add a directory and put the host file to be added, you do not need to add pai_file =/usr/local/nagios/etc/objects/hostgroups in one line here. cfg # newly added, host group configuration: pai_file =/usr/local/nagios/etc/objects/localhost. cfg # Local information monitoring
2. use nrpe to monitor the local information of the server 2 Host

Use nrpe to monitor the local information of server 2 Host

The first is to solve how nagios calls the nrpe command. previously we have said that the nagios call command is from the command. the content defined in the cfg file must be defined in the file to use nrpe.

Nano command. cfg

Add the following configurations to the file:

# 'Check _ nrpe 'command definition define command {command_name check_nrpe command_line $ USER1 $/check_nrpe-H $ HOSTADDRESS $-c $ ARG1 $}

3. add the monitored machine
Create the cfg file of server2 in the/usr/local/nagios/etc/servers directory and modify its
cp /usr/local/nagios/etc/objects/localhost.cfg  /usr/local/nagios/etc/servers/192.168.0.11.cfg
nano 192.168.0.11.cfg
 
# HOST DEFINITION# Define a host for the local machinedefine host{        use                     linux-server            ; Name of host template to use; This host definition will inherit all variables that are defined; in (or inherited by) the linux-server host template definition.        host_name               192.168.0.11        alias                   linux-server 11        address                 192.168.0.11        }define service{        use                             local-service         ; Name of service template to use        host_name                       192.168.0.11        service_description             MySQL        check_command                   check_nrpe!check_mysql_status #       notifications_enabled           0        }

 

4. create hostgroups. cfg

Comment out the hostgroup in localhost and agree to define it in this file

Nano hostgroups. cfg

######################################## #######################################
######################################## #######################################
# HOST GROUP DEFINITION
######################################## #######################################
######################################## #######################################
# Define an optional hostgroup for Linux machines
Define hostgroup {
Hostgroup_name linux-servers; The name of the hostgroup
Alias Linux Servers; Long name of the group
Members localhost; Comma separated list of hosts that belong to this group
}
Define hostgroup {
Hostgroup_name linux-servers-jk; The name of the hostgroup
Alias Linux Servers Jk; Long name of the group
Members 192.168.0.11; Comma separated list of hosts that belong to this group
}
5. restart nagios

Service nagios reload

Reference: http://lihuipeng.blog.51cto.com/3064864/570698

Related Article

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.