1、简单唠唠node_exporter
ps: 在Prometheus的架构设计中,Prometheus Server并不直接服务监控特定的目标,其主要任务负责数据的收集,存储并且对外提供数据查询支持。因此为了能够能够监控到某些东西,如主机的CPU使用率,我们需要使用到Exporter。Prometheus周期性的从exporter暴露的HTTP服务地址(通常是/metrics)拉取监控样本数据。
从上面的描述中可以看出exporter可以是一个相对开放的概念,其可以是一个独立运行的程序独立于监控目标以外,也可以是直接内置在监控目标中。只要能够向Prometheus提供标准格式的监控样本数据(TS时间序列)即可。
前面都是废话[皮],正题开始。这里为了能够采集到主机的运行指标如CPU, 内存,磁盘等信息。就需要用到node_exporter。
2、下载node_exporter
(1)下载对应操作系统(我的是X86)node_exporter二进制包并解压:
wget https://github.com/prometheus/node_exporter/releases/download/v1.0.1/node_exporter-1.0.1.linux-386.tar.gz
tar -zxf node_exporter-1.0.1.linux-386.tar.gz
(2)运行node_exporter(执行出现下图所示,即大功告成!)
./node_exporter
(3)在浏览器端验证(因为端口(9100)暴露出来了,可以通过浏览器查看采集到的数据)
ps:每一个监控指标之前都会有一段类似于如下形式的信息:
# HELP node_cpu Seconds the cpus spent in each mode.
# TYPE node_cpu counter
node_cpu{cpu="cpu0",mode="idle"} 362812.7890625
# HELP node_load1 1m load average.
# TYPE node_load1 gauge
node_load1 3.0703125
HELP: 解释当前指标的含义
TYPE: 说明当前指标的数据类型
(4)监控指标说明(每个版本对应的指标不一样,但核心含义没变多少)
node_boot_time: 系统启动时间
node_cpu: 系统CUP使用情况
node_disk_*: 磁盘io
node_filesystem_*: 文件系统使用量
node_load1: 系统负载
node_memeory_*: 系统内存使用量
node_network_*: 网络宽带
node_time: 当前系统时间
go_*: node exporter中go相关指标
*process_ :**node exporter自身进程相关指标