【监控系统】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 小时前
使用ACME自动签发SSL 证书
服务器·网络协议·ssl
Murphy_lx1 小时前
Linux系统--信号(4--信号捕捉、信号递达)陌生概念篇
linux·运维·服务器
weixin_405023371 小时前
使用docker 安装部署easy-mock
运维·docker·容器
Asuncion0071 小时前
Docker核心揭秘:轻量级虚拟化的革命
服务器·开发语言·docker·云原生
ZLRRLZ1 小时前
【Docker】Docker Image(镜像)
运维·docker·容器
焱焱枫2 小时前
Linux疑难杂症诊断利器:深入解析 fuser 命令
linux·运维·服务器
Andya_net2 小时前
Java | 基于redis实现分布式批量设置各个数据中心的服务器配置方案设计和代码实践
java·服务器·分布式
博语小屋2 小时前
Linux进程信号(壹)_产生信号
linux·运维·服务器
元亓亓亓2 小时前
考研408--计算机网络--day1-概念&组成功能&三种交换技术&分类
服务器·计算机网络·考研
养海绵宝宝的小蜗3 小时前
Linux 例行性工作任务(定时任务)知识点总结
linux·运维·服务器