Install and configure nagios in CentOS (3)

Source: Internet
Author: User

This article explains how to create monitoring files for each host first, and then describes various plug-ins in detail. The reason why nagios monitoring is so powerful is that it relies on various plug-ins, it can be said that these plug-ins have achieved nagios's rich monitoring project. Generally, when nagios is installed, you usually install nagios-plugins to install some very common plug-ins to monitor each server. However, these plug-ins are not enough, so sometimes you need to find other specific plug-ins from the Internet, or even write your own plug-ins.



1. Create a host monitoring File


To monitor a specific host, you need to create a monitoring file for the host. We recommend that you create it in the nagios/etc/objects directory.

For example, monitoring a linux host whose IP address is 192.168.10.46


You can create a 46. cfg file in the objects Directory, which contains the following content:



Define host {

Host_name 46_linux host name displayed on the web page

Use linux-server Template

Address 10.0.110.46 host address

Max_check_attempts 3 Number of retries after the check fails

Icationication_period 24x7 Monitoring Period

}


Define service {

Host_name 46_linux reference the template above

Name 46-service the name of this service Template

Service template used by use generic-service

Normal_check_interval 5 Number of retries after failure

Icationication_interval 60 Retry Interval

}


The above basically contains the main parameters of the monitored machine. Next, you need to reference the nagios plug-in operation to achieve the purpose of monitoring.

When talking about nagios's principles, I particularly pointed out that nagios does not have monitoring functions. All monitoring tasks are completed by the plug-in. The plug-in returns the monitoring results to nagios and nagios to analyze these results, these plug-ins are executable programs that implement specific functions and provide corresponding alarm functions (this alarm function is also completed by the plug-in, the default installation path is/usr/local/nagios/libexec. You can view

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/04550951V-0.png "title =" 1.png" alt = "154125215.png"/>

These programs can be executed independently"Command name-HTo view


Add these plug-in commands in certain formats in file 46. cfg for monitoring.


For example

Define service {

Use 46-service

Service_description ping

Check_command check_ping! 3000.0, 80%! 5000.0, 100%! 10! 30

}

Define service {

Use 46-service

Service_description ftp

Check_command check_ftp! 2! 4! 10

}

The above two services are basically used to monitor the external services opened on the remote system. These services can be completed using the plug-ins on the monitoring machine.


For disk capacity, cpu load, login users, etc., nrpe is required to collect data through the plug-in and then return it back to the monitoring end. The command format is slightly different from the preceding one.

First, add related commands on 46. cfg.

Define service {

Use 46-service

Service_description users

Check_command check_nrpe! Check_users

}

Define service {

Use 46-service

Service_description load

Check_command check_nrpe! Check_load

}


Define service {

Use 46-service

Service_description zombie_procs

Check_command check_nrpe! Check_zombie_procs

}

Define service {

Use 46-service

Service_description/

Check_command check_nrpe! Check_sda1


The preceding four groups of commands use NRPE to monitor the number of logged-in users and load the remaining space of the zombie process disk. We can see that all these commands use the chenk_nrpe plug-in command to collect data.

The subsequent part is the corresponding command name entered on the monitored Machine


In nrpe. cfg on Monitored host 46

Command [check_users] =/usr/local/nagios/libexec/check_users-w 5-c 10

Command [check_load] =/usr/local/nagios/libexec/check_load-w 15,10, 5-c 30,25, 20

Command [check_sda1] =/usr/local/nagios/libexec/check_disk-w 20%-c 10%-p/dev/sda1

Command [check_zombie_procs] =/usr/local/nagios/libexec/check_procs-w 5-c 10-s Z


Add the above four lines to monitor the instance.


Add the following line to the nagios. cfg file on the monitoring end:

Export _file =/usr/local/nagios/etc/objects/46.cfg


Then restart both the monitoring and nagios instances.

In this way, both the internal and external information of the monitored machine can be monitored, and the detailed information of your monitoring can be viewed on the web page.

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/0455095021-1.png "title =" 2.png" alt = "162340170.png"/>


This article from the "New Year to wake up" blog, please be sure to keep this source http://5468755.blog.51cto.com/5458755/1302215

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.