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"})
交换分区的总大小- 空闲大小

 

posted @ 2019-03-05 20:48  浅雨凉  阅读(1619)  评论(0编辑  收藏  举报