安利一款免费、开源、实时的服务器监控工具:Netdata
itomcoil 2025-05-14 14:05 11 浏览
Netdata 是一个免费、开源、实时的服务器监控工具,可以可视化和监控实时数据,如 CPU 使用率、RAM 使用率、负载、SWAP 使用率、带宽使用率、磁盘使用率等。它可以帮助系统管理员了解您的系统或应用程序中正在发生的事情以及刚刚发生的事情。它可以安装在任何物理服务器、虚拟机、容器和物联网设备上。它提供了一个交互式 Web 界面来查看您的服务器指标,并支持用于持久存储的各种数据存储。
在本教程中,我们将向您展示如何在 Alma Linux 8 上安装 Netdata 监控工具。
先决条件
- 运行 Alma Linux 8 的服务器。
- 使用您的服务器 IP 指向的有效域名。
- 在服务器上配置了 root 密码。
安装所需的依赖项
首先,您需要安装 EPEL 存储库和安装 Netdata 所需的其他依赖项,您可以通过运行以下命令来安装所有这些:
dnf install epel-release -y
dnf install git libuuid-devel autoconf automake pkgconfig zlib-devel curl findutils libmnl gcc make -y
安装完所有软件包后,您可以继续下一步。
安装网络数据
默认情况下,Netdata 不包含在 Alma Linux 默认存储库中。因此,您需要从源代码安装它。
首先,使用以下命令从 Git 存储库下载最新版本的 Netdata:
git clone --recurse-submodules https://github.com/netdata/netdata.git --depth=100
下载完成后,将目录更改为 netdata 并使用以下命令安装所有必需的依赖项:
cd
netdata ./packaging/installer/install-required-packages.sh --non-interactive --dont-wait netdata
接下来,使用以下命令安装其他软件包:
dnf --enablerepo=powertools install libuv-devel
接下来,运行 Netdata 安装脚本开始安装。
./netdata-installer.sh
您将获得以下输出:
--- real-time performance monitoring, done right! ---
You are about to build and install netdata to your system.
The build process will use /tmp for
any temporary files. You can override this by setting $TMPDIR to a
writable directory where you can execute files.
It will be installed at these locations:
- the daemon at /usr/sbin/netdata
- config files in /etc/netdata
- web files in /usr/share/netdata
- plugins in /usr/libexec/netdata
- cache files in /var/cache/netdata
- db files in /var/lib/netdata
- log files in /var/log/netdata
- pid file at /var/run/netdata.pid
- logrotate file at /etc/logrotate.d/netdata
This installer allows you to change the installation path.
Press Control-C and run the same command with --help for help.
NOTE:
Anonymous usage stats will be collected and sent to Netdata.
To opt-out, pass --disable-telemetry option to the installer or export
the environment variable DISABLE_TELEMETRY to a non-zero or non-empty value
(e.g: export DISABLE_TELEMETRY=1).
Press ENTER to build and install netdata to your system >
按 Enter 键将 Netdata 安装到您的系统。安装 Netdata 后,您将获得以下输出:
将 netdata.tarball.checksum 设置为“new_installation”
Setting netdata.tarball.checksum to 'new_installation'
--- We are done! ---
^
|.-. .-. .-. .-. .-. . netdata .-. .-. .-. .-. .-. .-
| '-' '-' '-' '-' '-' '-' '-' '-' '-' '-'
+----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+--->
--- is installed and running now! ---
enjoy real-time performance and health monitoring...
systemctl start netdata
systemctl enable netdata
您现在可以使用以下命令检查 Netdata 的状态。
systemctl status netdata
您将获得以下输出:
? netdata.service - Real time performance monitoring
Loaded: loaded (/usr/lib/systemd/system/netdata.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2022-03-19 04:22:22 UTC; 4min 16s ago
Main PID: 58935 (netdata)
Tasks: 50 (limit: 11412)
Memory: 103.1M
CGroup: /system.slice/netdata.service
??58935 /usr/sbin/netdata -P /var/run/netdata/netdata.pid -D
??58938 /usr/sbin/netdata --special-spawn-server
??59063 /usr/libexec/netdata/plugins.d/apps.plugin 1
??59064 /usr/libexec/netdata/plugins.d/ebpf.plugin 1
??59065 /usr/libexec/netdata/plugins.d/go.d.plugin 1
Mar 19 04:22:22 linux systemd[1]: Starting Real time performance monitoring...
Mar 19 04:22:22 linux systemd[1]: Started Real time performance monitoring.
Mar 19 04:22:22 linux netdata[58935]: CONFIG: cannot load cloud config '/var/lib/netdata/cloud.d/cloud.conf'. Running with internal defaults.
Mar 19 04:22:22 linux netdata[58935]: 2022-03-19 04:22:22: netdata INFO : MAIN : CONFIG: cannot load cloud config '/var/lib/netdata/cloud.d/>
Mar 19 04:22:22 linux netdata[58935]: 2022-03-19 04:22:22: netdata INFO : MAIN : Found 0 legacy dbengines, setting multidb diskspace to 256MB
Mar 19 04:22:22 linux netdata[58935]: 2022-03-19 04:22:22: netdata INFO : MAIN : Created file '/var/lib/netdata/dbengine_multihost_size' to >
Mar 19 04:22:22 linux netdata[58935]: Found 0 legacy dbengines, setting multidb diskspace to 256MB
Mar 19 04:22:22 linux netdata[58935]: Created file '/var/lib/netdata/dbengine_multihost_size' to store the computed value
Mar 19 04:22:23 linux ebpf.plugin[59064]: Does not have a configuration file inside `/etc/netdata/ebpf.d.conf. It will try to load stock file.
Mar 19 04:22:23 linux ebpf.plugin[59064]: Cannot read process groups configuration file '/etc/netdata/apps_groups.conf'. Will try '/usr/lib/n>
此时,Netdata 正在运行并监听 19999 端口。您可以使用以下命令检查它:
ss -antpl | grep netdata
您将获得以下输出:
LISTEN 0 128 127.0.0.1:8125 0.0.0.0:* users:(("netdata",pid=58935,fd=29))
LISTEN 0 128 0.0.0.0:19999 0.0.0.0:* users:(("netdata",pid=58935,fd=6))
LISTEN 0 128 [::1]:8125 [::]:* users:(("netdata",pid=58935,fd=28))
LISTEN 0 128 [::]:19999 [::]:* users:(("netdata",pid=58935,fd=7))
完成后,您可以继续下一步。
配置防火墙
如果您在系统上使用 firewalld 防火墙,那么您需要允许端口19999和80通过 firewalld。您可以使用以下命令允许它们:
firewall-cmd --permanent --add-port=19999/tcp
firewall-cmd --permanent --add-port=80/tcp
接下来,重新加载 firewalld 守护进程以应用更改:
firewall-cmd --reload
完成后,您可以继续下一步。
将 Nginx 配置为 Netdata 的反向代理
将 Nginx 安装和配置为反向代理以访问 Netdata 始终是一个好主意。首先,使用以下命令安装 Nginx 服务器:
dnf install nginx httpd-tools -y
接下来,使用以下命令生成密码文件:
htpasswd -c /etc/nginx/.htpasswd netadmin
设置您的管理员密码,如下所示:
New password:
Re-type new password:
Adding password for user netadmin
接下来,使用以下命令创建一个 Nginx 虚拟主机配置文件:
nano /etc/nginx/conf.d/netdata.conf
添加以下行:
upstream backend {
server 127.0.0.1:19999;
keepalive 64;
}
server {
listen 80;
server_name netdata.example.com;
location / {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://backend;
proxy_http_version 1.1;
proxy_pass_request_headers on;
proxy_set_header Connection "keep-alive";
proxy_store off;
auth_basic "Private Property";
auth_basic_user_file /etc/nginx/.htpasswd;
}
}
保存并关闭文件,然后验证 Nginx 是否存在任何语法配置错误:
nginx -t
如果一切正常,您将获得以下输出:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
接下来,重新启动 Nginx 服务以应用配置更改:
systemctl restart nginx
您还可以使用以下命令检查 Nginx 状态:
systemctl status nginx
您应该看到以下输出:
? nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
Active: active (running) since Sat 2022-03-19 04:28:44 UTC; 4s ago
Process: 61706 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS)
Process: 61705 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
Process: 61703 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)
Main PID: 61708 (nginx)
Tasks: 2 (limit: 11412)
Memory: 3.7M
CGroup: /system.slice/nginx.service
??61708 nginx: master process /usr/sbin/nginx
??61709 nginx: worker process
Mar 19 04:28:44 linux systemd[1]: Starting The nginx HTTP and reverse proxy server...
Mar 19 04:28:44 linux nginx[61705]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
Mar 19 04:28:44 linux nginx[61705]: nginx: configuration file /etc/nginx/nginx.conf test is successful
Mar 19 04:28:44 linux systemd[1]: nginx.service: Failed to parse PID from file /run/nginx.pid: Invalid argument
Mar 19 04:28:44 linux systemd[1]: Started The nginx HTTP and reverse proxy server.
完成后,您可以继续下一步。
访问网络数据仪表板
现在,打开您的 Web 浏览器并使用 URL http://your-server-ip 访问 Netdata 仪表板。您应该看到 Netdata 登录页面:
提供您的管理员用户名、密码,然后单击登录按钮。您应该在以下页面上看到 Netdata 仪表板:
结论
恭喜!您已在 Alma Linux 8 上成功安装了 Netdata 监控工具。您现在可以从 Netdata 仪表板开始实时监控您的服务器矩阵,如果您有任何问题,请随时问我。
相关推荐
- MariaDB开窗函数(开窗函数max)
-
在使用GROUPBY子句时,总是需要将筛选的所有数据进行分组操作,它的分组作用域是整张表。分组以后,为每个组只返回一行。而使用基于窗口的操作,类似于分组,但却可以对这些"组"(即窗口...
- 你还不知道什么是MySQL窗口函数?(mysql5.7窗口函数)
-
MySQL中的窗口函数是一类用来在某一部分查询结果上进行计算的函数,这些函数的用法与普通的聚合函数如SUM、AVG、COUNT类似,但是与聚合函数不同的是,窗口函数不会讲多行数据合并成一行结果,而是...
- 精通88道题包你面试通过BAT-精简版-不得不收藏!
-
J2SE基础1.九种基本数据类型的大小,以及他们的封装类。2.Switch能否用string做参数?3.equals与==的区别。4.Object有哪些公用方法?5.Java的四种引用,强弱...
- Transact-SQL学习笔记21——排名窗口函数
-
将OVER()子句和排名函数连用,就是排名窗口函数,它们只能用在SELECT子句或ORDERBY子句之后。如果放在SELECT之后,它运行的逻顺序在DISTINCT之前。逻辑处理顺序如下:SE...
- MySQL8 窗口函数是真的省事!(mysql中的窗口函数)
-
@[toc]MySQL9已经出来了,MySQL8相信也慢慢走进各位小伙伴的工作中了。MySQL8还是有很多重量级变化的,一些底层优化大家在使用中有时候不易察觉,但是有一些用法,还是带给我们耳目一...
- Lodash 这 20 个方法,既高级又超级实用!
-
一、安全操作篇1._.get:防御性取值2._.set:智能路径赋值3._.invoke:安全方法调用二、集合处理篇4._.keyBy:快速对象映射5._.orderBy:多条件排序6._...
- Oracle有哪些常见的函数?(oracle常用函数有哪些)
-
恢复删除的数据insertinto'表名'select*from'表名'asofTIMESTAMPTO_TIMESTAMP("当前时间...
- excel的高级用法——宏,原来如此实用
-
使用excel时,直接手动计算或者输入公式,你会感到很苦恼或者操作很繁琐,如果使用vba直接输出结果,虽然效率很高,但是不够直观。excel宏最方便的用法是作为公式里的函数使用,打开宏编辑器,编写一个...
- 7 RDD常用算子(2)(rd算法)
-
filter()deffilter(f:T=>Boolean):RDD[T]函数说明将数据根据指定的规则进行筛选过滤,符合规则的数据保留,不符合规则的数据丢弃。当数据进行筛选过滤后,分...
- 从零开始学SQL进阶,数据分析师必备SQL取数技巧,建议收藏
-
上一节给大家讲到SQL取数的一些基本内容,包含SQL简单查询与高级查询,需要复习相关知识的同学可以跳转至上一节,本节给大家讲解SQL的进阶应用,在实际过程中用途比较多的子查询与窗口函数,下面一起学习。...
- SQL窗口函数知多少?(sql窗口怎么执行)
-
我们在日常工作中是否经常会遇到需要排名的情况,比如:每个部门按业绩来排名,每人按绩效排名,对部门销售业绩前N名的进行奖励等。面对这类需求,我们就需要使用sql的高级功能——窗口函数。一、什么是窗口函数...
- SQL开窗函数讲解,让查询统计更简单
-
用了这么多关系型数据库产品,开源的商业的,如:Oracle、MySql(注意5.7以上版本才可以使用)、SqlServer、postgreSQL。如果从应用角度来看,谁都逃离不了增删改查;而查又是难点...
- mysql窗口函数(mysql窗口函数rank)
-
MySQL窗口函数是一种高级的SQL函数,它可以进行一些比较复杂的数据分析和处理。与传统的聚合函数不同,窗口函数不会合并行,而是根据特定的条件为每行分配一个值。MySQL窗口函数可以用来计算每...
- 一文讲懂SQL窗口函数 大厂必考知识点
-
大家好,我是宁一。今天是我们的第24课:窗口函数。窗口函数,也叫OLAP(OnlineAnallyticalProcessing,联机分析处理),可以对数据库数据进行实时分析处理。窗口函数是数据分...
- C++20 四大特性之一:Module 特性详解
-
C++20最大的特性是什么?最大的特性是迄今为止没有哪一款编译器完全实现了所有特性。文章来源:网易云信有人认为C++20是C++11以来最大的一次改动,甚至比C++11还要大。本文仅介绍...
- 一周热门
- 最近发表
- 标签列表
-
- ps图案在哪里 (33)
- super().__init__ (33)
- python 获取日期 (34)
- 0xa (36)
- super().__init__()详解 (33)
- python安装包在哪里找 (33)
- linux查看python版本信息 (35)
- python怎么改成中文 (35)
- php文件怎么在浏览器运行 (33)
- eval在python中的意思 (33)
- python安装opencv库 (35)
- python div (34)
- sticky css (33)
- python中random.randint()函数 (34)
- python去掉字符串中的指定字符 (33)
- python入门经典100题 (34)
- anaconda安装路径 (34)
- yield和return的区别 (33)
- 1到10的阶乘之和是多少 (35)
- python安装sklearn库 (33)
- dom和bom区别 (33)
- js 替换指定位置的字符 (33)
- python判断元素是否存在 (33)
- sorted key (33)
- shutil.copy() (33)