Today’s tutorial is also based on the existing project needs to do server operation and maintenance monitoring. Due to the tight project and heavy task, operation and maintenance monitoring is also a top priority to ensure the normal operation of the system. Due to the special government project, network and environmental reasons, Proxy is used to collect information instead of server. The specific project topology will not be explained too much here.
1. Introduction to Zabbix
Zabbix is an enterprise-level open source solution that provides distributed system monitoring and network monitoring capabilities based on a WEB interface.
Zabbix can monitor various network parameters to ensure the safe operation of the server system. It also provides a flexible notification mechanism for system administrators to quickly locate and resolve problems. Zabbix consists of two parts, Zabbix Server and optional Zabbix Agent. Zabbix Server can use SNMP, Zabbix Agent, ping, port monitoring and other methods to provide remote server/network status monitoring, data collection and other functions, it can run on Linux, Solaris, HP-UX, AIX, Free BSD, Open BSD, On platforms like OS X.
1.1. Main features of Zabbix:
- Simple installation and configuration, low learning cost
- Supports multiple languages (including Chinese)
- Free and open source
- Automatically discover servers and network devices
- Distributed monitoring and WEB centralized management capabilities
- No agent can be used for monitoring
- User security authentication and soft authorization
- Set or view monitoring results on the webui
- Email and other notification functions
1.2 Main functions of Zabbix:
- The CPU load
- Memory usage
- Disk usage
- The network status
- Port monitor
- Log monitoring
1.3 the Zabbix’s official website
www.zabbix.com/
2. Environment construction
2.1 Environment Construction machine configuration. Since this is a demonstration environment, there are many Agent machines in the production environment. There are not too many demonstrations here, and the demonstration environment is all on the same network segment
192.168.177.145 Zabbix Server 192.168.177.146 Zabbix Agent 192.168.177.147 Zabbix Agent1 192.168.177.148 Zabbix Proxy
Note: Here, Zabbix Server and Zabbix Proxy are on the same network segment. Zabbix Proxy has two network adapters, one on network segment 177 and the other on network segment 110. Agent on network segment 110 collects data through proxy. Upload the data to the server in batches. In this way, frequent access to the server can avoid pressure on the server
2.2 Configure the system before installation
2.2.1 Because the centos system mirror source is foreign, we switch to the domestic Ali Cloud or 163 mirror source
Ali: wget mirrors.aliyun.com/repo/Centos… 163: wget mirrors.163.com/.help/CentO…
2.3 Installing zabbix Server The installation is done by binary package
This is provided by the official website, and we choose version 4.0 here
2.3.1 Dependencies under installation This process may be a bit lengthy
yum install epel-release yum -y install “Development Tools”
2.3.2 Installing the Zabbix image source
The RPM – Uvh repo.zabbix.com/zabbix/4.0/…
yum clean all
2.3.3 Disabling the Firewall
systemctl stop firewalld
2.3.4 Installing zabbix-server-mysql Zabbix-web-mysql
yum install zabbix-server-mysql zabbix-web-mysql
Copy the code
2.3.5 install mariadb server. –
yum -y install mariadb-server
Copy the code
2.3.6 starting mariadb server. –
systemctl start mariadb.service
systemctl status mariadb.service
Copy the code
2.3.7 Next look at the mysql startup process
ps aux | grep mysql
Copy the code
Run the mysql_secure_installation command to do this
3. Next, modify the database
create database zabbix character set utf8 collate utf8_bin;
Copy the code
3.1 Next create a Zabbix user
grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix@somnus123';
flush privileges;
Copy the code
3.2 Synchronizing the database table structure
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -pzabbix@somnus123 zabbix
Copy the code
3.3 Configuring zabbix Server next
/etc/zabbix/zabbix_server.conf
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix@somnus123
Copy the code
3.4 Starting the Zabbix Server
systemctl start zabbix-server.service
systemctl start zabbix-server.service
Copy the code
4. Configure the Zabbix front end
4.1 Configuring the PHP configuration file
vi /etc/php.ini
max_execution_time = 300
memory_limit = 128M
post_max_size = 16M
upload_max_filesize = 2M
max_input_vars = 10000
always_populate_raw_post_data = - 1
date.timezone = Asia/Shanghai
Copy the code
4.2 start the HTTPD
systemctl start httpd.service
systemctl status httpd.service
Copy the code
4.3 throughhttp://192.168.177.145/zabbix/setup.php access zabbix
Where we mark is where we configure, and we can’t proceed without meeting the requirements
4.4 Setting the Database Password
4.5 Configuring the Zabbix Server
4.6 Final Confirmation
4.7 Log in to Zabbix next
Account: Admin Password: zabbix
4.8 Logging In to the Page
The ZabBX Server installation is complete
5. Install Zabbix Proxy
yum -y install zabbix-proxy-mysql
Copy the code
5.1 Installing the Database See 2.3.5 Steps
5.2 Creating a Database
create database zabbix_proxy character set utf8 collate utf8_bin;
Copy the code
5.3 Creating a User
grant all privileges on zabbix_proxy.* to zabbix@localhost identified by 'zabbix@somnus123';
flush privileges;
Copy the code
5.4 Importing the table Structure Next
rpm -ql zabbix-proxy-mysql
Copy the code
5.5 Importing Data
zcat /usr/share/doc/zabbix-proxy-mysql4 -.0.25/schema.sql.gz | mysql -uzabbix -pzabbix@somnus123 zabbix_proxy
Copy the code
5.6 Modifying the Zabbix-Proxy Configuration File
vi /etc/zabbix/zabbix_proxy.conf
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix@somnus123
Server=192.168.177.145
Hostname=sd-proxy
Copy the code
Modify the configuration file and restart it after modification
5.7 Starting the Service
systemctl start zabbix-proxy.service
systemctl status zabbix-proxy.service
Copy the code
5.8 Configure the proxy on the web UI
6 Install the Zabbix Agent
yum -y install zabbix-agent
Copy the code
6.1 Starting the Zabbix Agent
systemctl start zabbix-agent
systemctl status zabbix-agent
Copy the code
6.2 Modifying the Zabbix-Agent Configuration File
vi /etc/zabbix/zabbix_agent.conf
Server=192.168.177.148
Hostname=zabbix
Copy the code
Modify the configuration file and restart it after modification
If the following screen is displayed, the monitoring is successfully deployed and monitored
6.3 Viewing Monitoring Information
6.4 Warning Information Is Displayed on the dashboard
7 Add email alarm
7.1 Enabling Email Alarm
7.2 Selecting an Email Address
7.3 Sending Emails By Creating Events
7.4 Logging In to emails
That’s all for today’s tutorial. If this article is helpful to you, please share it with your friends. Your encouragement is the biggest motivation for me.
Related blog
CentOS teach you how to build Zabbix Server,Zabbix Proxy,Zabbix Agent enterprise monitoring platform