Installation and deployment of Nagios monitoring software

Source: Internet
Author: User

1. The platform and the components used,
Monitoring server: RHEL4 (192.168.1.211) +nagios-3.2.0+ nagios-plugins-1.4.14+ nrpe-2.12
Monitored end RHEL4 (192.168.1.212) + nagios-plugins-1.4.14+ nrpe_2.12
Content Introduction
This document describes Nagios monitoring Linux server, because the monitoring is to rely on plug-ins to complete, and monitoring Linux mainly use Nrpe plug-in, this article first briefly introduce the Nrpe Monitoring Foundation, and monitoring process, and then step by step to configure an instance to implement monitoring Linux server
1.NRPE monitoring plug-in basics
The Nrpe consists of a total of two parts:
Check_nrpe plug-in, running on the monitoring host.
NRPE Daemon, running on a remote Linux host (usually a monitored machine)
The entire monitoring process: (e.g.)
When Nagios needs to monitor the service or resource conditions of a remote Linux host:
1). Nagios runs the Check_nrpe plugin, and we want to tell it what to check in the Nagios configuration file.
2). The Check_nrpe plugin connects to the remote Nrpe daemon via SSL.
3). NRPE Daemon will run the appropriate Nagios plug-in to perform checks on local resources or services.
4). NRPE Daemon Returns the results of the check to the Check_nrpe plugin, which the plugin submits to nagios for processing.
Note: NRPE daemon requires Nagios plug-ins to be installed on remotely monitored Linux hosts, otherwise, daemon cannot do any monitoring. No, because the communication between them is encrypted SSL, you have to add the option when compiling the installation./configure--enable-ssl--with-ssl-lib=/lib/, otherwise there will be an error.

I. Configuring the monitoring side
1.1 Installing Nagios
Useradd-r nagios-s/sbin/nologin

./configure--prefix=/usr/local/nagios-1.6.3
Make all
Make install
Make Install-init
Make Install-config
Make Install-commandmode
(Make install-webconf #可以自动配置httpd. conf)
CP sample-config/httpd.conf/usr/local/apache/conf/extra/nagios.conf
/usr/local/apache/bin/htpasswd-c/usr/local/nagios/etc/htpasswd.users Nagiosadmin
(Nagiosadmin to be the same as contact_name in/usr/local/nagios/etc/objects/contacts.cfg)
Chkconfig--add Nagios
Chkconfig--levels 345 Nagios on
Chown-r Nagios.nagios nagios-1.6.3
Ln-s nagios-1.6.3 Nagios


1.2 Installing Nagios-plugins
CD nagios-plugins-1.4.12
./configure--prefix=/usr/local/nagios-1.6.3--with-nagios-user=nagios--with-nagios-group=nagios-- Enable-redhat-pthread-workaround
Make
Make install
1.3 Installing Nrpe
CD nagios-nrpe_2.12
./configure #默认自动添加了openssl
./configure--prefix=/usr/local/nagios-1.6.3--enable-ssl--with-ssl-lib=/lib/
Make all
Make Install-plugin
Make Install-daemon
Make Install-daemon-config
1.4 Commands.cfg Defining external components Nrpe
Vi/usr/local/nagios/etc/objects/commands.cfg
#添加
#check Nrpe
Define Command{
Command_name Check_nrpe
Command_line $USER 1$/check_nrpe-h $HOSTADDRESS $-C $ARG 1$
}

1.5. Configure the Linux hosts to monitor
Vi/usr/local/nagios/etc/nagios.cfg
#中间添加
Cfg_file=/usr/local/nagios/etc/objects/mylinux.cfg

Vi/usr/local/nagios/etc/objects/mylinux.cfg
Define Host{
Use Linux-server
HOST_NAME Mylinux
Alias Mylinux
# Client IP
Address 192.168.1.212
}
Define Service{
Use Generic-service
HOST_NAME Mylinux
Service_description Check-swap
Check_command Check_nrpe!check_swap
}
Define Service{
Use Generic-service
HOST_NAME Mylinux
Service_description Check-load
Check_command Check_nrpe!check_load
}
Define Service{
Use Generic-service
HOST_NAME Mylinux
Service_description Check-disk
Check_command CHECK_NRPE!CHECK_HDA1}
Define Service{
Use Generic-service
HOST_NAME Mylinux
Service_description check-users
Check_command check_nrpe!check_users
}
Define Service{
Use Generic-service
HOST_NAME Mylinux
Service_description Otal_procs
Check_command Check_nrpe!check_total_procs
}
1.6. Other Settings
Chkconfig--add Nagios #配置机器启动时自动启动Nagios
Chkconfig Nagios on
/usr/local/nagios/bin/nagios-v/usr/local/nagios/etc/nagios.cfg #检查Nagios配置文件
Vi/etc/selinux/config #关闭SELinux
Selinux=disabled
Service iptables stop #关闭SELinux, or open 80,5666 port
Service Nagios Start
Two. Configure the monitored side
2.1. Installing Nagios-plugin
Useradd Nagios-r-s/sbin/nologin
TAR-ZXVF nagios-plugins-2.0.3.tar.gz
CD nagios-plugins-2.0.3
./configure--prefix=/usr/local/nagios-plugins-2.0.3--with-nagios-user=nagios--with-nagios-group=nagios-- Enable-redhat-pthread-workaround
Make
Make install
Ln-s nagios-plugins-2.0.3 Nagios-plugins

2.2 Changing Master directory permissions
Chown-r Nagios:nagios/usr/local/nagios-plugins
[email protected] nagios]# LL
Drwxr-xr-x 2 Nagios nagios 4096 June 1 00:07 libexec
Drwxr-xr-x 3 Nagios nagios 4096 June 1 00:07 Share
2.3 Installing the Nrpe of the client
TAR-ZXVF nrpe_2.12.tar.gz
CD nrpe_2.12
./configure--prefix=/usr/local/nagios-plugins-2.0.3--enable-ssl--with-ssl-lib
Make all
Make Install-plugin
Make Install-daemon
Make Install-daemon-config
4. Configuring Nrpe Information
Vi/usr/local/nagios-plugins/etc/nrpe.cfg
allowed_hosts=127.0.0.1,192.168.1.211
5. Start Nrpe
/usr/local/nagios-plugins/bin/nrpe-c/usr/local/nagios-plugins/etc/nrpe.cfg-d
#或
Vi/etc/rc.d/rc.local
/usr/local/nagios-plugins/bin/nrpe-c/usr/local/nagios-plugins/etc/nrpe.cfg-d
6. Verify Nrpe
Netstat-an | grep 5666
TCP 0 0 0.0.0.0:5666 0.0.0.0:* LISTEN
/usr/local/nagios-plugins/libexec/check_nrpe-h 127.0.0.1
NRPE v2.8.12
#服务端测试
/usr/local/nagios-plugins/libexec/check_nrpe-h l92.168.1.212-p 5666-c Check_load
NRPE v2.8.12
7. Configuring the Monitor alignment (critical)
Monitored by the principle of monitoring and then passed to the monitoring server to paint the total, set the monitoring parameters are mainly set to monitor the end of the Nrpe.cfg file
You can see the inside of the monitoring object
Vi/usr/local/nagios-plugins/etc/nrpe.cfg
Command[check_users]=/usr/local/nagios-plugins/libexec/check_users-w 5-c 10
Command[check_load]=/usr/local/nagios-plugins/libexec/check_load-w 15,10,5-c 30,25,20
Command[check_hda1]=/usr/local/nagios/libexec-plugins/check_disk-w 20-c 10-p/dev/hda1
Command[check_zombie_procs]=/usr/local/nagios-plugins/libexec/check_procs-w 5-c 10-s Z
Command[check_total_procs]=/usr/local/nagios-plugins/libexec/check_procs-w 150-C 200
Command[check_swap]=/usr/local/nagios-plugins/libexec/check_swap-w 20%-C 10%

8. Common Startup commands:
Monitoring End Process Start mode:
/usr/local/nagios/bin/nrpe-c/usr/local/nagios/etc/nrpe.cfg-d
/usr/local/nagios/bin/nagios-d/usr/local/nagios/etc/nagios.cfg
Service Ngios Start
Monitored end process startup mode:
/usr/local/nagios/bin/nrpe-c/usr/local/nagios/etc/nrpe.cfg-d

Installation and deployment of Nagios monitoring software

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.