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-monitor
namespace: monitor
labels:
app: redis-exporter-monitor
spec:
type: ClusterIP
ports:
- name: tcp-9122
port: 9122
protocol: TCP
targetPort: 9122
---
apiVersion: v1
kind: Endpoints
metadata:
name: redis-exporter-monitor
namespace: monitor
labels:
app: redis-exporter-monitor
side: mid
subsets:
- addresses:
- ip: {ip}
ports:
- name: tcp-9122
port: 9122
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: redis-exporter-monitor
namespace: monitor
labels:
team: hit
side: mid
spec:
selector:
matchLabels:
app: redis-exporter-monitor
namespaceSelector:
matchNames:
- monitor
endpoints:
- port: tcp-9122
path: /metrics
3、grafana模板
id:17507
以上内容对您有帮助,请点赞支持,谢谢!