prometheus安装-监控clickhouse

prometheus官网:https://prometheus.io/
下载地址:https://prometheus.io/download/
prometheus历史github地址:https://github.com/prometheus/prometheus/releases

此处选用:
prometheus-2.26.0.linux-amd64.tar.gz

安装步骤
1.clickhouse的config.xml配置文件打开promethmus注释,重启clickhouse服务器

<prometheus>
    <endpoint>/metrics</endpoint>
    <port>9363</port>

    <metrics>true</metrics>
    <events>true</events>
    <asynchronous_metrics>true</asynchronous_metrics>
    <status_info>true</status_info>
</prometheus>
--重启
clickhouse restart

添加端口,其他服务器节点类似;

firewall-cmd --zone=public --add-port=9363/tcp --permanent
firewall-cmd --reload

ClickHouse 开启 Metrics 服务成功:
http://192.168.189.9:9363/metrics

在这里插入图片描述

2.上传解压prometheus-2.26.0.linux-amd64.tar.gz文件并重命名

tar -zxvf prometheus-2.26.0.linux-amd64.tar.gz
mv prometheus-2.26.0.linux-amd64 promethemus-2.26

3.修改 promethmus.yml文件,#添加 ClickHouse 监控配置,

# 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: ['master:9090']
    
  #添加 ClickHouse 监控配置
  - job_name: clickhouse-master
    static_configs:
    - targets: ['master:9363','slave1:9363','slave2:9363']

备注:
配置说明:

1、global 配置块:控制 Prometheus 服务器的全局配置

➢ scrape_interval:配置拉取数据的时间间隔,默认为 1 分钟。

➢ evaluation_interval:规则验证(生成 alert)的时间间隔,默认为 1 分钟。

2、rule_files 配置块:规则配置文件

3、scrape_configs 配置块:配置采集目标相关, prometheus 监视的目标。Prometheus 自身

的运行信息可以通过 HTTP 访问,所以 Prometheus 可以监控自己的运行数据。

➢ job_name:监控作业的名称

➢ static_configs:表示静态目标配置,就是固定从某个 target 拉取数据

➢ targets : 指 定 监 控 的 目 标 , 其 实 就 是 从 哪 儿 拉 取 数 据 。 Prometheus 会 从

http://master:9090/metrics 上拉取数据。

Prometheus 是可以在运行时自动加载配置的。启动时需要添加:–web.enable-lifecycle
4.启动

cd promethemus-2.26/
nohup ./prometheus --config.file=prometheus.yml > ./prometheus.log 2>&1 &

5.访问页面

http://192.168.189.9:9090/

在这里插入图片描述

如下状态则成功:

在这里插入图片描述

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

superlliuchao

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值