Install and configure Nagios in Linux (1)

Source: Internet
Author: User

Install and configure Nagios in Linux (1)

1. About Nagios

Nagios is an open-source computer system and network monitoring tool that can effectively monitor the status of Windows, Linux and Unix hosts, network settings such as vswitches and routers, and printers. If the system or service status is abnormal, an email or text message alert will be sent immediately to the website O & M personnel. After the status is restored, a normal email or text message notification will be sent.

Nagios, formerly known as NetSaint, is developed and maintained by Ethan Galstad. NAGIOS is an abbreviated form: "Nagios Ain't Gonna Insist On Sainthood" Sainthood is translated as a saint, while "Agios" is a Greek representation of "saint. Nagios is developed and used in Linux, but it also works very well in Unix.

Main functions

  • Network service monitoring for SMTP, POP3, HTTP, NNTP, ICMP, SNMP, FTP, and SSH)
  • Host Resource Monitoring CPU load, disk usage, system logs), including the use of NSClient ++ plugin on Windows hosts)
  • You can specify your own plug-in to collect data through the network to monitor the temperature, warning ......)
  • You can configure the Nagios remote execution plug-in to remotely execute scripts.
  • Remote monitoring supports monitoring through SSH or SSL plus Channels
  • The Simple plug-in design allows users to easily develop their own inspection services. It supports many development languages such as shell scripts, C ++, Perl, ruby, Python, PHP, and C)
  • Including a lot of Graphical Data PluginsNagiosgraph, Nagiosgrapher, PNP4Nagios, etc)
  • Parallel service check
  • Allows you to define the layers of network hosts and perform step-by-step checks from the parent host.
  • When a service or host encounters a problem, you can send a notification by email, pager, sms, or any user-defined plugin.
  • Ability to customize event processing mechanisms to reactivate problematic services or hosts
  • Automatic Log Loop
  • Support for redundancy monitoring
  • You can view the current network status, notifications, problem history, and log files on the Web interface.

Ii. How Nagios works

Nagios functions are monitoring services and hosts, but it does not include these functions. All monitoring and detection functions are implemented through various plug-ins.

After Nagios is started, it automatically calls the plug-in periodically to check the server status. At the same time, Nagios maintains a queue, and all the status information returned by the plug-in enters the queue, nagios reads and processes the information from the beginning of the team, and then displays the status results on the web.

Nagios provides many plug-ins that can be used to conveniently monitor many service statuses. After the installation is complete, all plug-ins that can be used by nagios are stored in/libexec in the main directory of nagios. For example, check_disk is the plug-in for checking disk space, and check_load is used to check CPU load, and so on. Each plug-in can view its usage and functions by running./check_xxx-h.

Nagios can identify four status returned information, that is, 0 (OK) indicates that the status is normal/Green, 1 (WARNING) indicates that a WARNING/yellow, 2 (CRITICAL) indicates a very serious error/red, 3 (UNKNOWN) indicates an UNKNOWN error/dark yellow. Nagios judges the status of the Monitored object based on the value returned by the plug-in, and displays it on the web for the Administrator to detect faults in time.

Four monitoring statuses

Besides, the alarm function makes no sense if the monitoring system finds a problem and cannot trigger an alarm. Therefore, alarm is also an important function of nagios. However, Nagios does not have any alarm code or plug-ins. Instead, it is handed over to users or other open-source project teams.

Nagios installation refers to the installation of the basic platform, that is, the Nagios software package. It is the framework of the monitoring system and the basis of all monitoring systems.

Open the official Nagios documentation and you will find that there are basically no dependency packages for Nagios. Only Linux or other systems supported by Nagios are required. However, if you have not installed the apachehttp service, you will not have an intuitive interface to view monitoring information. Therefore, apache is a prerequisite. There are a lot of online installation information about apache, just install it. After installation, check whether it works properly.

After learning how Nagios manages server objects through plug-ins, I am now studying how Nagios manages Remote Server objects. The Nagios system provides a plug-in named NRPE. Nagios periodically runs it to obtain various status information of the remote server. Shows the relationship between them:

Nagios uses NRPE to remotely manage services

1. Execute the check_nrpe plug-in installed in Nagios and tell check_nrpe to check which services.

2. Use SSL and check_nrpe to connect the NRPE daemon on the remote host.

3. NRPE runs various local plug-ins to check local services and statuses (check_disk,... etc)

4. Finally, NRPE sends the detection results to the check_nrpe on the host end, And check_nrpe sends the results to the Nagios status queue.

5. Nagios reads the information in the queue in sequence and displays the result.

Iii. Lab Environment

Host Name OS IP Software
Nagios-Server CentOS release 6.3 (Final) 192.168.1.108 Apache, Php, Nagios, and nagios-plugins
Nagios-Linux CentOS release 5.8 (Final) 192.168.1.111 Nagios-plugins, nrpe
Nagios-Windows Windows XP 192.168.1.113 NSClient ++

The Server has installed nagios software to process the monitoring data and provides a web interface for viewing and managing. Of course, you can also monitor the local information.

The Client has a Client such as NRPE installed. It executes monitoring based on the monitoring machine's request and then returns the result to the monitoring machine.

Firewall disabled/iptables: Firewall is not running.

SELINUX = disabled

Iv. Lab Objectives

5. Install Nagios Server

5.1 basic support suite: Gcc glibc-common gd-devel xinetd openssl-devel

# Rpm-q gcc glibc-common gd-devel xinetd openssl-devel

If these kits are not available in the system, use yum to install

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

5.2 create nagios users and user groups

 
 
  1. # useradd -s /sbin/nologin nagios   
  2. # mkdir /usr/local/nagios   
  3. # chown -R nagios.nagios /usr/local/nagios  

View nagios Directory Permissions

# Ll-d/usr/local/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.