node_exporter 部署


- 下载地址

https://github.com/prometheus/node_exporter/releases

- 启动

为了方便辨认 我更改了它的端口,并编了./start.sh./stop.sh两个脚本方便以后启动,语句如下:

vim ./start.sh

nohup ./node_exporter > ./startlog.log 2>&1 &

vim ./stop.sh

#!/bin/sh
echo "stop"
#!/bin/bash

PID=$(ps -ef | grep node_exporter | grep -v grep | awk '{ print $2 }')
if [ "${PID}" ]
then
    echo 'Application is stpping...'
    echo kill $PID DONE
    kill $PID
else
    echo 'Application is already stopped...'
fi

- 配置prometheus

scrape_configs:
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: "prometheus"
    static_configs:
      - targets: ["127.0.0.1:9090"]
        #labels:
          #instance: prometheus

  - job_name: node_self
    static_configs:
      - targets: ['127.0.0.1:9100']
        #labels:
          #instance: node_self

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/ruisasaki/article/details/130725858