目录
- About 监控工具 Netdata
- Linux 系统安装 Netdata
- 关于 openEuler
- 1、查看内核信息
- 2、查看主机信息
- 3、查看 `dnf` 包管理器的版本
- Netdata 安装
- 1、更新系统环境相关 `rpm` 包
- 2、查看 netdata 包信息
- 3、安装 netdata 包
- 4、编辑 netdata.conf 配置
- 5、启动 netdata 服务
- 6、查看 netdata 监听端口
- 浏览器查看 netdata 可视化监控页面
- Netdata 和 Other 监控方案对比
- 1、Netdata vs Prometheus
- 2、Netdata VS The World
About 监控工具 Netdata
Netdata
是一款开源且强大的 Linux
系统轻量级可视化监控工具,可以实时监控性能化指标,监控的指标非常全面。
Netdata
每秒收集指标,并以精美的低延迟仪表盘呈现。它设计用于在所有物理和虚拟服务器、云部署、Kubernetes
集群和边缘/物联网设备上运行,以监控系统、容器和应用。
它能很好地从单台服务器扩展到数千台服务器,甚至在复杂的多/混/混合云环境中也是如此,而且只要有足够的磁盘空间,它就能将你的指标保存数年之久。
关于 Netdata
更多请查看:
- 项目地址:
https://github.com/netdata/netdata
- 官网介绍,
https://www.netdata.cloud/netdata-vs-world/
Linux 系统安装 Netdata
此处我们使用 openEuler 22.03 (LTS-SP3)
安装 Netdata
举例。
关于 openEuler
1、查看内核信息
[root@euler /]# cat /proc/version
Linux version 5.10.0-188.0.0.101.oe2203sp3.x86_64 (root@dc-64g.compass-ci) (gcc_old (GCC) 10.3.1, GNU ld (GNU Binutils) 2.37) #1 SMP Wed Feb 21 13:30:44 CST 2024
2、查看主机信息
[root@euler /]# hostnamectl
Static hostname: euler
Icon name: computer-vm
Chassis: vm
Machine ID: d9abda54a69e40f9905d6644c1f21f56
Boot ID: e9ec1ccee27541c8a1f0ec3520710444
Virtualization: microsoft
Operating System: openEuler 22.03 (LTS-SP3)
Kernel: Linux 5.10.0-188.0.0.101.oe2203sp3.x86_64
Architecture: x86-64
Hardware Vendor: Microsoft Corporation
Hardware Model: Virtual Machine
3、查看 dnf
包管理器的版本
[root@euler /]# dnf --version
4.14.0
Installed: dnf-0:4.14.0-16.oe2203sp3.noarch at 2024年02月29日 星期四 05时12分09秒
Built : http://openeuler.org at 2023年12月27日 星期三 09时38分26秒
Installed: rpm-0:4.17.0-33.oe2203sp3.x86_64 at 2024年04月05日 星期五 06时14分17秒
Netdata 安装
安装步骤如下:
1、更新系统环境相关 rpm
包
dnf -y updata
关于 dnf updata & dnf upgrade
命令区别:
DNF Update Vs Upgrade [Which One Is Better]
,https://linuxsimply.com/linux-basics/package-management/upgrade-package/dnf-update-vs-upgrade/yum update 和 yum upgrade 的真正区别
,https://cloud.tencent.com/developer/article/1604418
2、查看 netdata 包信息
# 显示 DNF 仓库中或者已安装包的相关信息
[root@euler ~]# dnf info netdata
Last metadata expiration check: 0:13:38 ago on 2024年04月05日 星期五 14时02分44秒.
Available Packages
Name : netdata
Version : 1.39.1
Release : 1.oe2203sp3
Architecture : x86_64
Size : 2.6 M
Source : netdata-1.39.1-1.oe2203sp3.src.rpm
Repository : EPOL
Summary : Real-time performance monitoring
URL : https://github.com/netdata/netdata/
License : GPLv3 and GPLv3+ and ASL 2.0 and CC-BY-4.0 and MIT and WTFPL
Description : netdata is the fastest way to visualize metrics. It is a resource
: efficient, highly optimized system for collecting and visualizing any
: type of realtime time-series data, from CPU usage, disk activity, SQL
: queries, API calls, web site visitors, etc.
: netdata tries to visualize the truth of now, in its greatest detail,
: so that you can get insights of what is happening now and what just
: happened, on your systems and applications.
3、安装 netdata 包
[root@euler ~]# dnf install -y netdata
Last metadata expiration check: 0:14:23 ago on 2024年04月05日 星期五 14时02分44秒.
Dependencies resolved.
=================================================================================================
Package Architecture Version Repository Size
=================================================================================================
Installing:
netdata x86_64 1.39.1-1.oe2203sp3 EPOL 2.6 M
Installing dependencies:
libssh2 x86_64 1.10.0-5.oe2203sp3 OS 178 k
netdata-conf noarch 1.39.1-1.oe2203sp3 EPOL 165 k
netdata-data noarch 1.39.1-1.oe2203sp3 EPOL 7.6 M
nmap x86_64 2:7.92-8.oe2203sp3 update 5.9 M
nodejs x86_64 1:12.22.11-9.oe2203sp3 update 92 k
nodejs-libs x86_64 1:12.22.11-9.oe2203sp3 update 11 M
protobuf x86_64 3.14.0-8.oe2203sp3 OS 976 k
protobuf-c x86_64 1.4.0-4.oe2203sp3 OS 124 k
protobuf-compiler x86_64 3.14.0-8.oe2203sp3 OS 869 k
Installing weak dependencies:
nodejs-docs noarch 1:12.22.11-9.oe2203sp3 update 4.1 M
nodejs-full-i18n x86_64 1:12.22.11-9.oe2203sp3 update 7.5 M
npm x86_64 1:6.14.16-1.12.22.11.9.oe2203sp3 update 3.9 M
Transaction Summary
=================================================================================================
Install 13 Packages
Total download size: 45 M
Installed size: 185 M
Downloading Packages:
(1/13): protobuf-c-1.4.0-4.oe2203sp3.x86_64.rpm 283 kB/s | 124 kB 00:00
(2/13): libssh2-1.10.0-5.oe2203sp3.x86_64.rpm 174 kB/s | 178 kB 00:01
(3/13): protobuf-compiler-3.14.0-8.oe2203sp3.x86_64.rpm 924 kB/s | 869 kB 00:00
(4/13): netdata-conf-1.39.1-1.oe2203sp3.noarch.rpm 415 kB/s | 165 kB 00:00
(5/13): netdata-1.39.1-1.oe2203sp3.x86_64.rpm 2.5 MB/s | 2.6 MB 00:01
(6/13): netdata-data-1.39.1-1.oe2203sp3.noarch.rpm 4.5 MB/s | 7.6 MB 00:01
(7/13): nodejs-12.22.11-9.oe2203sp3.x86_64.rpm 405 kB/s | 92 kB 00:00
(8/13): protobuf-3.14.0-8.oe2203sp3.x86_64.rpm 164 kB/s | 976 kB 00:05
(9/13): nodejs-docs-12.22.11-9.oe2203sp3.noarch.rpm 1.2 MB/s | 4.1 MB 00:03
(10/13): nodejs-libs-12.22.11-9.oe2203sp3.x86_64.rpm 1.2 MB/s | 11 MB 00:08
(11/13): npm-6.14.16-1.12.22.11.9.oe2203sp3.x86_64.rpm 1.1 MB/s | 3.9 MB 00:03
(12/13): nmap-7.92-8.oe2203sp3.x86_64.rpm 146 kB/s | 5.9 MB 00:41
(13/13): nodejs-full-i18n-12.22.11-9.oe2203sp3.x86_64.rpm 141 kB/s | 7.5 MB 00:54
-------------------------------------------------------------------------------------------------
Total 754 kB/s | 45 MB 01:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Running scriptlet: npm-1:6.14.16-1.12.22.11.9.oe2203sp3.x86_64 1/1
Preparing : 1/1
Installing : protobuf-3.14.0-8.oe2203sp3.x86_64 1/13
Installing : protobuf-compiler-3.14.0-8.oe2203sp3.x86_64 2/13
Installing : protobuf-c-1.4.0-4.oe2203sp3.x86_64 3/13
Installing : nodejs-libs-1:12.22.11-9.oe2203sp3.x86_64 4/13
Installing : nodejs-docs-1:12.22.11-9.oe2203sp3.noarch 5/13
Installing : nodejs-full-i18n-1:12.22.11-9.oe2203sp3.x86_64 6/13
Installing : npm-1:6.14.16-1.12.22.11.9.oe2203sp3.x86_64 7/13
Installing : nodejs-1:12.22.11-9.oe2203sp3.x86_64 8/13
Running scriptlet: netdata-data-1.39.1-1.oe2203sp3.noarch 9/13
Installing : netdata-data-1.39.1-1.oe2203sp3.noarch 9/13
Installing : netdata-conf-1.39.1-1.oe2203sp3.noarch 10/13
Installing : libssh2-1.10.0-5.oe2203sp3.x86_64 11/13
Installing : nmap-2:7.92-8.oe2203sp3.x86_64 12/13
Installing : netdata-1.39.1-1.oe2203sp3.x86_64 13/13
Running scriptlet: netdata-1.39.1-1.oe2203sp3.x86_64 13/13
Netdata config should be edited with /usr/libexec/netdata/edit-config
Netdata go plugin can be easily installed with /usr/sbin/netdata-install-go-plugins.sh script
Verifying : libssh2-1.10.0-5.oe2203sp3.x86_64 1/13
Verifying : protobuf-3.14.0-8.oe2203sp3.x86_64 2/13
Verifying : protobuf-c-1.4.0-4.oe2203sp3.x86_64 3/13
Verifying : protobuf-compiler-3.14.0-8.oe2203sp3.x86_64 4/13
Verifying : netdata-1.39.1-1.oe2203sp3.x86_64 5/13
Verifying : netdata-conf-1.39.1-1.oe2203sp3.noarch 6/13
Verifying : netdata-data-1.39.1-1.oe2203sp3.noarch 7/13
Verifying : nmap-2:7.92-8.oe2203sp3.x86_64 8/13
Verifying : nodejs-1:12.22.11-9.oe2203sp3.x86_64 9/13
Verifying : nodejs-docs-1:12.22.11-9.oe2203sp3.noarch 10/13
Verifying : nodejs-full-i18n-1:12.22.11-9.oe2203sp3.x86_64 11/13
Verifying : nodejs-libs-1:12.22.11-9.oe2203sp3.x86_64 12/13
Verifying : npm-1:6.14.16-1.12.22.11.9.oe2203sp3.x86_64 13/13
Installed:
libssh2-1.10.0-5.oe2203sp3.x86_64 netdata-1.39.1-1.oe2203sp3.x86_64
netdata-conf-1.39.1-1.oe2203sp3.noarch netdata-data-1.39.1-1.oe2203sp3.noarch
nmap-2:7.92-8.oe2203sp3.x86_64 nodejs-1:12.22.11-9.oe2203sp3.x86_64
nodejs-docs-1:12.22.11-9.oe2203sp3.noarch nodejs-full-i18n-1:12.22.11-9.oe2203sp3.x86_64
nodejs-libs-1:12.22.11-9.oe2203sp3.x86_64 npm-1:6.14.16-1.12.22.11.9.oe2203sp3.x86_64
protobuf-3.14.0-8.oe2203sp3.x86_64 protobuf-c-1.4.0-4.oe2203sp3.x86_64
protobuf-compiler-3.14.0-8.oe2203sp3.x86_64
Complete!
4、编辑 netdata.conf 配置
默认安装配置文件路径,/etc/netdata/netdata.conf
,修改 bind to = 0.0.0.0 #localhost
。
vi /etc/netdata/netdata.conf
...
# netdata configuration
#
# You can get the latest version of this file, using:
#
# netdatacli dumpconfig > /etc/netdata/netdata.conf
#
# You can also download it using:
#
# wget -O /etc/netdata/netdata.conf http://localhost:19999/netdata.conf
# or
# curl -o /etc/netdata/netdata.conf http://localhost:19999/netdata.conf
#
# You can uncomment and change any of the options below.
# The value shown in the commented settings, is the default value.
#
[global]
run as user = netdata
# default storage size - increase for longer data retention
page cache size = 32
dbengine multihost disk space = 256
# some defaults to run netdata with least priority
process scheduling policy = idle
OOM score = 1000
stock config directory = /usr/lib/netdata/conf.d
[web]
web files owner = root
web files group = netdata
# by default do not expose the netdata port
bind to = 0.0.0.0 #localhost
[health]
stock health configuration directory = /usr/lib/netdata/conf.d/health.d
5、启动 netdata 服务
systemctl start netdata
6、查看 netdata 监听端口
netdata
服务启动后,默认端口是 19999
。
[root@euler /]# ss -antp |grep 19999
LISTEN 0 4096 0.0.0.0:19999 0.0.0.0:* users:(("netdata",pid=18360,fd=8))
浏览器查看 netdata 可视化监控页面
- 查看
netdata
宿主机ip
信息
[root@euler /]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:15:5d:00:be:00 brd ff:ff:ff:ff:ff:ff
inet 172.23.57.164/20 brd 172.23.63.255 scope global dynamic noprefixroute eth0
valid_lft 79048sec preferred_lft 79048sec
inet6 fe80::215:5dff:fe00:be00/64 scope link noprefixroute
valid_lft forever preferred_lft forever
- 浏览器输入访问地址,此处
ip-v4
是172.23.57.164
http://172.23.57.164:19999/
显示页面信息如下:
Netdata 和 Other 监控方案对比
1、Netdata vs Prometheus
https://www.netdata.cloud/blog/netdata-vs-prometheus-performance-analysis/
在相同的工作负载下,Netdata
的 CPU
占用率降低了 35%
,内存占用率降低了 49%
,带宽占用率降低了 12%
,磁盘 I/O
占用率降低了 98%
,在高分辨率度量存储上的磁盘空间利用率提高了 75%
,而在 Prometheus
提供 7 天
保留时间的相同磁盘占用率下,Netdata
可提供 超过一年
的总体保留时间。请阅读我们博客中的完整分析。
2、Netdata VS The World
https://www.netdata.cloud/netdata-vs-world/
对比信息如下: