Install Nagios under CentOS

Source: Internet
Author: User

Install Nagios and see an article to add notes for later learning to use

    1. Environment installation

#yum install-y gcc glibcglibc-common gd gd-devel xinetd openssh-devel httpd php


Settings for 2.selinux

(SELinux:selinux is version 2.6. Linux kernelprovided in theMandatory access Control(MAC) system. For the currently available Linux security modules, SELinux is the most versatile and fully tested, and it was in the 20MACestablished on the basis of research. SELinux incorporates multi-level security or an optional multi-class policy in the type enforcement server and employs a role-based access control concept. )

① View the status of SELinux:

        #/usr/sbin/sestatus-v         ##  selinux status:    enabled     Open status        

② off SELinux: (Divided into temporary shutdown, modify profile close)

Temporary shutdown (no need to restart the machine)

         # Setenforce 0                     # # set SELinux to permissive mode, which is displayed as current mode:permissive

# # setenforce 1 set SELinux to enforcing mode

Modify configuration (requires restart)

         Modify the/etc/selinux/config file and change the selinux=enforcing to selinux= Disable can be.    # #enforce Mandatory mode, permissive tolerant mode (on behalf of SELinux operation, only the warning does not but will actually be limited) disabled, off (selinux not working)


3. Set up users and user groups

# useradd-s/sbin/nologin Nagios

# Mkdir/usr/local/nagios

# Chown-r Nagios.nagios/usr/local/nagios

Add Nagios and Apache users to the Nagcmd group to ensure that Nagios and Apache have access

# groupadd Nagcmd

# usermod-g Nagcmd Nagios

# usermod-g Nagcmd Apache


4. Compiling and installing Nagios

# TAR-ZXVF Nagios-4.3.1.tar.gz

# CD nagios-4.3.1

To initialize and build a compiled environment

#./configure-prefix=/usr/local/nagios-with-command-group=nagcmd

# make All

# make install #安装二进制文件

# make Install-init #初始化脚步

# make Install-config #实例配置文件

# make Install-commandmode #设置目录权限

After the installation is complete, you can see bin etc libexec sbin share var under directory/usr/local/nagios, indicating successful installation

# Make install-webconf #安装nagios的web配置文件


5, using Apache to create a basic Web page authentication method

Create an Admin user to log in to the Nagiso Web page

# htpasswd-c/usr/local/nagios/etc/hpasswd.users admin


6. Nagios Plugin nagios-plugins-2.1.4 Installation

The Nagios main program is just a control center, which requires the installation of Nagios plug-ins for functions such as service detection and system detection.

# cd/root/downloads

# TAR-ZXVF nagios-plugins-2.1.4

# CD nagios-plugins-2.1.4

#./configure-prefix=/usr/local.nagios-with-nagios-user=nagios-with-nagios-group=nagios

# make

# make Install


7. Check the configuration file and test

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

If the error is not indicated, the configuration is successful.

# service Nagios Star

Then visit Http://localhost/nagios, you can see the following screen


650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M01/8E/F6/wKioL1jQijWTXTi7AAREm0a2c6w789.png-wh_500x0-wm_ 3-wmp_4-s_2261876472.png "title=" Qq20170321100407.png "alt=" Wkiol1jqijwtxti7aarem0a2c6w789.png-wh_50 "/>


Click Hosts to view native monitoring details, if the following error message appears

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M01/8E/F9/wKiom1jQiVXBSsTNAAE1wBfXJKU161.png-wh_500x0-wm_ 3-wmp_4-s_317756281.png "title=" Qq20170321100012.png "alt=" Wkiom1jqivxbsstnaae1wbfxjku161.png-wh_50 "/>

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

find Use_authentication=1, change 1 to 0, save

# Service Nagios Restart

# Service httpd Restart


Show Normal

650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M02/8E/F6/wKioL1jQi2CgEjpyAAFIMg2TtUU036.png-wh_500x0-wm_ 3-wmp_4-s_4163879717.png "title=" Qq20170321100918.png "alt=" Wkiol1jqi2cgejpyaafimg2ttuu036.png-wh_50 "/>


Install Nagios under CentOS

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.