【监控系统】Prometheus监控组件Node-Exporter配置实战

这一节,我们来配置一下Node-Exporter,那么我们先来了解一下什么是Prometheus的Exporter?

任何向Prometheus提供监控样本数据的程序都可以被称为一个Exporter,它是一种用于将不同数据源的指标提供给Prometheus进行收集和监控的工具。运行在应用程序、计算机、网络设备或者其他系统上的代码,它可以将系统的指标信息以一种标准格式公开。将指标数据公开为HTTP端点或者指定的格式(如Redis、JMX等),Prometheus然后可以通过轮询或指定的抓取器。

Exporter是Prometheus的指标数据收集组件,负责从目标Jobs收集数据。并把收集到的数据转换为Prometheus支持的时序数据格式。只负责收集,并不向Server端发送数据,而是等待Prometheus Server 主动抓取。

Prometheus社区以及其他团队开发了大量的Exporter,覆盖了许多不同类型的系统和服务。Node Exporter、MySQL Exporter、Redis Exporter、MongoDB Exporter、Nginx Exporter...

使用方式:在主机上安装了一个 Exporter程序,该程序对外暴露了一个用于获取当前监控样本数据的HTTP访问地址。Prometheus通过轮询的方式定时从这些Target中获取监控数据样本,并且存储在数据库当中。

案例实战-安装部署 **node_exporter **

node_exporter 用于采集类UNIX内核的硬件以及系统指标,包括CPU、内存和磁盘。

下载node_exporter 组件

bash 复制代码
https://prometheus.io/download/
https://github.com/prometheus/node_exporter/releases/download/v1.5.0/node_exporter-1.5.0.linux-amd64.tar.gz

下载安装包到Linux服务器

bash 复制代码
#解压
tar -zxvf node_exporter-1.6.0.linux-amd64.tar.gz

配置启动文件,设置自启动:vi /usr/lib/systemd/system/node_exporter.service

注意:ExecStart配置node_exporter目录下的node_exporter启动器

bash 复制代码
[Unit]
Description=node_exporter
Documentation=https://prometheus.io/
After=network.target
 
[Service]
Type=simple
ExecStart=/usr/local/software/node_exporter/node_exporter \
--collector.ntp \
--collector.mountstats \
--collector.systemd \
--collector.tcpstat
 
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
 
[Install]
WantedBy=multi-user.target

启动node_exporter ,设置开机自启,检查服务启动情况

bash 复制代码
systemctl start node_exporter
 
systemctl enable node_exporter
 
netstat -natp | grep :9100

[root@localhost /]# netstat -natp | grep :9100
tcp6       0      0 :::9100                 :::*                    LISTEN      1390/node_exporter  

通过浏览器访问 http://IP+9100/metrics可以查看到监控信息

Prometheus服务器中添加被监控机器的配置 vim prometheus.yml, target的也可以写ip

yml 复制代码
  - job_name: 'agent-1'
    static_configs:
      - targets: ['ip:9100']

动态更新配置 curl -X POST http://localhost:9090/-/reload

查看Web UI界面的target和configuration是否有对应的数据

Ok,Prometheus监控组件Node-Exporter的实操就结束啦,记得三连➕关注哦!

相关推荐
垂直昵称1 小时前
多线程实现网页接口并发压力测试
linux·服务器·windows
元岳数字人小元2 小时前
数字人开源技术优势解析,助力智能交互普及落地
运维·人工智能·开源·人机交互·交互
JXJD20042 小时前
AI 推理服务器高速连接器线束自动化设备定制指南 全场景互连非标整线方案参考
服务器·人工智能·自动化
王琦03182 小时前
Linux的管理程序
linux·运维·服务器
名字还没想好☜3 小时前
Kubernetes NetworkPolicy 实战:默认全通的坑与用标签做零信任隔离
运维·云原生·容器·kubernetes·networkpolicy
QWEDDRFTG3 小时前
家用服务器供电
服务器
Eloudy3 小时前
给 Linux 加新硬盘的挂载命令
linux·运维·服务器
三言老师3 小时前
ss高效查看网络连接端口实操
linux·运维·服务器·网络
三言老师4 小时前
traceroute路由追踪实操
linux·运维·服务器·网络
Nayxxu4 小时前
Gemini Computer Use 安全清单:浏览器、桌面、移动端自动化怎么控权限
运维·安全·自动化