SoFunction
Updated on 2025-04-24

Detailed steps to install Zabbix 3.0 in CentOS 6.9

1. Introduction

In the Linux environment, there are many practical system monitoring software, such as Nagios, Cacti, Zabbix, Monit, etc. These open source software can help us better manage machines, promptly detect problems and warn system maintenance personnel. Today we will focus on Zabbix, which is used to better monitor MySQL database servers and generate graphical reports. Compared to Nagios, Zabbix is ​​more powerful in this regard.

2. Introduction to Zabbix

1. Definition

Zabbix is ​​an enterprise-level open source solution based on the WEB interface that provides distributed system monitoring and network monitoring capabilities.

2. Components

Zabbix consists of two parts: Zabbix server and optional component Zabbix agent.

  • Zabbix server can provide monitoring of the status of remote servers/networks through SNMP, Zabbix agent, ping, port monitoring and other methods.
  • The Zabbix agent needs to be installed on the monitored target server, mainly collecting hardware information or memory, CPU and other information related to the operating system.

3. Main features

  • Low learning cost
  • Supports multilingual (including Chinese)
  • Free open source
  • Automatically discover servers and network devices
  • Distributed monitoring and centralized WEB management functions
  • Can be monitored without agent
  • User safe authentication and flexible authorization methods
  • Set up or view monitoring results through the WEB interface
  • Have notification functions such as email

4. Main functions

  • CPU load
  • Memory usage
  • Disk usage
  • Network status
  • Port monitoring
  • Log monitoring

5. Official installation information

The official provides detailed installation information, which can be accessed:Official website

3. Build ZABBIX to prepare resources

  • The server is required to be a LAMP environment or an LNMP environment.
  • The host name and IP should be written in the HOST file.
  • iptables and selinux must be closed, and in production environments, only firewall ports can be opened.

4. Build a LAMP environment (yum installation)

yum -y install gcc net-snmp-devel curl-devel OpenIPMI
yum -y install mysql* php* http*

After the installation is completed, test whether the web can access the php page:

Add php page:

vi /var/www/html/

Add the following to the file:

<?php
    phpinfo();
?>

Check if the process is present:

netstat -anlp|grep :80

Use a browser to access the test:

http://ipaddress:Port number

5. Server installation steps

1. Install the LAMP environment and dependency packages

yum install -y  mysql-server mysql-devel libcurl-devel net-snmp-devel php php-gd php-xml php-mysql php-mbstring php-bcmath httpd gcc c++ gcc-c++ curl-devel xmlrpc

2. Add user and set startup items

[root@localhost ~]# groupadd zabbix
[root@localhost ~]# useradd zabbix -g zabbix
[root@localhost ~]# chkconfig httpd on
[root@localhost ~]# chkconfig mysqld on
[root@localhost ~]# chkconfig snmpd on

3. Create a database and add user authorization

[root@localhost ~]# /etc//mysqld start

Enter the MySQL command line and execute the following command:

mysql> create database zabbix character set utf8;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by '123456';
mysql> grant all privileges on zabbix.* to zabbix@'%' identified by '123456';

4. Compile and install zabbix

[root@localhost ~]# tar xvf zabbix-3.0.
[root@localhost ~]# cd zabbix-3.0.9
[root@localhost zabbix-3.0.9]# ./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl
[root@localhost zabbix-3.0.9]# make && make install
[root@localhost zabbix-3.0.9]# mysql -uzabbix -p123456 < database/mysql/ zabbix
[root@localhost zabbix-3.0.9]# mysql -uzabbix -p123456 < database/mysql/ zabbix
[root@localhost zabbix-3.0.9]# mysql -uzabbix -p123456 < database/mysql/ zabbix

5. Modify the configuration file

[root@localhost ~]# vi /usr/local/zabbix/etc/zabbix_server.conf 

Modify the following:

LogFile=/tmp/zabbix_server.log   #log logPidFile=/tmp/zabbix_server.pid   #pid
DBName=zabbix               #Database NameDBUser=zabbix                #Database Authorized UsersDBPassword=123456           #Database Authorization PasswordDBSocket=/var/lib/mysql/   #File path of database sockListenIP=10.0.8.223                #Server IP addressAlertScriptsPath=/usr/local/zabbix/share/zabbix/alertscripts  #Script path

6. Copy the startup file, modify the startup file, authorize, etc.

cp /usr/local/src/zabbix-3.0.9/misc//fedora/core/zabbix_server /etc//zabbix_server
cp /usr/local/src/zabbix-3.0.9/misc//fedora/core/zabbix_agentd /etc//zabbix_agentd
[root@localhost ~]# vi /etc//zabbix_server
BASEDIR=/usr/local/zabbix
[root@localhost ~]# vi /etc//zabbix_agentd
BASEDIR=/usr/local/zabbix
[root@localhost ~]#  vi /etc/services
zabbix-agent 10050/tcp Zabbix Agent
zabbix-agent 10050/udp Zabbix Agent
zabbix-trapper 10051/tcp Zabbix Trapper
zabbix-trapper 10051/udp Zabbix Trapper
[root@localhost ~]# chmod +x /etc//zabbix_server #Execution permissions[root@localhost ~]# chmod +x /etc//zabbix_agentd #Execution permissions[root@localhost ~]# chkconfig zabbix_server on #Add boot[root@localhost ~]# chkconfig zabbix_agentd on #Add boot[root@localhost ~]# /etc//iptables stop #Turn off the firewall

7. Copy the zabbix installation page, authorize, etc.

[root@localhost ~]# cp -r /usr/local/src/zabbix-3.0.9/frontends/php/ /var/www/html/zabbix
[root@localhost ~]# chown -R zabbix:zabbix /var/www/html/zabbix
[root@localhost ~]# chmod 777 -R /var/www/html/zabbix

8. Modify the php configuration file

[root@localhost ~]# vi /etc/ #Edit and modify

Modify the following:

post_max_size =16M
max_execution_time =300
max_input_time =300
 = Asia/Shanghai

9. Start the zabbix service

[root@localhost ~]# /etc//zabbix_server start #Server service[root@localhost ~]# /etc//zabbix_agentd start #Client service[root@localhost ~]#  netstat -ntlp |grep zabbix   #Check whether the service process is started

10. Test access

http://ipaddress:Port number

6. Client installation steps

[iyunv@zabbix-c1 ~]# yum install  tree gcc gcc-c++ -y
[root@localhost ~]# groupadd zabbix
[root@localhost ~]# useradd zabbix -g zabbix
[root@localhost ~]# cd /usr/local/src
[root@localhost ~]# tar zxf zabbix-3.0.
[root@localhost ~]# cd zabbix-3.0.9
[root@localhost zabbix-3.0.9]# ./configure --prefix=/usr/local/zabbix --enable-agent
[root@localhost zabbix-3.0.9]# make && make install
[root@localhost zabbix-3.0.9]# cp misc//fedora/core/zabbix_agentd /etc//
[root@localhost zabbix-3.0.9]# vi /etc//zabbix_agentd
BASEDIR=/usr/local/zabbix/
[root@localhost zabbix-2.0.6]# vi /usr/local/zabbix/etc/zabbix_agentd.conf

Modify the following:

PidFile=/tmp/zabbix_server.pid   #pid
LogFile=/tmp/zabbix_agentd.log   #log logServer=10.0.8.223      #Server IP addressServerActive=10.0.8.223   #Server IP addressHostname=zabbix_user     #Server hostnameInclude=/usr/local/zabbix/etc/zabbix_agentd./   #Subconfig fileUnsafeUserParameters=1   # #Enable customizationkey

Start the client service

[iyunv@zabbix-c1 ~]# /etc//zabbix_agentd start #Client service[root@localhost ~]#  netstat -ntlp |grep zabbix   #Check whether the service process is started

Finally, go to the web to add the host.

7. Frequently Asked Questions and Solutions

Problem description

cannot send list of active checks to [127.0.0.1]: host [Zabbix server] not monitored
Show in monitoring Zabbix state:Zabbix Server running The value is NO(No)

Solution

  • Check if the port is enabled.
  • Check if the firewall is turned on. If it is turned on, add an exception, or turn off the firewall.
  • The server's host name must be the same as the client's Hostname.
  • Close SELinux (Security Enhanced Linux [Security Enhanced Linux]):
gedit /etc/sysconfig/selinux

Modify the content to:

SELINUX=disabled

Through the above steps, you can successfully install and configure Zabbix 3.0 on CentOS 6.9 system for system monitoring.

This is the end of this article about the detailed tutorial on CentOS 6.9 installation of Zabbix 3.0. For more related content on CentOS installation of Zabbix, please search for my previous articles or continue browsing the related articles below. I hope everyone will support me in the future!