CentOS7 Installing Nagios

Source: Internet
Author: User
Tags snmp install perl

I. About Nagios

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.

The features that Nagios can monitor are:

1, monitoring network services (SMTP, POP3, HTTP, NNTP, ping, etc.);

2, monitor the host resources (processor load, disk utilization, etc.);

3, simple plug-in design allows users to easily expand their services to detect methods;

4, parallel service inspection mechanism;

5, with the ability to define the network hierarchy, with "parent" host definition to express the relationship between the network host,

This relationship can be used to discover and clarify the host outage or unreachable state;

6, when the service or host problems arise and resolve the alarm sent to the contact person (via email, SMS, user-defined mode);

7, has the definition event handle function, it can obtain more problem localization when the host or the service event occurs;

8, automatic log rollback;

9, can support and implement redundant monitoring of the host;

10. The optional web interface is used to view current network status, notification and fault history, log files, and so on.


Ii. Installing the Nagios Foundation Support kit and adding users

1). Mounting kit

# yum Install httpd gcc glibc glibc-common gd gd-devel xinetd openssl-devel


2). Create Nagios users and user groups (this step is done first, or you will get an error when compiling Nagios)

# useradd-s/sbin/nologin Nagios
# Mkdir/usr/local/nagios
# Chown-r Nagios.nagios/usr/local/nagios


3). Install httpd and PHP

Yum Install httpd* # #安装Web服务器Apache相关服务, Nagios provides a web monitoring interface that allows you to see the monitored host running state through the Web interface


Yum Install php* # #安装PHP相关服务


Third, download and compile and install Nagios

1). Download and unzip Nagios

# wget http://nchc.dl.sourceforge.net/project/nagios/nagios-4.x/nagios-4.1.0/nagios-4.1.0rc1.tar.gz

# TAR-ZVXF Nagios-4.1.0rc1.tar.gz

# CD NAGIOS-4.1.0RC1


2). Compile and install Nagios

#./configure--prefix=/usr/local/nagios

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/70/D8/wKiom1W_JwfgH8lZAAJXKvXLVpY184.jpg "title=" QQ picture 20150803163135.png "alt=" Wkiom1w_jwfgh8lzaajxkvxlvpy184.jpg "/>

# make all # #中间如有选择, direct a

# make install # #安装主程序, CGI and HTML files

# make Install-init # #在/ETC/RC.D/INIT.D Install startup script

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/70/D5/wKioL1W_K4Ggbh1nAAC85a64OFs806.jpg "title=" QQ picture 20150803164226.png "alt=" Wkiol1w_k4ggbh1naac85a64ofs806.jpg "/>

# Make Install-config # #安装示例配置文件

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/70/D5/wKioL1W_K9bxffqYAAW2Y21HBf0016.jpg "title=" QQ picture 20150803164349.png "alt=" Wkiol1w_k9bxffqyaaw2y21hbf0016.jpg "/>

# Make Install-commandmode # #配置目录权限

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/70/D5/wKioL1W_LAmgiU3iAADH5q6TOvo847.jpg "title=" QQ picture 20150803164443.png "alt=" Wkiol1w_lamgiu3iaadh5q6tovo847.jpg "/>


3). Configure the Self-boot

# chkconfig--add Nagios # #增加nagios为系统服务

# chkconfig--level on # #设置nagios在运行级别3, 5 in case open

# chkconfig--list Nagios # #列出nagios服务设置详情

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/70/DE/wKiom1XAH9qSvvy8AAGXf72Phuw324.jpg "title=" QQ picture 20150804101317.png "alt=" Wkiom1xah9qsvvy8aagxf72phuw324.jpg "/>


4). Verify that the program is configured correctly

#/usr/local/nagios/bin/nagios-v/usr/local/nagios/etc/nagios.cfg

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/70/DB/wKioL1XAI2vjiXn4AAI3fEAWmVQ688.jpg "title=" QQ picture 20150804101940.png "alt=" Wkiol1xai2vjixn4aai3feawmvq688.jpg "/>


Iv. installation of Nagios plugins

1). Download Nagios-plugins

# wget http://nagios-plugins.org/download/nagios-plugins-2.0.3.tar.gz # #下载nagios-plugins

# TAR-ZXVF nagios-plugins-2.0.3.tar.gz # #解压nagios-plugins

# CD nagios-plugins-2.0.3


2). Compile and install Nagios-plugins

#./configure--prefix=/usr/local/nagios

# make

# make Install


3). Download Nagios-snmp-plugins

# wget Http://nagios.manubulon.com/nagios-snmp-plugins.1.1.1.tgz

# TAR-ZXVF Nagios-snmp-plugins.1.1.1.tgz

# CD NAGIOS-PLUGINS-2.0.3/


4). Compile and install Nagios-snmp-plugins

# yum Install Perl-cpan # #yum安装Perl-cpan,cpan is the Perl software collection that collects a lot of useful Perl modules (modules) and its associated documents. Nagios-snmp-plugins is a set of Perl-written plug-in programs that monitor hosts via SNMP, so you need to install perl-first CPAN

# PERL-MCPAN-E Shell

# cpan[1]> Install Net::snmp


V. Configuration httpd

#vi/etc/httpd/conf/httpd.conf


1). Add

User Apache
Group Apache

Modify the following to read:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/70/E0/wKioL1XAbbmwJN2vAAAtf1hmems797.jpg "title=" QQ picture 20150804153548.png "alt=" Wkiol1xabbmwjn2vaaatf1hmems797.jpg "/>


2). Add index.php in the following location

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/70/F1/wKioL1XBxC2T7LeaAABG3-it3Pk783.jpg "title=" QQ picture 20150805155707.png "alt=" Wkiol1xbxc2t7leaaabg3-it3pk783.jpg "/>


3). Configure nagios.conf

# CD NAGIOS-4.1.0RC1/

# ls

# make install-webconf # #安装nagios的web接口, create a nagios.conf file in the/ETC/HTTPD/CONF.D directory

# LS/ETC/HTTPD/CONF.D

# vi/etc/httpd/conf.d/nagios.conf

Change the htpasswd.user of lines 21 and 38 to HTPASSWD (note: You can also make no changes, but add the full path name in the lower part)

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/70/F4/wKiom1XBui6RjhRyAAE167HZtB4134.jpg "title=" QQ picture 20150805152359.png "alt=" Wkiom1xbui6rjhryaae167hztb4134.jpg "/>


4). Create Nagios validation files

# htpasswd-c/USR/LOCAL/NAGIOS/ETC/HTPASSWD Admin # #创建nagios登录web界面的用户名和密码

# cat/usr/local/nagios/etc/htpasswd # #查看认证文件的内容

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/70/E1/wKioL1XAerCAQ9yMAADSJaN4WPs523.jpg "title=" QQ picture 20150804163221.png "alt=" Wkiol1xaercaq9ymaadsjan4wps523.jpg "/>


5). Turn off SELinux:

A, temporary shutdown (do not restart the machine):

# Setenforce 0 # #设置SELinux become permissive mode (off SELinux)

# setenforce 1 # #设置SELinux become enforcing mode (SELinux)



b, modify the configuration file to restart the machine:

# Vi/etc/selinux/config

Change Selinux=enforcing to Selinux=disabled

Need to restart the machine


6). Enable the service and enter Nagios

# Systemctl Start Httpd.service

# Systemctl Start Snmpd.service

# Systemctl Start Nagios.service


Open the browser, enter http://127.0.0.1/nagios/, and then enter the user name and password previously configured to enter the Nagios Web interface 650) this.width=650; "Src=" http://s3.51cto.com/ Wyfs02/m00/70/e1/wkiol1xaf6oqt_69aalqsotql44423.jpg "title=" qq picture 20150804165338.png "alt=" Wkiol1xaf6oqt_ 69aalqsotql44423.jpg "/>



Vi. Installing the Nagios problem

After installation, open the Hosts option, which appears


650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/70/FE/wKiom1XC15-w9lfWAAEOSUT9KvA118.jpg "title=" QQ picture 20150806112220.png "alt=" Wkiom1xc15-w9lfwaaeosut9kva118.jpg "/>



In the above configuration we used "htpasswd-c/usr/local/nagios/etc/htpasswd admin" to generate the administrator account and password, nagios default Nagiosadmin as our login and password, And cgi.cfg is used to verify that identity. If we generate an administrator account that is not nagiosadmin, the authentication will fail and the error will occur.


Modify the following:

# vi/usr/local/nagios/etc/cgi.cfg

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/70/FA/wKioL1XC3dCx501jAADvw8iE3vQ608.jpg "title=" QQ picture 20150806113204.png "alt=" Wkiol1xc3dcx501jaadvw8ie3vq608.jpg "/>

Add your generated account in the above place, here is the admin above, then use systemctl restart Httpd.service restart Http,ok 650) this.width=650; S3.51cto.com/wyfs02/m02/70/fb/wkiol1xc4g7rtjr9aalzu80cwes640.jpg "title=" qq picture 20150806115850.png "alt=" Wkiol1xc4g7rtjr9aalzu80cwes640.jpg "/>

This article is from the Notepad blog, so be sure to keep this source http://wangzhijian.blog.51cto.com/6427016/1682211

CentOS7 Installing Nagios

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.