Nagios installation and deployment (Centos: 6)

NAGIOS monitoring

Nagios is an open source free network monitoring tool that can effectively monitor the status of Windows, Linux and Unix hosts, network devices such as switches, routers, and printers. When the system or service status is abnormal, an email or SMS alarm will be sent to notify the website operation and maintenance personnel as soon as possible, and a normal email or SMS notification will be sent after the status is restored.

The operating conditions required by Nagios are that the machine must be able to run Linux (or a variant of Unix) and have a C language compiler. You must correctly configure the TCP/IP protocol stack so that most service inspections can be performed over the network. You need but do not have to configure the CGIs program in Nagios correctly, and once you want to use the CGI program, you must install the following software...a WEB service (preferably Apache)

NAGIOS installation and deployment (pure operation)

Turn off the firewall and turn off SElinux for operation

1. Build LAMP and test successfully If you encounter problems with LAMP build, you can refer to my Centos: 6-LAMP deployment

2. Upload all required software packages (decompress, rename) and change the name voluntarily, depending on personal needs.
Here, I only change nagios-4.0.3.tar.gz to nagios

Unzip and delete the tar package

[root@DB ~]# ls
nagios-4.0.3.tar.gz  nagios-plugins-1.5.tar.gz  nrpe-2.15.tar.gz
[root@DB ~]# tar xf nagios-4.0.3.tar.gz 
[root@DB ~]# tar xf nagios-plugins-1.5.tar.gz 
[root@DB ~]# tar xf nrpe-2.15.tar.gz 
[root@DB ~]# ls
nagios-4.0.3         nagios-plugins-1.5         nrpe-2.15
nagios-4.0.3.tar.gz  nagios-plugins-1.5.tar.gz  nrpe-2.15.tar.gz
[root@DB ~]# rm -rf *gz
[root@DB ~]# ls
nagios-4.0.3  nagios-plugins-1.5  nrpe-2.15

Move and rename

[root@DB ~]# mv nagios-4.0.3/ /usr/local/nagios

Create nagios users and user groups

[root@DB ~]# useradd -s /sbin/nologin nagios
[root@DB ~]# chown -R nagios.nagios /usr/local/nagios/

Install the corresponding dependency package (the three packages require the same dependencies, so you only need to install it once)

[root@DB ~]# yum -y install gcc gcc-c++ pcre-devel openssl-devel

3. Install nagios
1. Configure
Enter the installation directory
Configuration: Configure
prefix according to requirements (specify installation directory)

[root@DB ~]# cd /usr/local/nagios/
[root@DB nagios]# ./configure --prefix=/usr/local/nagios/

2. Compile and install
Compile: make all
install Nagios basic environment#make
installinstall Nagios service init script# make install-init
install Nagios configuration file directory# make install-config
install Nagios web configuration file# make install-webconfinstall
Nagios permissions related# make install-commandmode

[root@DB nagios]# make all && \
> make install && \
> make install-init && \
> make install-config && \
> make install-webconf && \
> make install-commandmode

3, generate Nagios Web page and create a user authentication file
is recommended to use nagiosadmin , otherwise may cause some features can not be achieved
password can be freely
Username: nagiosadmin
password: admin

[root@DB nagios]# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
New password: 
Re-type new password: 
Adding password for user nagiosadmin

Fourth, install Nagios-plugins
1. Configuration
Enter the installation directory
Configuration: Configure according to requirements

[root@DB ~]# cd nagios-plugins-1.5/
[root@DB nagios-plugins-1.5]# ./configure --prefix=/usr/local/nagios/

2. Compile and install

[root@DB nagios-plugins-1.5]# make && make install

5. Install nrpe
1. Configure
Enter the installation directory
Configuration: Configure according to requirements

[root@DB ~]# cd nrpe-2.15/
[root@DB nrpe-2.15]# ./configure --prefix=/usr/local/nagios/

2. Compile and install

[root@DB nrpe-2.15]# make all && make install-plugin && make install-daemon

Six, restart nagios and apache, test and access

[root@DB nrpe-2.15]# service nagios restart
[root@DB nrpe-2.15]# service httpd restart

Insert picture description here
Insert picture description here

At this point, our NAGIOS monitoring software has been built! If you are interested in deploying Zabbix, please refer to my blog for the complete deployment process of Zabbix!

Guess you like

Origin blog.csdn.net/qq_49296785/article/details/107432164