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

View File

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

View File

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

View File

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

View File

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