The setup of Nagios monitoring service

Source: Internet
Author: User

Nagios is an open source computer system and network monitoring tool that can effectively monitor Windows, Linux and UNIX host status, switch routers and other network settings, printers, etc.

Key Features

Network Service Monitoring (SMTP, POP3, HTTP, NNTP, ICMP, SNMP, FTP, SSH)

Host resource monitoring (CPU load, disk usage, system logs), also including Windows hosts (using nsclient++ plugin)

You can specify the plugin you write to collect data over the network to monitor any situation (temperature, warning ...). )

Scripts can be executed remotely by configuring the Nagios remote execution plug-in

Remote monitoring supports SSH or SSL plus channel mode for monitoring

Simple plugin design allows users to easily develop their own inspection services, supporting many development languages (shell scripts, C + +, Perl, Ruby, Python, PHP, C #, etc.)

Contains many graphical data plugins (Nagiosgraph, Nagiosgrapher, Pnp4nagios, etc.)

Parallel service Check Available

Ability to define the hierarchy of network hosts, allowing for step-by-step checks, starting from the parent host

Notify when a problem occurs with a service or host, via email, pager, SMS or any user-defined plugin

Ability to customize the event handling mechanism to reactivate a faulty service or host

Automatic log Looping

Supports redundant monitoring

Includes web interface to view current network status, notifications, problem history, log files, etc.

Ii. working principle of Nagios

Nagios's function is to monitor the service and host, but he does not include this part of the function, all the monitoring, detection functions are through a variety of plug-ins to complete.

Nagios provides a number of plug-ins that allow you to easily monitor many service statuses. After the installation is complete, there are all the plugins available in Nagios's/libexec in the Nagios home directory, such as Check_disk is the plug-in that checks the disk space, Check_load checks the CPU load, and so on. Each plugin can be used to view its usage and functionality by running the./check_xxx–h.

Nagios can recognize 4 status return information, 0 (OK) indicates that the status is normal/green, 1 (WARNING) indicates a warning/yellow, 2 (CRITICAL) indicates a very serious error/red, 3 (UNKNOWN) indicates an unknown error/dark yellow. Nagios determines the state of the monitored object based on the value returned by the plug-in, and displays it through the Web for administrators to detect faults in a timely manner.

Nagios uses Nrpe to manage services remotely

1. Nagios executes the Check_nrpe plugin installed inside it and tells Check_nrpe to detect which services.

2. Connect the Nrpe on the remote machine via the Ssl,check_nrpe daemon

3. NRPE runs various local plugins to detect local service and status (Check_disk,.. etc

4. Finally, NRPE passes the results of the test to the host side Check_nrpe,check_nrpe and sends the results to the Nagios status queue.

5. Nagios reads the information in the queue, then displays the results.

Install below

# yum install-y gcc glibc glibc-common gd xinetd openssl-devel


# useradd-s/sbin/nologin Nagios

# Mkdir/usr/local/nagios

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

# wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.4.3.tar.gz

# tar ZXVF nagios-3.4.3.tar.gz

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

# make All

Report the following error

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M02/A5/46/wKioL1m6ZVizyXNHAAA4ERPfBLI449.png "title=" 0.46093984032862.png "alt=" Wkiol1m6zvizyxnhaaa4erpfbli449.png "/>

Actually it is to make the target file/include/locations.h, this is the header file, but this header file needs broker.o file

This file is provided by the Perl installation package, and you can install Perl first by executing the following command, and then re-start./configure, make all there's no problem.

Yum Install Perl-y

# make Install

# Make Install-init

# Make Install-commandmode

# Make Install-config

# chkconfig--add Nagios

# chkconfig--level and Nagios on

# chkconfig--list Nagios

Verify that the program is installed correctly

Switch directories to the installation path (here is/usr/local/nagios) to see if there are five directories such as etc, bin, sbin, share, Var, if present, it can indicate that the program is properly installed to the system. Nagios Various directory uses are described below:

Bin
The directory where the Nagios executable program resides

etc
The directory where the Nagios configuration files are located

Sbin
The directory where the Nagios CGI files are located, that is, the files required to execute the external command

Share
The directory where the Nagios Web page file resides

Libexec
The directory where Nagios external plugins are located

Var
The directory where Nagios log files, lock, and other files reside

Var/archives
Nagios Log Auto Archive directory

Var/rw
The directory used to store external command files

Install the Nagios plugin below

# wget https://nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz

# tar XZVF nagios-plugins-2.2.1.tar.gz

# CD nagios-plugins-2.2.1

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

# Make && make install

The following installs the Web interface support for Apache and PHP

# wget http://archive.apache.org/dist/httpd/httpd-2.2.23.tar.gz

# tar ZXVF httpd-2.2.23.tar.gz

# CD httpd-2.2.23

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

# Make && make install

If the following error occurs

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M01/06/95/wKiom1m6ZZfwdAsaAAGm5ly6WE8708.png "title=" 1.png "alt=" Wkiom1m6zzfwdasaaagm5ly6we8708.png "/>

It can be solved by adding--with-included-apr at compile time.

# wget http://101.96.10.63/jp2.php.net/distributions/php-5.5.38.tar.gz

# TAR-XZVF Php-5.5.38.tar.gz

# CD php-5.5.38

#./configure--prefix=/usr/local/php--with-apxs2=/usr/local/apache2/bin/apxs

apxsis a tool for compiling and installing extensions for Apache HTTP servers that compiles one or more source programs or target code files into a dynamically shared object that can be mod_so LoadModule loaded into the Apache server at run time with the instructions provided.

This may occur in the following situations

650) this.width=650; "border=" 0 "src=" index_files/ecd7e379-536d-4e33-a198-a99a32250856.png "alt=" Ecd7e379-536d-4e33-a198-a99a32250856.png "/>

This is to say you do not install libxml This package, I use Yum installation, found that the hint has been installed, I think it is possible that the compiler package is not installed, sure enough, is libxml this compilation package is not installed

# yum Install LIBXML2

# yum Install Libxml2-devel

And then go back to execution./configure command.

# Make && make install

# vi/usr/local/apache2/conf/httpd.conf

Found it:

User Daemon Group Daemon

Revision changed to

User Nagios Group Nagios

And then find

<ifmodule dir_module> DirectoryIndex index.html </IfModule>

Revision changed to

<ifmodule dir_module> directoryindex index.html index.php </IfModule>

The following additions are then added:

AddType application/x-httpd-php. php

The essence is to add a file type that can execute PHP, such as adding a line of "AddType application/x-httpd-php. htm", then the. htm file can also execute the PHP program.

For security reasons, it is generally necessary for Nagios's web monitoring pages to be authorized for access, which requires an additional authentication configuration, i.e. the following information is added at the end of the httpd.conf file:

#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              //the file 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>


Create Apache directory validation files

In the above configuration, the directory validation file htpasswd is specified, and the following is the file to be created:

#/usr/local/apache2/bin/htpasswd-c/USR/LOCAL/NAGIOS/ETC/HTPASSWD username

This creates a HTPASSWD authentication file in the/usr/local/nagios/etc directory, which is required to enter the user name and password when accessed through http://192.168.1.108/nagios/.

Launch Apache Service

#/usr/local/apache2/bin/apachectl Start

Source: http://www.cnblogs.com/mchina/archive/2013/02/20/2883404.html

This article is from "Love Zhou Yu" blog, please be sure to keep this source http://izhouyu.blog.51cto.com/10318932/1965409

The setup of Nagios monitoring service

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.