Prometheus(一)之基础安装

13 篇文章 0 订阅
3 篇文章 0 订阅


promethus-header

一、准备条件

Windows10

go1.15.1.windows-amd64

二、下载与安装

1、下载

Download | Prometheus,依据需求选择对应版本的包,此处选择 Windows对应版本 amd64

Prometheus-Download

2、解压文件

解压到目标安装目录,此处为D:\ProgramData\prometheus-2.23.0-rc,解压之后,目录结构如下:

    <DIR>          consoles
    <DIR>          console_libraries
            11,357 LICENSE
             3,420 NOTICE
        89,340,928 prometheus.exe
               926 prometheus.yml
        79,250,432 promtool.exe

3、修改配置

解压路径中的配置文件为prometheus.yml,系统默认的数据存储方式为文件形式,存储在与执行程序prometheus.exe同目录下的data文件夹中,可以通过指令--storage.tsdb.path="data/"进行数据存储路径的设置。

# my global config
global:
  scrape_interval:     15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
  # scrape_timeout is set to the global default (10s).

# Alertmanager configuration
alerting:
  alertmanagers:
  - static_configs:
    - targets:
      # - alertmanager:9093

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
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']

4、运行访问

cmd 中启动 prometheus.exe ,可看到如下输出:

level=info ts=2020-11-26T10:36:59.027Z caller=head.go:722 component=tsdb msg="WAL replay completed" checkpoint_replay_duration=0s wal_replay_duration=996.2µs total_replay_duration=1.9937ms
level=info ts=2020-11-26T10:36:59.028Z caller=main.go:742 fs_type=unknown
level=info ts=2020-11-26T10:36:59.028Z caller=main.go:745 msg="TSDB started"
level=info ts=2020-11-26T10:36:59.028Z caller=main.go:871 msg="Loading configuration file" filename=prometheus.yml
level=info ts=2020-11-26T10:36:59.040Z caller=main.go:902 msg="Completed loading of configuration file" filename=prometheus.yml totalDuration=11.9662ms remote_storage=0s web_handler=0s query_engine=0s scrape=10.969ms scrape_sd=0s notify=0s notify_sd=0s rules=0s
level=info ts=2020-11-26T10:36:59.040Z caller=main.go:694 msg="Server is ready to receive web requests."

执行成功后访问http://localhost:9090/能够出现对应页面,则表示访问成功。

Prometheus-Server

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值