For the maintenance and management of Linux system, its performance monitoring is very important, especially the real-time monitoring data. This data is helpful for us to judge the load pressure of the server, adjust the resource allocation in time, and better serve the business. So today, the migrant worker brother gives you a Linux performance real-time monitoring tool: Netdata.
Let's get a rendering first. Let's look first
Introduction to Netdata
Netdata is a real-time monitoring tool for Linux system performance. It is a highly optimized Linux daemon that can provide real-time performance monitoring for Linux systems, applications (including but not limited to Web servers, databases, etc.) and SNMP services.
Netdata displays the monitored information by means of visualization, so that you can clearly understand the real-time operation status of your system, program and application, and can also be integrated with Prometheus, Graphite, OpenTSDB, Kafka, Grafana, etc.
Netdata is free and open source software that currently runs on Linux, FreeBSD and macOS, as well as other systems derived from them, such as Kubernetes and Docker.
Netdata warehouse address:_ github.com/netdata/ne...
1. Friendly and beautiful visual interface 2. Customizable control interface 3. Fast and efficient installation 4. Simple configuration, even zero configuration 5. Zero dependency 6. Extensible, with plug-in API 7. Wide range of system platforms supported
How does Netdata work?
Netdata is an efficient and highly modular index management engine. Its lock free design makes it very suitable for concurrent operations on metrics.
For the function description of each component in the figure above, if you are interested, please refer to the official description, which will not be repeated here.
What can Netdata monitor?
Netdata can collect indicators from more than 200 popular services and applications, as well as dozens of system related indicators, such as CPU, memory, disk, file system, network, etc. We call these collectors, and they are managed by plug-ins that support multiple programming languages, including Go and Python.
Popular collectors include Nginx, Apache, MySQL, statsd, cgroups (containers, dockers, Kubernetes, LXC, etc.), traifik, and Web server access Log file, etc.
For detailed support list, please refer to the following description:_ github.com/netdata/ne...
Netdata installation 1. Direct installation
First, you need to update and upgrade the system kernel and some dependent library files
[root@CentOS7-1 ~]# yum update -y Copy code
If there is no prompt for y the system to be updated, you can also enter it directly when the system is installed.
After performing the update operation, directly execute the following command to install Netdata.
[root@CentOS7-1 ~]# bash <(curl -Ss https://my-netdata.io/kicksta... Copy code
Then, the program will automatically execute the installation action, download a series of packages for installation, and confirm the operation once in the middle, as follows:
May be due to access to foreign resources, and depending on your network relationship, the waiting time may be long or short.
Some key information can also be seen from the installation process, as shown in the figure above.
From the information in the figure above, we can see the access method and the command to start and stop the service.
The installation is completed as shown in the figure below
It shows that Netdata has been started. We can use the command to check whether it has been started?
[root@CentOS7-1 ~]# lsof -i :19999 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME netdata 14787 netdata 4u IPv4 27995 0t0 TCP *:dnp-sec (LISTEN) netdata 14787 netdata 5u IPv6 27996 0t0 TCP *:dnp-sec (LISTEN) [root@CentOS7-1 ~]# ps -ef|grep netdata netdata 14787 1 2 23:24 ? 00:00:06 /usr/sbin/netdata -P /var/run/netdata/netdata.pid -D netdata 14800 14787 0 23:24 ? 00:00:00 /usr/sbin/netdata --special-spawn-server netdata 14954 14787 0 23:24 ? 00:00:01 bash /usr/libexec/netdata/plugins.d/tc-qos-helper.sh 1 netdata 14974 14787 0 23:24 ? 00:00:02 /usr/bin/python /usr/libexec/netdata/plugins.d/python.d.plugin 1 root 14975 14787 1 23:24 ? 00:00:04 /usr/libexec/netdata/plugins.d/ebpf.plugin 1 netdata 14976 14787 0 23:24 ? 00:00:01 /usr/libexec/netdata/plugins.d/go.d.plugin 1 netdata 14977 14787 1 23:24 ? 00:00:05 /usr/libexec/netdata/plugins.d/apps.plugin 1 root 15277 1149 0 23:29 pts/0 00:00:00 grep --color=auto netdata Copy code
2. Docker installation
First prepare the Docker environment, and then directly execute the following commands to complete the installation operation.
docker run -d --name=netdata -p 19999:19999 -v netdatalib:/var/lib/netdata -v netdatacache:/var/cache/netdata -v /etc/passwd:/host/etc/passwd:ro -v /etc/group:/host/etc/group:ro -v /proc:/host/proc:ro -v /sys:/host/sys:ro -v /etc/os-release:/host/etc/os-release:ro --restart unless-stopped --cap-add SYS_PTRACE --security-opt apparmor=unconfined netdata/netdata Copy code
After installation, you can access it in the following ways.
1. Overall data interface
7. Network interface
8. Data synchronization function
The charts on the Netdata dashboard are synchronized with each other, and there is no main chart. You can pan or zoom any chart at any time, and all other charts will appear with it.
You can pan the chart by dragging with the mouse. When the mouse pointer hovers over the chart, you can use SHIFT + to zoom in / out of the mouse wheel chart.
The power of Netdata
The reason why it is so powerful is its cooperation and support with various applications. It is directly illustrated in the figure above:
Netdata cluster management scheme
The above shows only the monitoring data of a single server, and one disadvantage of netdata is that all monitored servers need to install agent s. Therefore, there is a problem here, that is, how to uniformly manage and display the monitoring data?
The master server is designed as the master server, but the slave server is not related to the official server. It can collect data from the master server as well as other servers.
1,netdata.cloud uses its own netdata Cloud, that is, the sign in the upper right corner of the WEB interface of each installation node. As long as we use the same account to log in to netdata Cloud (requires kexue to access the Internet), and then each node can be easily controlled through an account. Each node opens port 19999 and allows the administrator to view the data, and then the control center transmits the data collected from the ports of each node through the front end to netdata Cloud records and displays.
This is a passive cluster monitoring, which is essentially an independent machine, and it is not convenient to make a custom cluster dashboard.
2. stream plug-in. Therefore, in order to solve the disadvantages of the above scheme, netdata provides another method to collect the data of each node to a (main) server, and the data processing is also on this server. Other nodes do not need to open port 19999. It is an active transmission mode, which sends the collected data to the main server, so that the user-defined dashboard development can be carried out on the main server.
Disadvantages: the traffic and load of the primary server will be relatively large (in the case of a large number of cluster servers). If the load of the primary server is too high, we can solve this problem by setting the update every of the node servers.
Netdata cluster monitoring configuration
Many articles only introduce the installation and display results of some interfaces, and do not provide the solution of cluster monitoring and its specific configuration. Brother migrant workers has also checked a lot of information, and now share its configuration process with you.
For those unfamiliar with the configuration of streaming, please refer to the official documentation: docs.netdata.cloud/st...
1. Node server configuration
[root@CentOS7-1 ~]# cd /etc/netdata/ [root@CentOS7-1 netdata]# vim netdata.conf #Modify the configuration as follows [global] memory mode = none hostname = [It is recommended to change it to your host name] [web] mode = none Copy code
Then, create a new file stream. In the / etc/netdata / directory Conf, and then configure it as follows:
[stream] enabled = yes destination = MASTER_SERVER_IP:PORT api key = xxxx-xxxx-xxxx-xxxx-xxxx #The parameters are described below destination = MASTER_SERVER_IP:PORT Primary server address and port api key Required uuid String, Linux The following commands can be used in the system to generate automatically. [root@CentOS7-1 netdata]# uuidgen 480fdc8c-d1ac-4d6f-aa26-128eba744089 Copy code
After the configuration is completed, you need to restart the netdata service of the node to complete the whole configuration.
[root@CentOS7-1 ~]# systemctl restart netdata Copy code
2. Master server configuration
In netdata Create a new stream under the same directory of conf Conf and write the following configuration:
[API_KEY]/[480fdc8c-d1ac-4d6f-aa26-128eba744089] enabled = yes default history = 3600 default memory mode = save health enabled by default = auto allow from = * [API_KEY] enabled = yes default history = 3600 default memory mode = save health enabled by default = auto allow from = * #Among them, API_KEY corresponds to the API key (string) of the node server. allow from can set the allowed source of the data stream to ensure security. #If there are multiple node servers, they are written together in stream Conf inside Copy code
Restart netdata after configuration:
systemctl restart netdata Copy code
After all configurations are completed, you can see the drop-down menu (host name) in the upper right corner of the WEB interface of the main server, and click to see the relevant monitoring information.
If you need to customize the control panel, you can refer to the official document to modify the xml file.