首先在Linux系统上安装一个探测器node explorer, 下载地址https://prometheus.io/docs/gu...node
这个探测器会按期将linux系统的各项硬件指标和内核参数经过9100端口和url metrics暴露给外部。linux
启动node explorer,显示在9100端口上监听:浏览器
浏览器里输入hostname:9100/metrics就能够访问到node explorer收集到的各项参数:服务器
一些例子:ide
CPU在不一样工做模式下的使用时间:node_cpu_seconds_totalui
文件系统可用字节数:node_filesystem_avail_bytesurl
网卡收到的字节数:node_network_receive_bytes_totalspa
下面用Prometheus来收集和展现经过node explorer暴露出来的数据。3d
在Prometheus安装目录的prometheus.yml文件里定义一个job,指向Linux系统上运行的node explorer:blog
本地启动Prometheus,打开下面的url:
http://localhost:9090/
输入node_cpu_seconds_total{mode="system"},查询该服务器上全部CPU工做在系统态消耗的时间:
还能够指定时间窗口,只查询过去1分钟以内的CPU运行数据:
rate(node_cpu_seconds_total{mode="system"}[1m])
要获取更多Jerry的原创文章,请关注公众号"汪子熙":