Prometheus插件安装之node_exporter

新增文件:

touch /etc/systemd/system/node_exporter.service
文件内容如下:

 
[Unit]
Description=Prometheus node_exporter
[Service]
User=nobody
ExecStart=/usr/local/bin/node_exporter --log.level=error
ExecStop=/usr/bin/killall node_exporter
MemoryLimit=300M #限制内存使用最多300M
CPUQuota=100% #限制CPU使用最多一个核
 
[Install]
WantedBy=default.target
生效服务:

systemctl daemon-reload
systemctl enable node_exporter.service
systemctl start  node_exporter.service
资源限制说明:

1. CPU:node_exporter 启动一个http服务,当请求metrics返回的数据比较多的时候,会消耗一定的cpu,通过systemd的CPUQuota限制cpu的使用

未进行限制前,可以跑满单个核心:

限制后只能使用CPU的20%(参数设置为CPUQuota=20%)

2. 内存:node_exporter 对指标收集的时候会消耗一定的内存,通过systemd的MemoryLimit限制内存的使用, 内存占用超限是发生OOM 参数验证: 内存超限的时候发生OOM

3. 硬盘:node_exporter 默认通过系统rsyslog的日志级别写入messages日志,可以通过调节日志级别--log.level=error 来减少磁盘的消耗
 

转载于:https://my.oschina.net/yunxiaobai/blog/2967521

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值