【监控系统】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的实操就结束啦,记得三连➕关注哦!

相关推荐
南瓜胖胖33 分钟前
【seismic unix 合并两个su文件】
服务器·unix
weixin_399380691 小时前
k8s一键部署tongweb企业版7049m6(by why+lqw)
java·linux·运维·服务器·云原生·容器·kubernetes
阿巴~阿巴~1 小时前
Linux基本命令篇 —— uname命令
linux·运维·服务器
天空之城夢主2 小时前
KVM高级功能部署
linux·服务器
IT成长日记2 小时前
【Docker基础】Docker数据卷管理:docker volume ls及其参数详解
运维·docker·容器·volume ls
zkmall3 小时前
企业电商解决方案哪家好?ZKmall模块商城全渠道支持 + 定制化服务更省心
大数据·运维·重构·架构·开源
云资源服务商5 小时前
解锁阿里云日志服务SLS:云时代的日志管理利器
服务器·阿里云·云计算
绝不偷吃5 小时前
ELK日志分析系统
运维·elk·jenkins
朱包林6 小时前
day45-nginx复杂跳转与https
linux·运维·服务器·网络·云计算
孙克旭_6 小时前
day045-nginx跳转功能补充与https
linux·运维·nginx·https