1、部署exporter
GitHub - oliver006/redis_exporter: Prometheus Exporter for Redis Metrics. Supports Redis 2.x, 3.x, 4.x, 5.x, 6.x, and 7.x
redis_exporter-v1.57.0.linux-386.tar.gz
# 解压
tar -zxvf redis_exporter-v1.57.0.linux-386.tar.gz
# 启动
nohup ./redis_exporter -redis.password 111111 -web.listen-address 0.0.0.0:9122 &
访问确认启动成功
http://ip:9122/metrics
2、创建k8s对象
集群内部创建Endpoints代理外部端点
---
apiVersion: v1
kind: Service
metadata:name: redis-exporter-monitornamespace: monitorlabels:app: redis-exporter-monitor
spec:type: ClusterIPports:- name: tcp-9122port: 9122protocol: TCPtargetPort: 9122
---
apiVersion: v1
kind: Endpoints
metadata:name: redis-exporter-monitornamespace: monitorlabels:app: redis-exporter-monitorside: mid
subsets:
- addresses:- ip: {ip}ports:- name: tcp-9122port: 9122
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:name: redis-exporter-monitornamespace: monitorlabels:team: hitside: mid
spec:selector:matchLabels:app: redis-exporter-monitornamespaceSelector:matchNames:- monitorendpoints:- port: tcp-9122path: /metrics
3、grafana模板
id:17507
以上内容对您有帮助,请点赞支持,谢谢!