Implementation principle of Nagios monitoring
The Nagios software needs to be installed on a separate server, known as the Monitoring Center, where the server can use Linux or Unix operating systems; each monitored hardware host or service runs a Nagios software daemon that communicates with the Monitoring Center server, It can also be understood as an Agent or plug-in. The Monitoring Center server reads the instructions in the configuration file and communicates with the remote daemon, and instructs the remote daemon to perform the necessary checks. Although the Nagios software must be running on Linux or Unix operating systems, the remotely monitored machine can be any host that can communicate with it, depending on the response returned by the remote host, Naigos will respond according to the configuration, and then Nagios will be tested by a local machine, If the detection return value is incorrect, Nagios will alarm in one or more ways
I. Preparatory work
Install some of the services and software that will be used during installation prior to installation.
# yum install httpd httpd-devel php
# yum Install gcc glibc glibc-common
# yum Install GD Gd-devel
Two. Install Nagios software
To create a Nagios user and set a password:
#/usr/sbin/useradd-m Nagios
# passwd Nagios
The password does not actually set the line, because basically will not pass the user to log in. Bash can also be set directly into/sbin/nolgoin.
Next we create the Nagcmd user group to execute commands from the Web interface and add Nagios and Apache users to this user group.
#/usr/sbin/groupadd Nagcmd
#/usr/sbin/usermod-a-G Nagcmd Nagios
#/usr/sbin/usermod-a-G Nagcmd Apache
Download Nagios and plugins
# wget http://iweb.dl.sourceforge.net/project/nagios/nagios-3.x/nagios-3.4.1/nagios-3.4.1.tar.gz
# wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.14.tar.gz
Install Nagios
# tar Xzf nagios-3.4.1.tar.gz
# CD Nagios
Run the Nagios configuration script and change the Nagcmd to the previously created group:
#./configure–with-command-group=nagcmd
# make All
Install binaries, init scripts, sample configuration files, and set external command directory permissions.
# make Install
# Make Install-init
# Make Install-commandmode
Contact information Configuration
#vi/usr/local/nagios/etc/objects/contacts.cfg
Modify a contact mailbox, etc.
Configuring the Web Interface
Install the Nagios Web configuration file in the Apache CONF.D directory:
# Make Install-webconf
Create Nagiosadmin account number and password for login Nagios web interface.
# htpasswd-c/usr/local/nagios/etc/htpasswd.users nagiosadmin
# Service httpd Restart
Compiling and installing Nagios plug-ins
# CD ~
# tar Xzf nagios-plugins-1.4.14.tar.gz
# CD nagios-plugins-1.4.16
#./configure–with-nagios-user=nagios–with-nagios-group=nagios
# make
# make Install
Start Nagios
To set the boot boot:
# Chkconfig–add Nagios
# chkconfig Nagios on
Test configuration file for errors:
#/usr/local/nagios/bin/nagios-v/usr/local/nagios/etc/nagios.cfg
Start Nagios
# service Nagios Start
Landing Nagios
# Http://192.168.0.245/nagios
The account number and password are set above. Nagios Monitor Page screenshot below