Prometheus Install ( redis demo )
manfred@kube-master-node:~/prometheus$ vi reddis-servicemonitor.yaml
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
labels:
serviceMonitorSelector: prometheus
release: prometheus
name: reddis
namespace: monitoring
spec:
endpoints:
- interval: 30s
targetPort: 9121
path: /metrics
namespaceSelector:
matchNames:
- boutique-prom
selector:
matchLabels:
operated-prometheus: "true"
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
kind: Service
metadata:
annotations:
meta.helm.sh/release-name: redis-exporter
meta.helm.sh/release-namespace: boutique-prom
metallb.universe.tf/ip-allocated-from-pool: first-pool
prometheus.io/path: /metrics
prometheus.io/port: "9121"
prometheus.io/scrape: "true"
creationTimestamp: "2024-04-03T18:06:52Z"
labels:
app.kubernetes.io/instance: redis-exporter
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: prometheus-redis-exporter
app.kubernetes.io/version: v1.58.0
helm.sh/chart: prometheus-redis-exporter-6.2.0
operated-prometheus: "true"
name: redis-exporter-prometheus-redis-exporter
namespace: boutique-prom
resourceVersion: "10018332"
uid: bfc9fa1b-9eca-4749-9ac7-138ece4f2f26
spec:
allocateLoadBalancerNodePorts: true
clusterIP: 10.111.74.103
clusterIPs:
- 10.111.74.103
externalTrafficPolicy: Cluster
internalTrafficPolicy: Cluster
ipFamilies:
- IPv4
ipFamilyPolicy: SingleStack
ports:
- name: redis-exporter
nodePort: 32258
port: 9121
protocol: TCP
targetPort: exporter-port
selector:
app.kubernetes.io/instance: redis-exporter
app.kubernetes.io/name: prometheus-redis-exporter
sessionAffinity: None
type: LoadBalancer
status:
loadBalancer:
ingress:
- ip: 192.168.178.209
~
manfred@kube-master-node:~/prometheus$ kubectl -n boutique-prom edit deploy redis-exporter-prometheus-redis-exporter
helm.sh/chart: prometheus-redis-exporter-6.2.0
spec:
containers:
- env:
- name: REDIS_ADDR
value: redis://redis-cart:6379
image: oliver006/redis_exporter:v1.58.0
imagePullPolicy: IfNotPresent
livenessProbe:
failureThreshold: 3
httpGet:
path: /
port: exporter-port
scheme: HTTP
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
name: prometheus-redis-exporter
ports:
- containerPort: 9121
name: exporter-port
protocol: TCP
readinessProbe:
failureThreshold: 3
httpGet:
path: /
port: exporter-port
scheme: HTTP
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
serviceAccount: redis-exporter-prometheus-redis-exporter
serviceAccountName: redis-exporter-prometheus-redis-exporter
terminationGracePeriodSeconds: 30
Instana Agent config to pull the metrics :
com.instana.plugin.prometheus:
enabled: true
poll_rate: 15 # Standard ist 1 Sekunde
customMetricSources:
- url: '/metrics' # Metrik-Endpunkt, IP und Port werden automatisch ermittelt
metricNameIncludeRegex: '.*' # regulärer Ausdruck, um Metriken zu filtern