Prometheus Node_exporter 之 Basic CPU / Mem Graph

Posted qianyuliang

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Prometheus Node_exporter 之 Basic CPU / Mem Graph相关的知识,希望对你有一定的参考价值。

1. CPU Basic cpu 的基本信息 /proc/stat

type: Graph
Unit: short
Busy System: cpu 处于核心态的占比

metrics:

sum by (instance)(rate(node_cpu_seconds_total{mode="system",instance=~"$node:$port",job=~"$job"}[5m])) * 100


Busy User: cpu 处于用户态的占比

metrics:

sum by (instance)(rate(node_cpu_seconds_total{mode=‘user‘,instance=~"$node:$port",job=~"$job"}[5m])) * 100


Busy Iowait: cpu 处于 io 等待的时间占比

metrics:

sum by (instance)(rate(node_cpu_seconds_total{mode=‘iowait‘,instance=~"$node:$port",job=~"$job"}[5m])) * 100


Busy IRQs: cpu 处于中断状态占比

metrics:

sum by (instance)(rate(node_cpu_seconds_total{mode=~".*irq",instance=~"$node:$port",job=~"$job"}[5m])) * 100


Idle: cpu 处于空闲状态占比

metrics:

sum by (mode)(rate(node_cpu_seconds_total{mode=‘idle‘,instance=~"$node:$port",job=~"$job"}[5m])) * 100


Busy Other: cpu 处于其他状态占比(非系统状态、非用户态、非io等待状态、非空闲态、非中断状态)

metrics:

sum (rate(node_cpu_seconds_total{mode!=‘idle‘,mode!=‘user‘,mode!=‘system‘,mode!=‘iowait‘,mode!=‘irq‘,mode!=‘softirq‘,instance=~"$node:$port",job=~"$job"}[5m])) * 100


2. Memory Basic 内存基本信息


type: Graph
Unit: short
RAM Total: 内存大小

metrics:

node_memory_MemTotal_bytes{instance=~"$node:$port",job=~"$job"}


RAM Used: 已使用的内存大小(内存总量-空闲的内存大小-Buffer缓存和Cached缓存占的内存大小)

metrics:

node_memory_MemTotal_bytes{instance=~"$node:$port",job=~"$job"} - node_memory_MemFree_bytes{instance=~"$node:$port",job=~"$job"} - (node_memory_Cached_bytes{instance=~"$node:$port",job=~"$job"} + node_memory_Buffers_bytes{instance=~"$node:$port",job=~"$job"})


RAM Cache + Buffer: Cached缓存占的内存大小

metrics:

node_memory_Cached_bytes{instance=~"$node:$port",job=~"$job"} + node_memory_Buffers_bytes{instance=~"$node:$port",job=~"$job"}


RAM Free: 空闲的内存大小

metrics:

node_memory_MemFree_bytes{instance=~"$node:$port",job=~"$job"}


SWAP Used: 已使用的交换内存的大小

metrics:

(node_memory_SwapTotal_bytes{instance=~"$node:$port",job=~"$job"} - node_memory_SwapFree_bytes{instance=~"$node:$port",job=~"$job"})
交换分区的总大小- 空闲大小

 

以上是关于Prometheus Node_exporter 之 Basic CPU / Mem Graph的主要内容,如果未能解决你的问题,请参考以下文章

grafana+prometheus+node_exporter+linux

Prometheus+node_exporter+grafana

Prometheus node_exporter设置开机启动服务

prometheus+node_exporter监控系统搭建

Prometheus客户端节点监控node_exporter

Prometheus Node_exporter