
Parameter | Description |
name | Exporter name, which should meet the following requirements: The name should be unique. The name should conform to the following regular expression: '^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$'. |
address | Redis connection address. |
password | Redis password. |
tag | Custom labels for metrics. |
password. Below is a sample YAML configuration:apiVersion: v1kind: Secretmetadata:name: redis-secret-testnamespace: redis-testtype: OpaquestringData:password: you-guess #Redis password
apiVersion: apps/v1kind: Deploymentmetadata:labels:k8s-app: redis-exporter # Adjust to the corresponding name based on business requirements. It is recommended to include information about the Redis instance, such as crs-66e112fp-redis-exportername: redis-exporter # Adjust to the corresponding name based on business requirements. It is recommended to include information about the Redis instance, such as crs-66e112fp-redis-exporternamespace: redis-test # Select a suitable namespace to deploy the exporter, if there is no namespace, need to create onespec:replicas: 1selector:matchLabels:k8s-app: redis-exporter # Adjust to the corresponding name based on business requirements. It is recommended to include information about the Redis instance, such as crs-66e112fp-redis-exportertemplate:metadata:labels:k8s-app: redis-exporter # Adjust to the corresponding name based on business requirements. It is recommended to include information about the Redis instance, such as crs-66e112fp-redis-exporterspec:containers:- env:- name: REDIS_ADDRvalue: ip:port # Redis ip:port- name: REDIS_PASSWORDvalueFrom:secretKeyRef:name: redis-secret-testkey: passwordimage: ccr.ccs.tencentyun.com/rig-agent/redis-exporter:v1.32.0imagePullPolicy: IfNotPresentname: redis-exporterports:- containerPort: 9121name: metric-port # This name is required when configuring scraping tasksecurityContext:privileged: falseterminationMessagePath: /dev/termination-logterminationMessagePolicy: FilednsPolicy: ClusterFirstimagePullSecrets:- name: qcloudregistrykeyrestartPolicy: AlwaysschedulerName: default-schedulersecurityContext: {}terminationGracePeriodSeconds: 30

curl command with the address exposed by the exporter in the command line window, and you can get the corresponding Redis metrics normally. If no corresponding data is returned, please check whether REDIS_ADDR and REDIS_PASSWORD are correct as shown below:curl http://localhost:9121/metrics

PodMonitor via service discovery to define the collection task. The YAML example is as follows:apiVersion: monitoring.coreos.com/v1kind: PodMonitormetadata:name: redis-exporter # Enter a unique namenamespace: cm-prometheus # Pay-as-you-go instance: cluster namespace; Annual and monthly subscription instances (no longer available): namespace is fixed, do not changespec:podMetricsEndpoints:- interval: 30sport: metric-port # enter the port Name of the Prometheus Exporter in the pod yaml filepath: /metrics # Enter the path of the Prometheus Exporter. Default value: /metrics.relabelings:- action: replacesourceLabels:- instanceregex: (.*)targetLabel: instancereplacement: 'crs-xxxxxx' # Replace with the corresponding Redis instance ID- action: replacesourceLabels:- instanceregex: (.*)targetLabel: ipreplacement: '1.x.x.x' # Replace with the corresponding Redis instance IPnamespaceSelector: # Select the namespace where the Pod to be monitored is located.matchNames:- redis-testselector: # enter the labels of the pod to be monitored to locate target podmatchLabels:k8s-app: redis-exporter
Exporter and Redis are deployed on different servers, we recommend you use the Prometheus relabeling mechanism to add the Redis instance information to the monitoring metrics so as to locate problems more easily.
Feedback