Lamp Bad and LNMP environment installation Nagios4.1.1 and basic configuration

Source: Internet
Author: User

----------------------------------------the following content for the author's production environment Monitoring, installation is a step-by-step test--------------------------------

Environment: Lamp:centos 6.8, Apache 2.4, Mysql 5.6, PHP 5.6.22

Lnmp:centos 6.8, Nginx 1.10, Mysql 5.6, PHP 5.6.22

Software: Nagios4.1.1, NRPE2.15, nagios-plugins2.14, pnp4nagios0.6.25, nsclient++-stable

Installation Environment Confirmation:

First verify that you have installed the lamp environment or LNMP environment, and then see the installation instructions in the corresponding environment as needed.

I use the lamp, LNMP one-click installation package, installation can be installed on demand for the corresponding software version. wget http://soft.vpser.net/lnmp/lnmp1.3-full.tar.gz

Other software please go to nagios official website to download Https://www.nagios.org/downloads/nagios-core, or Baidu search software name will have. I don't have a connection here.

Lamp Bad Environment Installation Nagios4.1.1

Server-side installation:

      Installing Nagios-4.1.1

1. New Nagios User

Useradd-s/sbin/nologin Nagios

2, decompression nagios4.1.1 software, and installation

Tar zxvf nagios-4.1.1.tat.gz

CD NAGIOS-4.1.1/

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

Make a && make install && make Install-init && make Install-commandmode && make install- Config

3. Add Nagios boot automatically

Chkconfig--add Nagios

Chkconfig--level and Nagios on

Chkconfig--list Nagios

     Installing the Nagios-plugin Plugin

4, decompression Nagios-plugin software, and installation

Tar zxvf nagios-plugin-2.1.4.tar.gz

./configure--prefix=/usr/local/nagios && make && make install

5. Modify the installed Nagios directory owner

Chown–r Nagios.nagios/usr/local/nagios

     Installing the Nrpe Plugin

      6, decompression Nrpe software, and installation (here only need to install Nrpe one of the Check_nrpe plug-in Can)

Tar zxvf nrpe-2.15.tar.gz && CD nrpe.2.15

./configure && make all && make Install-plugin

7. Add Nrpe commands to Nagios's command.cfg file

Vim/usr/local/nagios/etc/objects/commands.cfg Add the following:

# ' Check_nrpe ' command definition

Define Command{

Command_name Check_nrpe

Command_line $USER 1$/check_nrpe-h $HOSTADDRESS $-C $ARG 1$

}

    Apache supports Nagios configuration

   8. Modify Apache file vim/usr/local/apache/conf/httpd.conf

Add or modify:

User Nagios

Group Nagios

LoadModule Actions_module modules/mod_actions.so

LoadModule Cgid_module modules/mod_cgid.so

AddType application/x-httpd-php. php

DirectoryIndex index.html after adding index.php

The file is finally added as follows:

#setting for Nagios

Scriptalias/nagios/cgi-bin "/usr/local/nagios/sbin"

<directory "/usr/local/nagios/sbin" >

AuthType Basic

Options execcgi

AllowOverride None

Order Allow,deny

Allow from all

AuthName "Nagios Access"

AUTHUSERFILE/USR/LOCAL/NAGIOS/ETC/HTPASSWD//files used for this directory access authentication

Require Valid-user

</Directory>

Alias/nagios "/usr/local/nagios/share"

<directory "/usr/local/nagios/share" >

AuthType Basic

Options None

AllowOverride None

Order Allow,deny

Allow from all

AuthName "Nagios Access"

authuserfile/usr/local/nagios/etc/htpasswd

Require Valid-user

</Directory>

  

9. Create Nagios Web Account

/usr/local/apache2/bin/htpasswd-c/usr/local/nagios/etc/htpasswd Nagiosadmin (This is the Nagios default account, you can also use a different name, But to add your own account at cgi.cfg)

10. Start and stop Nagios

Service Nagios Restart Restart Nagios

Service httpd Restart Restart Apache

11. Web Login Nagios

Http://xxx.xxx.xxx.xxx/nagios, account password is the fifth step to set the account password

The server side of Nagios is now ready to install!

Nagios Monitors Linux Clients

Linux clients only need to install Nagios-plugins and Nrpe, the steps are as follows:

1. New Nagios User

Useradd-s/sbin/nologin Nagios

2, decompression Nagios-plugin software, and installation

Tar zxvf nagios-plugin-2.1.4.tar.gz

./configure--prefix=/usr/local/nagios && make && make install

3. Modify the installed Nagios directory owner

Chown–r Nagios.nagios/usr/local/nagios

4. Install Nrpe monitor Remote Linux plugin

Tar zxvf nrpe-2.15.tar.gz && CD nrpe-2.15

./configure && make all && make Install-plugin && make Install-daemon && make Install-daem On-config && make install xinetd

5, install xinetd service, Nrpe rely on xinetd service

Yum-y Install xinetd

6. Modify the Nrpe configuration file

Vim/etc/xinetd.d/nrpe

Only_from Add the Nagios server IP, comma separated not spaces

Vim/usr/local/nagios/etc/nrpe.cfg

Allowed_hosts Add the Nagios server IP, comma separated not spaces

7. Start Nrpe and xinetd

/usr/local/nagios/bin/nrpe-c/usr/local/nagios/etc/nrpe.cfg–d

Service xinetd Start

8, Nagios server-side check and monitoring of the Linux host communication

/usr/local/nagios/libexec/check_nrpe-h 192.168.16.222 (appears Nrpe v2.15 indicates normal)

NRPE v2.15

This is where Nagios's client installation is complete!

Nagios Monitoring Window Client

1, installation nsclient++

Double-click Run, always next until the input allowed hosts and nsclient are present passwd

Enter the IP for the server that corresponds to Nagios, and set a nsclient password

Modules to load tick inside except enable WMI checks unchecked, the others are checked and the next installation is complete.

2, Configuration nsclient++

Enter the Nsclient installation directory, open the Nsc.ini file,

Modify [modules] content: except; CheckWMI.dll and; RemoteConfiguration.dll the other, remove the preceding semicolon. Note that the same does not need to be opened repeatedly

Modify [Settings] Content: Modify allowed_hosts= nagios ip password= Install the password for nsclient settings

Modify [nsclient] Content: Modify port=12489

Save it!

3. Start Nsclient

Cmd-->services.msc-->nsclient++ starts the service and is set to Automatic, the login option allows interactive tick to be selected.

This is where Nagios monitors the Windows host configuration to complete!

      

Lamp Bad and LNMP environment installation Nagios4.1.1 and basic configuration

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.