Prometheus 基于Golang编写,编译后的软件包,不依赖于任何的第三方依赖。只需要
下载对应平台的二进制包,解压并且添加基本的配置即可正常启动Prometheus Server。
Prometheus 下载地址:https://prometheus.io/download/
- [root@ggl203 ~]# tar -zxf prometheus-2.36.2.linux-amd64.tar.gz -C /data/
- [root@ggl203 data]# mv prometheus-2.36.2.linux-amd64/ prometheus-2.36.2
![]()
- [root@ggl203 prometheus-2.36.2]# vim prometheus.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: ["ggl203:9090"]
-
- # clickhouse 跟下面的clickhouse配置相对应
- - job_name: clickhouse
- static_configs:
- - targets: ["ggl203: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://ggl203:9090/metrics 上拉取数据。
[root@ggl203 prometheus-2.36.2]# nohup ./prometheus --config.file=prometheus.yml > ./prometheus.log 2>&1 &

- [root@ggl203 ~]# vim /etc/clickhouse-server/config.xml
-
- <prometheus>
- <endpoint>/metrics</endpoint>
- <port>9363</port>
-
- <metrics>true</metrics>
- <events>true</events>
- <asynchronous_metrics>true</asynchronous_metrics>
- <status_info>true</status_info>
- </prometheus>


service clickhouse-server restart

[root@ggl203 ~]# tar -zxf grafana-enterprise-9.0.0.linux-amd64.tar.gz -C /data/

[root@ggl203 grafana-9.0.0]# nohup ./bin/grafana-server web > ./grafana.log 2>&1 &






添加步骤如下:

