首先在Linux系统上安装一个检测器nodeexplorer,下载地址https://prometheus.io/docs/gu...这个检测器会定时更新检测器nodeexplorerLinux系统硬件指标和内核参数通过9100端口和urlmetrics对外暴露。启动nodeexplorer,在9100端口显示:在浏览器中输入hostname:9100/metrics可以访问nodeexplorer收集的各种参数:一些例子:不同工作模式下的CPU使用时间:node_cpu_seconds_total文件系统可用字节数:node_filesystem_avail_bytes的网卡接收到的字节数:node_network_receive_bytes_total接下来使用Prometheus收集并展示通过nodeexplorer暴露的数据。在Prometheus安装目录的prometheus.yml文件中定义一个job,指向Linux系统上运行的nodeexplorer:在本地启动Prometheus,打开如下url:http://localhost:9090/输入node_cpu_seconds_total{mode="system"},查询系统模式下服务器所有CPU消耗的时间:也可以指定一个时间窗口,只查询过去1分钟内的CPU运行数据:rate(node_cpu_seconds_total{mode="system"}[1m])获取更多Jerry原创文章,请关注公众号“王子熙”:
