Prometheus安装配置
Prometheus下载地址
官方地址:Download | Prometheus
可根据系统版本下载想要的安装包,复制链接地址


wget https://github.com/prometheus/prometheus/releases/download/v2.33.3/prometheus-2.33.3.linux-amd64.tar.gzwg
解压prometheus文件

解压命令:
tar xvfz prometheus-2.33.0.linux-amd64.tar.gz

修改文件夹命令:
mv prometheus-2.33.3.linux-amd64 prometheus
配置prometheus.ym文件连接exporter

编辑prometheus.yml文件:
vi prometheus.yml

添加配置文件:- job_name: "reid_agent"                 //自定义redis探针的名称static_configs:- targets: ["172.26.94.74:9121"]    //redis_exporter的服务器地址和端口。 
启动Prometheus
./prometheus --config.file=prometheus.yml
进入到prometheus目录启动prometheus

注意:如果访问不了,需要查看一下是是否开启防火墙,可将防火墙停止后访问正常。
访问管理页面

http://172.26.93.221:9090/graph?g0.expr=&g0.tab=1&g0.stacked=0&g0.show_exemplars=0&g0.range_input=1h
Grafana安装配置
Grafana下载地址
下载地址
Download Grafana | Grafana LabsOverview of how to download and install different versions of Grafana on different operating systems.
https://grafana.com/grafana/download?pg=get&plcmt=selfmanaged-box1-cta1


下载命令
wget https://dl.grafana.com/oss/release/grafana-8.4.1-1.x86_64.rpm
https://dl.grafana.com/oss/release/grafana-8.4.1-1.x86_64.rpm
解压grafana

解压命令:
tar xvfz grafana-8.4.1.linux-amd64.tar.gz

修改文件夹命令:
mv grafana-8.4.1 grafana
启动grafana


启动命令:
./grafana-server
访问grafana
http://172.26.93.221:3000/login

修改密码:

密码:sa123456
连接prometheus




Grafana监控prometheus的exporter仪表盘模板
Dashboards | Grafana LabsBrowse a library of official and community-built dashboards.
https://grafana.com/grafana/dashboards/

Grafana监控redis仪表盘模板

 


Redis Exporter安装配置
下载exporter地址
Exporter下载地址
Exporters and integrations | PrometheusAn open-source monitoring system with a dimensional data model, flexible query language, efficient time series database and modern alerting approach.
https://prometheus.io/docs/instrumenting/exporters/
 
Redis exporter下载地址
GitHub - oliver006/redis_exporter: Prometheus Exporter for Redis Metrics. Supports Redis 2.x, 3.x, 4.x, 5.x, 6.x, and 7.xPrometheus Exporter for Redis Metrics. Supports Redis 2.x, 3.x, 4.x, 5.x, 6.x, and 7.x - GitHub - oliver006/redis_exporter: Prometheus Exporter for Redis Metrics. Supports Redis 2.x, 3.x, 4.x, 5.x, 6.x, and 7.x
https://github.com/oliver006/redis_exporter

下载已编译redis_exporter
https://github.com/oliver006/redis_exporter/releases/download/v1.35.1/redis_exporter-v1.35.1.linux-amd64.tar.gz

安装go进行编译

解压redis exporter文件

解压命令:
tar xvfz redis_exporter-v1.35.1.linux-amd64.tar.gz

修改文件夹名称 :
mv redis_exporter-v1.35.1.linux-amd64 redis_exporter
启动redis exporter服务

启动命令:
./redis_exporter

使用lsof -i命令查看redis_exporter占用端口。

使用浏览器打开redis-exporter服务查看监控数据
http://172.26.94.74:9121/metrics