1.下载安装包

下载|普罗 米修斯 (prometheus.io)

2.安装

进入linux里在/opt/下创建prometheus目录,将prometheus压缩包通过XShell或XFTP拖入prometheus目录。

tar -zxvf prometheus-2.34.0.linux-amd64.tar.gz

3.设置配置文件

进入解压后的目录

vim prometheus.yml

# my global config
global:
  scrape_interval:     15s # (设置抓取(pull)时间间隔,默认是1分钟)
  evaluation_interval: 15s # (设置rules评估时间间隔,默认是1分钟)
  # scrape_timeout is set to the global default (10s).

#(告警管理配置,无特殊需要默认就行)
alerting:
  alertmanagers:
  - static_configs:
    - targets:
      # - alertmanager:9093

#加载rules,并根据设置的时间间隔定期评估,无特殊需要默认就行
rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"

# (监控目标配置):
# (默认只有普罗米修斯自己的监控).
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: 'prometheus'

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
    - targets: ['localhost:9090']

可以在scrape_configs配置中配置监控任务

4.运行

./prometheus

5.查看网页
默认监听端口是9090
localhost:9090访问
 

 

Logo

更多推荐