1.Prometheus介绍
prometheus是由谷歌研发的一款开源的监控软件,它通过安装在远程机器上的exporter,通过HTTP协议从远程的机器收集数据并存储在本地的时序数据库上
同时Prometheus后端用 golang语言开发,前端是 Grafana
2.Prometheus源码安装与启动配置
实验环境
192.168.0.223 Prometheus 服务端 centos 7.6
192.168.0.222 node_exporter 客户端 centos 7.6
下载Prometheus版本
[root@localhost ~]# wget https://mirrors.tuna.tsinghua.edu.cn/github-release/prometheus/prometheus/2.39.1%20_%202022-10-07/prometheus-2.39.1.linux-amd64.tar.gz
解压文件prometheus-2.39.1.linux-amd64.tar.gz 到/usr/local目录下
[root@localhost ~]# tar xf prometheus-2.39.1.linux-amd64.tar.gz -C /usr/local
prometheus-2.39.1.linux-amd64改名为prometheus
[root@localhost local]# mv prometheus-2.39.1.linux-amd64 prometheus
查看版本
[root@localhost prometheus]# ./prometheus --version
prometheus.yml 配置
# my global config
global:
# 默认情况下,每15s拉取一次目标采样点数据。
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
# 每15秒评估一次规则。默认值为每1分钟。
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:
# job名称会增加到拉取到的所有采样点上,同时还有一个instance目标服务的host:port标签也会增加到采样点上
- job_name: 'prometheus'
# 覆盖global的采样点,拉取时间间隔5s
scrape_interval: 5s
static_configs:
- targets: ['localhost:9090']
服务启动
指定配置文件启动
[root@localhost prometheus]# ./prometheus --config.file=prometheus.yml
访问:http://192.168.0.223:909/
客户端安装node_exporter
标签:amd64,2.39,prometheus,scrape,Grafana,未完待续,Prometheus,localhost From: https://www.cnblogs.com/QIzhu/p/16825803.html