前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >1.安装

1.安装

作者头像
晓晨
发布2022-05-07 19:08:29
2600
发布2022-05-07 19:08:29
举报
文章被收录于专栏:晓晨的专栏晓晨的专栏

官方文档 https://prometheus.io/docs/introduction/first_steps/

中文文档 https://prometheus.fuckcloudnative.io/di-yi-zhang-jie-shao/overview

安装文档:https://prometheus.fuckcloudnative.io/di-san-zhang-prometheus/di-2-jie-an-zhuang/installation

1.安装

下载二进制文件:https://github.com/prometheus/prometheus/releases

代码语言:javascript
复制
cd ~
mkdir prometheus
cd prometheus

wget https://github.com/prometheus/prometheus/releases/download/v2.34.0/prometheus-2.34.0.linux-amd64.tar.gz
tar -xzvf prometheus*
cd prometheus-2.34.0.linux-amd64 

./prometheus -h 

2.运行

代码语言:javascript
复制
./prometheus --config.file=prometheus.yml

访问 http://localhost:9090/targets

prometheus 默认配置会采集自身运行的数据,看上图是正常运行的

3.配置

默认配置

代码语言:javascript
复制
# 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"]

prometheus 采集数据是采用 pull 模型,它会定时去拉取目标的数据,在这里被称为 job,我们需要让 prometheus 采集我们的数据,就需要配置对应的 job。

global 代表全局配置,我们可以在需要的 job 里覆盖全局配置,如果未指定相应配置,那么默认使用全局配置。 scrape_interval 指 prometheus 采集数据的间隔时间 evaluation_interval prometheus 解析报警规则的间隔时间 alerting 报警配置 rule_files 警告规则 scrape_configs 采集数据 job 配置

详细的配置说明请查看文档。

定义采集 job

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2022-04-02,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 1.安装
  • 2.运行
  • 3.配置
    • 定义采集 job
    相关产品与服务
    Prometheus 监控服务
    Prometheus 监控服务(TencentCloud Managed Service for Prometheus,TMP)是基于开源 Prometheus 构建的高可用、全托管的服务,与腾讯云容器服务(TKE)高度集成,兼容开源生态丰富多样的应用组件,结合腾讯云可观测平台-告警管理和 Prometheus Alertmanager 能力,为您提供免搭建的高效运维能力,减少开发及运维成本。
    领券
    问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档