Nagios Monitoring Configuration Introduction (i)

Source: Internet
Author: User

Nagios is an open source, free network monitoring tool that effectively monitors Windows, Linux and UNIX host status, network settings such as switch routers, printers, and more.

Send mail or SMS alarm when the system or service status is abnormal the first time to notify the site operators, after the status of the resumption of normal mail or SMS notification.

As a veteran monitoring software, you should learn, this article describes the use of configuration methods.


650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M00/8B/E4/wKiom1hbkbmQyEv3AAJOnCZZW2A007.jpg-wh_500x0-wm_3 -wmp_4-s_2141536964.jpg "title=" Nagios Monitor "alt=" Wkiom1hbkbmqyev3aajonczzw2a007.jpg-wh_50 "/>

The monitoring service side and client installation are omitted.


#准备阶段

List of information

Server name Server IP
Nagios Server 10.89.1.2
Samba 10.89.1.3
Web-lnmp 10.89.1.34


#1. Nagios's monitoring mode definition and monitoring mode selection

1.1. Active mode, the server-side request from Nagios to actively detect the data can be monitored mode, that is, no need to

The client installs any plug-ins (suitable for monitoring port URL http ssh mysql rsync etc.). Of course, active mode can also be configured as passive mode detection


1.2. Semi-passive mode, we put load, memory, hard disk, virtual memory, disk IO, temperature, fan etc.

For monitoring the performance of these local resources, semi-passive mode is generally used (by calling Nrpe,snmp)


1.3. Passive mode


Active mode: Not related to Nrpe, is to use the server-side local plug-in direct access to information

Passive mode: Main program through Check_nrpe plug-in, and client Nrpe process communication, call local plug-ins to get data


#2. Configuring the service Side

[Email protected] tools]# ll/usr/local/nagios/

Total 32

Drwxrwxr-x 2 Nagios nagios 4096 Jul 23:25 bin #命令的目录

Drwxrwxr-x 3 Nagios nagios 4096 Jul 23:25 etc #配置文件的目录

Drwxr-xr-x 2 root root 4096 Jul 23:24 include

Drwxrwxr-x 2 Nagios nagios 4096 Jul 23:25 libexec #插件

Drwxr-xr-x 5 root root 4096 Jul 23:24 Perl

Drwxrwxr-x 2 Nagios nagios 4096 Jul 23:21 sbin #cgi Program

Drwxrwxr-x nagios nagios 4096 Jul 23:24 share #web程序, Nagios interface display PHP program

Drwxrwxr-x 5 Nagios nagios 4096 Jul 10:03 var #日志和数据


[Email protected] tools]# cd/usr/local/nagios/etc

[Email protected] etc]# ls-l

Total 76

-rw-rw-r--1 nagios nagios 11669 Jul 23:21 cgi.cfg

-rw-r--r--1 root root Jul 23:22 htpasswd.users #密码验证文件

-rw-rw-r--1 nagios nagios 44710 Jul 23:21 nagios.cfg #nagios主配置文件

-rw-r--r--1 nagios nagios 7207 Jul 23:25 nrpe.cfg

Drwxrwxr-x 2 Nagios nagios 4096 Jul 23:21 objects

-RW-RW----1 Nagios nagios 1340 Jul 23:21 resource.cfg


#生成hosts. cfg file

[Email protected] etc]# CD objects/

[Email protected] objects]# head-51 localhost.cfg >hosts.cfg

[Email protected] objects]# chown nagios.nagios/usr/local/nagios/etc/objects/hosts.cfg


#生成 services.cfg File

[email protected] objects]# Touch services.cfg

[Email protected] objects]# chown nagios.nagios/usr/local/nagios/etc/objects/services.cfg

[email protected] objects]# LL

Total 52

-rw-rw-r--1 nagios nagios 7716 Jul 23:21 commands.cfg #存放nagios command-related configuration for Nagios commands and Linux system command associations

-rw-rw-r--1 nagios nagios 2166 Jul 23:21 contacts.cfg #存放报警联系人的相关配置文件

-rw-r--r--1 Nagios nagios 1870 Jul hosts.cfg #新增, storing specific monitored host-related configurations

-rw-rw-r--1 nagios nagios 5403 Jul 23:21 localhost.cfg

-rw-rw-r--1 nagios nagios 3124 Jul 23:21 printer.cfg

-rw-r--r--1 nagios nagios 0 Jul 12:03 services.cfg #新增, storing specific monitored services related configurations

-rw-rw-r--1 nagios nagios 3293 Jul 23:21 switch.cfg

-rw-rw-r--1 nagios nagios 10812 Jul 23:21 templates.cfg #模板配置文件

-rw-rw-r--1 nagios nagios 3208 Jul 23:21 timeperiods.cfg #存放报警周期时间等相关配置

-rw-rw-r--1 nagios nagios 4019 Jul 23:21 windows.cfg



Backup/etc directory to prevent errors before #修改 nagios.cfg files

[Email protected] etc]# CD.

[Email protected] nagios]# tar zcvf etc.tar.gz./etc/

./etc/

./etc/nagios.cfg

./etc/cgi.cfg

./etc/nrpe.cfg

./etc/htpasswd.users

./etc/objects/

./etc/objects/printer.cfg

./etc/objects/localhost.cfg

./etc/objects/contacts.cfg

./etc/objects/windows.cfg

./etc/objects/timeperiods.cfg

./etc/objects/switch.cfg

./etc/objects/commands.cfg

./etc/objects/templates.cfg

./etc/resource.cfg

[[Email protected] nagios]# CD etc

[Email protected] etc]# VI nagios.cfg +34


#添加3行, note 1 lines

# You can specify individual object config files as shown below:

Cfg_file=/usr/local/nagios/etc/objects/commands.cfg

Cfg_file=/usr/local/nagios/etc/objects/contacts.cfg

Cfg_file=/usr/local/nagios/etc/objects/timeperiods.cfg

Cfg_file=/usr/local/nagios/etc/objects/templates.cfg

#添加这2行

Cfg_file=/usr/local/nagios/etc/objects/services.cfg

Cfg_file=/usr/local/nagios/etc/objects/hosts.cfg

#注释1行, this is a native monitor.

#cfg_file =/usr/local/nagios/etc/objects/localhost.cfg

# directive as shown below:

#添加1行 (active monitoring use)

Cfg_dir=/usr/local/nagios/etc/services #添加services (Service) directory contains


#cfg_dir =/usr/local/nagios/etc/servers #服务器

#cfg_dir =/usr/local/nagios/etc/printers #打印机

#cfg_dir =/usr/local/nagios/etc/switches #交换机

#cfg_dir =/usr/local/nagios/etc/routers #路由器

#创建services目录 and authorize

[email protected] etc] #cd/usr/local/nagios/etc

[Email protected] etc]# mkdir Services

[Email protected] etc]# chown-r Nagios.nagios services/


[email protected] etc]# LL

Total 80

-rw-rw-r--1 nagios nagios 11669 Jul 23:21 cgi.cfg

-rw-r--r--1 root root Jul 23:22 htpasswd.users

-rw-rw-r--1 nagios nagios 44852 Jul 11:55 nagios.cfg

-rw-r--r--1 nagios nagios 7207 Jul 23:25 nrpe.cfg

Drwxrwxr-x 2 Nagios nagios 4096 Jul 12:03 objects

-RW-RW----1 Nagios nagios 1340 Jul 23:21 resource.cfg

Drwxr-xr-x 2 Nagios nagios 4096 Jul 11:56 Services #新增, storing active monitoring projects


--------------------------------------------------------------------------------------


This article is from the "Knowledge Change Destiny" blog, please be sure to keep this source http://ahtornado.blog.51cto.com/4826737/1885138

Nagios Monitoring Configuration Introduction (i)

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.