kube/monitoring/mikrotik-exporter.yaml

120 lines
3.0 KiB
YAML

---
apiVersion: monitoring.coreos.com/v1
kind: Probe
metadata:
name: mikrotik
spec:
basicAuth:
username:
name: mikrotik-exporter
key: username
password:
name: mikrotik-exporter
key: password
prober:
url: mikrotik-exporter
module: full
targets:
staticConfig:
static:
- 172.23.0.1
- 172.23.0.100
#- 100.102.1.111
#- 100.102.1.112
- 100.102.1.114
- 100.102.1.115
- 100.102.1.121
- 100.102.1.131
- 100.102.1.141
- 100.102.1.151
---
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: mikrotik
spec:
groups:
- name: mikrotik
rules:
- alert: MikrotikBondRedundancyLost
expr: mikrotik_bond_port_active == 0
for: 2m
labels:
severity: error
annotations:
summary: Switch uplink high availability lost
description: One of the two bonds has inactive member interface
- alert: MikrotikLinkRateDegraded
expr: mikrotik_interface_link_rate_bps{interface=~"sfp-sfpplus.*"} < 10000000000
for: 2m
labels:
severity: error
annotations:
summary: SFP+ link degraded
description: One of the SFP+ (10G) links is running at lower speed
- alert: MikrotikLinkRateDegraded
expr: mikrotik_interface_link_rate_bps{interface=~"qsfpplus.*"} < 40000000000
for: 2m
labels:
severity: error
annotations:
summary: QSFP+ link degraded
description: One of the QSFP+ (40G) links is running at lower speed
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: mikrotik-exporter
spec:
revisionHistoryLimit: 0
replicas: 2
selector:
matchLabels:
app: mikrotik-exporter
template:
metadata:
labels:
app: mikrotik-exporter
spec:
containers:
- name: mikrotik-exporter
image: mirror.gcr.io/codemowers/mikrotik-exporter:latest@sha256:895ed4a96364aa6f37aa049eb7882779529dce313360e78b01dee7d6f9b3e0bb
topologySpreadConstraints:
- maxSkew: 1
topologyKey: topology.kubernetes.io/zone
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app: mikrotik-exporter
nodeSelector:
node-role.kubernetes.io/control-plane: ''
tolerations:
- key: node-role.kubernetes.io/control-plane
operator: Equal
value: ''
effect: NoSchedule
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- mikrotik-exporter
topologyKey: "kubernetes.io/hostname"
---
kind: Service
apiVersion: v1
metadata:
name: mikrotik-exporter
spec:
type: ClusterIP
ports:
- name: http
port: 80
protocol: TCP
targetPort: 8728
selector:
app: mikrotik-exporter