您当前的位置: 首页 > 慢生活 > 程序人生 网站首页程序人生
普罗米修斯(prometheus)搭建
发布时间:2022-11-14 22:02:08编辑:雪饮阅读()
官网找到适合你的环境的prometheus
https://github.com/prometheus/prometheus/releases/tag/v2.37.2
比如我这里使用的就是prometheus-2.37.2.linux-amd64.tar.gz
解压后直接进入其目录运行
[root@localhost prometheus-2.37.2.linux-amd64]# ./prometheus --config.file=prometheus.yml
看其默认配置文件就知道默认监听在9090端口上
[root@localhost prometheus-2.37.2.linux-amd64]# cat prometheus.yml
# 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后就可以在浏览器中访问了,如:
http://192.168.178.128:9090/
进入status=》targets中
看到这里prometheus的state是up状态就是ok的。
有一个奇怪的问题,看其配置文件中,监听在localhost:9090上,但是我这里物理机也可以访问,也或许是因为我虚拟机里面是用的nat网络吧(共享物理主机ip?)。
关键字词:普罗米修斯,prometheus,搭建