导语:今天重新学习了一下prometheus发现 node_exporter中的有些参数比较好用。如以下2个参数

–collector.systemd 可用于监控系统服务

–collector.vmstat.fields=^(oom_kill|pgpg|pswp|nr|pg.fault). 我看中这个oom

1.0.1 版本的node_exporter 是这样的

--collector.systemd.unit-whitelist=".+"
                                Regexp of systemd units to whitelist. Units must both match whitelist and not match blacklist to be included.

启动命令如下

ExecStart=/srv/prometheus/node_exporter/node_exporter --web.listen-address=:9100 --collector.systemd --collector.systemd.unit-whitelist=(docker|sshd|nginx).service

1.1.2或者最新版本

不适用–collector.systemd.unit-whitelist 命令调整过了

 --collector.systemd.unit-include=".+"
                                 Regexp of systemd units to include. Units must both match include and not match exclude to be included.

升级之后用老配置报错如下

调整过后 docker4为新版本 docker5为老版本 均可以收集

关于vmstat选项的解释 可参考下面博客。

https://blog.csdn.net/dixu7849/article/details/102224090

看了下监控项似乎没有oom,并且数据没拿到。查阅资料发现有内核版本要求centos8 才有

https://www.gitmemory.com/issue/prometheus/node_exporter/1791/662532043

centos7.8没有oom_kill

如果做成systemd可以添加如下参数 限制资源使用

CPUQuota=150%        # 150% cpu 使用率 需要的可以启动设置内存
MemoryLimit=5G       # 5G 内存
Logo

开源、云原生的融合云平台

更多推荐