monitoring: Update Mikrotik exporter

This commit is contained in:
Lauri Võsandi 2024-09-04 22:33:15 +03:00
parent 9de1881647
commit 1f8f288f95
2 changed files with 27 additions and 26 deletions

View File

@ -55,7 +55,14 @@ To set Mikrotik secrets:
```
kubectl create -n monitoring secret generic mikrotik-exporter \
--from-literal=MIKROTIK_PASSWORD='f7W!H*Pu' \
--from-literal=PROMETHEUS_BEARER_TOKEN=$(cat /dev/urandom | base64 | head -c 30)
--from-literal=username=netpoller \
--from-literal=password=...
```
To wipe timeseries:
```
for replica in $(seq 0 2); do
kubectl exec -n monitoring prometheus-prometheus-$replica -- wget --post-data='match[]={__name__=~"mikrotik_.*"}' http://127.0.0.1:9090/api/v1/admin/tsdb/delete_series -O -
done
```

View File

@ -4,25 +4,29 @@ kind: Probe
metadata:
name: mikrotik
spec:
bearerTokenSecret:
basicAuth:
username:
name: mikrotik-exporter
key: PROMETHEUS_BEARER_TOKEN
key: username
password:
name: mikrotik-exporter
key: password
prober:
path: /metrics
url: mikrotik-exporter
module: full
targets:
staticConfig:
static:
- router.mgmt.k-space.ee
- sw_chaos.mgmt.k-space.ee
- sw_poe.mgmt.k-space.ee
- sw_mgmt.mgmt.k-space.ee
- sw_core02.mgmt.k-space.ee
- sw_cyber.mgmt.k-space.ee
- sw_ha.mgmt.k-space.ee
- sw_asocial.mgmt.k-space.ee
- sw_kitchen.mgmt.k-space.ee
- sw_core01.mgmt.k-space.ee
- 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
@ -63,20 +67,10 @@ spec:
metadata:
labels:
app: mikrotik-exporter
annotations:
co.elastic.logs/multiline.pattern: '^ '
co.elastic.logs/multiline.negate: "false"
co.elastic.logs/multiline.match: after
spec:
containers:
- name: mikrotik-exporter
image: mirror.gcr.io/codemowers/mikrotik-exporter:latest
env:
- name: MIKROTIK_USER
value: netpoller
envFrom:
- secretRef:
name: mikrotik-exporter
topologySpreadConstraints:
- maxSkew: 1
topologyKey: topology.kubernetes.io/zone