promethues安装

prometheus

1. 下载安装

wget https://github.com/prometheus/prometheus/releases/download/v2.9.2/prometheus-2.9.2.linux-amd64.tar.gz
tar -xvzf prometheus-2.9.2.linux-amd64.tar.gz
cd prometheus-2.9.2.linux-amd64
  • 修改prometheus.yml(如果有自己实现的api)
vim prometheus.yml

#在最后加入如下配置
  - job_name: 'metrics_test'
    scrape_interval:     3s
    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
    - targets: ['192.168.163.1:22222']

2. 启动

#直接启动
./prometheus --config.file="prometheus.yml"
#后台启动
nohup ./prometheus --config.file="prometheus.yml" >/dev/null 2>&1 &

打开浏览器,输入IP+端口,9090为prometheus的默认侦听端口。

原文地址:https://www.cnblogs.com/ttzzyy/p/11276937.html