Recently in the study of Nagios monitoring System, and then online search to view a lot of information, learn from the experience of prawns with you, organize records of their own installation records.
Nagios 's full name is (Nagios Ain ' t Goona insist on Saintood), and the initial project name is Netsaint. It is a free open source IT Infrastructure monitoring system, its powerful and flexible, can effectively monitor Windows, Linux, VMware and Unix host status, switches, routers and other network settings. Once the host or service status is abnormal, the message or SMS alert will be sent to the IT operator, and a normal email or SMS notification is sent after the status is restored. Nagios has a simple structure, strong maintainability, and is increasingly favored by small and medium-sized enterprises, as well as the use of operations and management personnel. An optional browser-based Web interface is also available to allow administrators to view the system's operational status, network status, service status, log information, and other anomalies.
Nagios Structure Description
Nagios is structurally divided into two parts of the core and plugin. The core of Nagios only provides very little monitoring, so to build a complete IT monitoring management system, users also need to install the appropriate plugin on the Nagios server, plug-ins can be downloaded from the Nagios official website http://www.nagios.org/, You can also write your own required plugins according to the actual requirements.
Features that Nagios can achieve
- Monitor network Services (SMTP, POP3, HTTP, FTP, PING, etc.);
- Monitor native and remote host resources (CPU load, disk utilization, process, etc.);
- Allows users to write their own plug-ins to monitor specific services, to easily expand their own service detection methods, support a variety of development languages (Shell, Perl, Python, PHP, etc.)
- With the ability to define the network hierarchy, the "parent" host definition is used to express the relationship between the network hosts, which can be used to discover and clarify the host outage or unreachable state;
- When a service or host problem arises and is resolved, the alarm is sent to the contact person (via EMail, SMS, user defined mode);
- Can support and implement redundant monitoring of the host;
- Available Web interface for viewing current network status, notification and fault history, log files, etc.;
Nagios Monitoring Implementation principle
Nagios software needs to be installed on a separate server, called the Monitoring Center, the Monitoring Center server can use Linux or Unix operating system; each monitored hardware host or service runs a Nagios software daemon that communicates with the Monitoring Center server, It can also be understood as either an Agent or a plug-in. The Monitoring Center server reads the instructions in the configuration file to communicate with the remote daemon and instructs the remote daemon to perform the necessary checks. Although Nagios software must be run on a Linux or Unix operating system, the remotely monitored machine can be any host that can communicate with it, and Naigos will respond to the configuration based on the response returned by the remote host, and Nagios will be tested on a local machine, If the detected return value is incorrect, Nagios will be alerted in one or more ways, as shown in the following:
Figure 1. Nagios monitoring schematic diagram
Nagios Installation
- Pre-installation Preparations
wget FTP://rpmfind.net/linux/dag/redhat/el7/en/x86_64/dag/rpms/ rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm# rpm--import http://dag.wieers.com/rpm/packages/ Rpm-gpg-key.dag.txt# RPM-UVH rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm
#Yuminstallperlgccgcc-c++ httpd php
600060016000 -G nagios-g nagcmd-d/home/nagios Nagios
- Compiling and installing Nagios
mkdir /usr/local/tar zxvf nagios-4.0. 8. Tar . Gz[[email protected] opt]# CD Nagios-4.0. 8 [email protected] Nagios-4.0. 8] #./configure--prefix=/usr/local/nagios--with-nagios-user=nagios--with-nagios-group=nagios--with-command-user= Nagios--with-command-group=nagcmd
[Email protected] nagios-4.0.8]# MakeAll[[email protected] Nagios-4.0.8]# Make Install[[email protected] Nagios-4.0.8]# Make Install-Init[[email protected] Nagios-4.0.8]# Make Install-Commandmode[[email protected] Nagios-4.0.8]# Make Install-Config[[email protected] Nagios-4.0.8]# Make Install-webconf
[Email protected] nagios-4.0. 8] # vim/etc/httpd/conf/httpd.conf
DirectoryIndex index.html Index.html.var Change to: DirectoryIndex index.html index.php
Add another line: AddType application/x-httpd-php. php
The above two places are mainly used to increase the support of PHP format.
At the same time, for security, you need to be authorized to access the Nagios Web monitoring interface, so you need to add an access control configuration to the configuration file/etc/httpd/conf/httpd.conf or/etc/httpd/conf.d/nagios.conf, if defined in httpd.conf file, add the statement to the last surface of the httpd.conf file.
scriptalias/nagios/cgi-bin/usr/local/nagios/Sbin<directory"/usr/local/nagios/sbin">Options execcgi allowoverride None Order allow,deny allow from all AuthName"Nagios Access"authtype Basicauthuserfile/usr/local/nagios/etc/Htpasswd.user//files used for this directory access authenticationRequire Valid-User</Directory>Alias/nagios/usr/local/nagios/Share<directory"/usr/local/nagios/share">Options None allowoverride none Order allow,deny allow from all AuthName"Nagios Access"authtype Basicauthuserfile/usr/local/nagios/etc/Htpasswd.user//files used for this directory access authenticationRequire Valid-User</Directory>
- Set up user access control
[Email protected] nagios-4.0. 8] # htpasswd-c/usr/local/nagios/etc/htpasswd.user nagiosadmin //enter, enter set a password
- Permission settings and startup services
chown nagios.nagcmd/usr/local/nagios/etc/~]# usermod-a-~]#/etc/init.d/httpd Restart
The various monitoring functions provided by Naigos are basically done via plug-ins, and Nagios's core refers to a small number of features, so installing plugins is necessary. Nagios website provides a lot of different sections of the plug-in application, and the plugin version and Nagios version is not related, if the support of the Chinese feature, you need to find a matching Chinese software package, otherwise it will cause some functions can not complete the operation, here to maintain the default English, such as the following installation details:
[Email protected] opt]#TarZXVF nagios-plugins-2.0.3.Tar. Gz[[email protected] opt]# CD Nagios-plugins-2.0.3[[email protected] Nagios-plugins-2.0.3]#./configure--prefix=/usr/local/nagios--with-nagios-user=nagios--with-nagios-group=nagios--with-command-user= Nagios--with-command-group=Nagcmd[[email protected] Nagios-plugins-2.0.3]# MakeAll[[email protected] Nagios-plugins-2.0.3]# Make Install
[email protected] nagios-plugins-2.0.3]# chmod 755/usr/local/nagios
So Nagios plug-in is installed, by looking at the Nagios main program directory,/usr/local/nagios/linexec directory can see a lot of external plug-in execution files, such as:
- Nagios and Apache service startup and Setup
[Email protected] ~]#/etc/init.d/~]#/etc/init.d/~~]# chkconfig httpd on
- disabling Selinux and Iptables
[[email protected] ~]# 0 / / temporarily close // or modify the/etc/selinux/config file to selinux=enforcing change to selinux=disabled reboot machine OK
[[email protected] ~]#/etc/init.d/iptables stop // close iptables~~]# Chkconfig iptables off // permanent shutdown, reboot effective.
Through the browser, enter in the Address bar: Http://IPAddress/nagios, enter the user name and password to access the Naigos login interface.
Nagios Monitoring System Erection (a)