updates after writing blog

This commit is contained in:
Erik Brakkee 2023-04-10 21:23:12 +02:00
parent f86bb5f55a
commit 29bac24705
6 changed files with 22 additions and 23 deletions

View File

@ -1,3 +0,0 @@
https://github.com/prometheus/client_python
pip install prometheus-client

View File

@ -14,7 +14,7 @@ spec:
summary: etcd cluster backup is too old or not present
expr: |-
time() -
max(max_over_time(file_time_seconds{job="pantherbackupexporter",type="backup"}[60m]))
max(max_over_time(file_time_seconds{job="controllerbackupexporter",type="backup"}[60m]))
> 3600
for: 5m
labels:
@ -24,7 +24,7 @@ spec:
description: 'etcd backup is too small or not present'
summary: etcd cluster backup is too small or not present
expr: |-
max(max_over_time(file_size{job="pantherbackupexporter",type="backup"}[60m]))
max(max_over_time(file_size{job="controllerbackupexporter",type="backup"}[60m]))
<
10000000
for: 5m
@ -36,7 +36,7 @@ spec:
summary: etcd image file is too old or not present
expr: |-
time() -
max(max_over_time(file_time_seconds{job="pantherbackupexporter",type="image"}[60m]))
max(max_over_time(file_time_seconds{job="controllerbackupexporter",type="image"}[60m]))
> 3600
for: 5m
labels:
@ -46,7 +46,7 @@ spec:
description: 'etcd image file is too small or not present'
summary: etcd cluster image file is too small or not present
expr: |-
max(max_over_time(file_size{job="pantherbackupexporter",type="image"}[60m]))
max(max_over_time(file_size{job="controllerbackupexporter",type="image"}[60m]))
<
10
for: 5m

View File

@ -1,17 +1,16 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: pantherbackupmonitoring
name: controllerbackupmonitoring
namespace: monitoring
spec:
selector:
matchLabels:
app: pantherbackupmonitoring
app: controllerbackupmonitoring
template:
metadata:
labels:
app: pantherbackupmonitoring
prometheus-scrapable: "true"
app: controllerbackupmonitoring
spec:
terminationGracePeriodSeconds: 0
tolerations:
@ -21,8 +20,13 @@ spec:
- effect: NoSchedule
key: node-role.kubernetes.io/master
operator: Exists
nodeSelector:
kubernetes.io/hostname: panther
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: node-role.kubernetes.io/control-plane
operator: Exists
containers:
- name: exporter
image: docker.example.com/filemonitor:1.0
@ -37,11 +41,11 @@ spec:
protocol: TCP
name: http
volumeMounts:
- name: pantherbackup
- name: controllerbackup
mountPath: /backup
readOnly: true
volumes:
- name: pantherbackup
- name: controllerbackup
hostPath:
path: /var/lib/wamblee/etcd

View File

@ -6,14 +6,12 @@ services:
command:
- python3
- /exporter.py
# some paths for testing
- /data/x.txt
- /data/y.txt
ports:
- "8080:8080"
volumes:
# for testing.
- /home/user/downloads:/data
- /home/erik/downloads:/data

View File

@ -2,13 +2,13 @@
apiVersion: v1
kind: Service
metadata:
name: pantherbackupexporter
name: controllerbackupexporter
namespace: monitoring
labels:
app: pantherbackupmonitoring
app: controllerbackupmonitoring
spec:
selector:
app: pantherbackupmonitoring
app: controllerbackupmonitoring
ports:
- port: 8080
targetPort: 8080

View File

@ -1,7 +1,7 @@
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: pantherbackupmonitoring
name: controllerbackupmonitoring
namespace: monitoring
spec:
endpoints:
@ -12,6 +12,6 @@ spec:
scrapeTimeout: 30s
selector:
matchLabels:
app: pantherbackupmonitoring
app: controllerbackupmonitoring
targetLabels:
- app