--- 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: MikrotikUplinkRedundancyLost expr: mikrotik_interface_running{port=~"sfp-sfpplus[12]", instance!~"sw_core.*", instance!~"sw_mgmt.*"} == 0 for: 0m labels: severity: error annotations: summary: Switch uplink high availability lost description: One of the two 10Gb optical links is malfunctioning - alert: MikrotikLinkRateDegraded expr: mikrotik_interface_rate{port=~"sfp-sfpplus.*"} < 10000000000 for: 0m labels: severity: error annotations: summary: 10Gb link degraded description: One of the 10Gb 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:c3c075ebf6f9ba032c9f108567afef59c763ccd17a2ad4ef4f99e1721d03aa46 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: 3001 selector: app: mikrotik-exporter