In order to monitor the network line conditions of different local computer rooms of major VPS hosting providers, we can use the free open source network performance monitoring tool to visualize the master/slave deployment of Smokeping. Smokeping's powerful and intuitive drawing can help us understand the network conditions of the IDC computer room within a certain period of time.
However, if we want to know more about the server's CPU, memory, disk IO, SQL data, hard disk capacity, web page loading speed, system load and other resource usage, we need a powerful server performance monitoring tool like zabbix. Zabbix is almost All hardware resources of the server can be monitored.
Zabbix is a network monitoring and management system developed by Alexei Vladishev. After installing Zabbix Agent on Linux and Windows systems, it can monitor various statuses such as CPU Load, network usage, hard disk capacity, etc. If the Agent is not installed, monitoring can also be carried out through SNMP, TCP, ICMP, etc.
Zabbix is an enterprise-level monitoring tool that can be used to deploy and monitor large-scale server cluster monitoring. For us personally, we can also use Zabbix to monitor the running status of our own servers in real time. Especially when you can't find out what's wrong with your server, it's very necessary to use Zabbix for comprehensive monitoring.
For more information about website server monitoring and VPS host performance evaluation, you can also check out:
- Summary of Linux system monitoring commands - master CPU, memory, disk IO, etc. to find performance bottlenecks
- Smokeping installation and configuration - free open source network performance monitoring tool visual master/slave deployment
- Server log analysis tools: ngxtop and GoAccess - real-time monitoring and visual management to quickly find the source of exceptions
PS: Updated on December 27, 2017 . Compared with Zabbix , which is large and comprehensive in monitoring , try the small and precise monitoring tool. These two This tool takes network traffic monitoring to the extreme: two excellent server network traffic monitoring tools: Ntopng and Munin - powerful and intuitive.
1. Zabbix installation and deployment
Official website:
- Website: https://www.zabbix.com
- Documentation: https://www.zabbix.com/documentation/3.4/zh/
- One-click package: https://github.com/X-Mars/Quick-Installation-ZABBIX
Zabbix supports installation methods such as distribution packages, containers, applications and compilation. Friends who find it troublesome can also directly use Github's third-party one-click installation package to install the server and client with one click.
The following official website provides detailed tutorials for installing Zabbix from the deployment package.
1.1 Red Hat Enterprise Linux/CentOS
Supported versions: RHEL 7, Oracle Linux 7, CentOS 7. The deployment packages of some components (such as agent, proxy, etc.) also support RHEL 5 and RHEL 6.
Install the source code library configuration deployment package.
This deployment package contains yum configuration files.
# rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.noarch.rpm
Install Zabbix deployment package.
The following is an example of installing Zabbix server and WEB front-end using Mysql database.
Zabbix official source code library also provides fping, iksemel, and libssh2 deployment packages. These packages are located in the non-supported directory.
# yum install zabbix-server-mysql zabbix-web-mysql
Example of installing only Zabbix Agent.
# yum install zabbix-agent
Install initialization database
To install Zabbix database and user on MySQL, please refer to the following guided steps. MySQL database creation script .
Then import the initial schema (Schema) and data.
# cd /usr/share/doc/zabbix-server-mysql-3.4.0 # zcat create.sql.gz | mysql -uroot zabbix
Start the Zabbix Server process
Edit the database configuration in zabbix_server.conf
# vi /etc/zabbix/zabbix_server.conf DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=zabbix
Start the Zabbix Server process
# systemctl start zabbix-server
Edit the PHP configuration of the Zabbix frontend
The Apache configuration file for the Zabbix frontend is located at /etc/httpd/conf.d/zabbix.conf . Some PHP settings have been configured.
php_value max_execution_time 300 php_value memory_limit 128M php_value post_max_size 16M php_value upload_max_filesize 2M php_value max_input_time 300 php_value always_populate_raw_post_data -1 # php_value date.timezone Europe/Riga
Depending on your time zone, you can uncomment the "date.timezone" setting and configure it correctly. After the configuration file is changed, the Apache web server needs to be restarted.
# systemctl start httpd
The Zabbix frontend can be accessed in a browser at http://zabbix-frontend-hostname/zabbix. The default username/password is Admin/zabbix.
1.2 Debian/Ubuntu
Supported versions: Debian 7 (Wheezy) and 8 (Jessie), Ubuntu 14.04 LTS (Trusty Tahr), 16.04 LTS (Xenial Xerus)
Install source code library configuration deployment package
Install the source code library configuration deployment package. This deployment package contains apt configuration files.
Install Zabbix 3.4 on Debian 7:
# wget http://repo.zabbix.com/zabbix/3.4/debian/pool/main/z/zabbix-release/zabbix-release_3.4-1+wheezy_all.deb # dpkg -i zabbix-release_3.4-1+wheezy_all.deb # apt-get update
Install Zabbix 3.4 on Debian 8:
# wget http://repo.zabbix.com/zabbix/3.4/debian/pool/main/z/zabbix-release/zabbix-release_3.4-1+jessie_all.deb # dpkg -i zabbix-release_3.4-1+jessie_all.deb # apt-get update
Install Zabbix 3.4 on Ubuntu 14.04 LTS:
# wget http://repo.zabbix.com/zabbix/3.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.4-1+trusty_all.deb # dpkg -i zabbix-release_3.4-1+trusty_all.deb # apt-get update
Install Zabbix 3.4 on Ubuntu 16.04 LTS:
# wget http://repo.zabbix.com/zabbix/3.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.4-1+xenial_all.deb # dpkg -i zabbix-release_3.4-1+xenial_all.deb # apt-get update
Install Zabbix deployment package
Example of installing Zabbix server and WEB front-end using mysql database.
# apt-get install zabbix-server-mysql zabbix-frontend-php
Example of installing Zabbix Agent only.
# apt-get install zabbix-agent
Install initialization database
To install Zabbix database and user on MySQL, please refer to the following guided steps. MySQL database creation script .
Then import the initial schema (Schema) and data
# cd /usr/share/doc/zabbix-server-mysql # zcat create.sql.gz | mysql -uroot zabbix
Start the Zabbix Server process
Edit the database configuration in zabbix_server.conf
# vi /etc/zabbix/zabbix_server.conf DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=zabbix
Start the Zabbix Server process
# service zabbix-server start
Edit the PHP configuration of the Zabbix frontend
The Apache configuration file for the Zabbix front end is located at /etc/apache2/conf.d/zabbix or /etc/apache2/conf-enabled/zabbix.conf. Some PHP settings have been configured.
php_value max_execution_time 300 php_value memory_limit 128M php_value post_max_size 16M php_value upload_max_filesize 2M php_value max_input_time 300 php_value always_populate_raw_post_data -1 # php_value date.timezone Europe/Riga
Depending on your time zone, you can uncomment the "date.timezone" setting and configure it correctly. After the configuration file is changed, the Apache web server needs to be restarted.
# service apache2 restart
The Zabbix frontend can be accessed in a browser at http://zabbix-frontend-hostname/zabbix. The default username/password is Admin/zabbix.
2. Zabbix monitoring host
Zabbix comes with Chinese. After logging in to Zabbix, you can see the default local monitoring that has been added. At the top are monitoring, asset reports, reports, configuration, and management.
Add host. Click on the upper right to add a host, and then fill in the detailed configuration of the host. There are several key points: the interfaces include IPMI interface, JMX interface, SNMP interface, and agent interface. We are adding a host, so we choose the agent interface. The IP address is the IP or domain name of the host we are about to add, and the corresponding port is the default 10050.
For other configurations, please refer to the demonstration on wzfou.com: (click to enlarge)
Add monitoring. After adding the host, we can click "Monitoring Items" in the host list.
After entering the monitoring item configuration interface, you can filter out some existing monitoring items based on some conditions and directly click the "Create Monitoring Item" button.
The next step is to fill in the detailed information of the monitoring items. There is a key point here: key value. After clicking the select button, you can see a lot of predefined keys. These keys are all keys that come with zabbix. These keys are generally keys that can be used by common system-level monitoring items, including CPU, Dozens of parameters such as memory, hard disk, network, etc. (Click to enlarge)
The data update interval indicates how often the data corresponding to the monitoring item is obtained. You can set it according to your own needs. For other reference, please refer to the demonstration below: (click to enlarge)
Finally, click Submit to complete the setting of monitoring items.
Return to the host page, and you can see the monitoring items you just added successfully.
You can repeat the above operations for multiple monitoring items, but when adding monitoring items with parameters in Zabbix, you need to understand the role of each parameter in advance. For example, to monitor the hard disk partition capacity, you can use "vfs.fs.size[fs,< mode>]" key. Among them, "vfs.fs.size" is the key name, and "[fs,<mode>]" is the parameter required by this key. The official website has a quick reference manual: https://www.zabbix.com/documentation/3.0/manual/config/items/itemtypes/zabbix_agent
3. Zabbix monitoring report
If you want to view real-time data reports, you can click "Monitoring" and then search for your host and monitoring items.
After clicking, you can see the chart data. You can click to enlarge the chart to view the report for the corresponding time period.
The report contains detailed monitoring item reports for each monitoring host.
Zabbix also provides aggregate graphics, and you can aggregate different monitoring items together to form new reports. (Click to enlarge)
This is the effect of Zabbix aggregation report.
Zabbix also provides an alarm function that can be integrated with various apps such as SMS and WeChat.
4. Summary
Zabbix is an enterprise-level open source solution based on WEB interface that provides distributed network monitoring functions. Its biggest features are distributed monitoring, automatic discovery, and customized monitoring projects. In the monitoring world, Zabbix is a "skill", and its use in personal server monitoring is really a "small trial".
If no data is displayed after you add Zabbix monitoring, check whether the monitoring items show normal operation. Especially for some monitoring items that require customized monitoring parameters, it is best to test them manually on the server first. The command format is: zabbix_get -s 192.168.0.1 -k system.cpu.switches
. If data is returned, it means that the parameter settings are normal.