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 \ kubectl create -n monitoring secret generic mikrotik-exporter \
--from-literal=MIKROTIK_PASSWORD='f7W!H*Pu' \ --from-literal=username=netpoller \
--from-literal=PROMETHEUS_BEARER_TOKEN=$(cat /dev/urandom | base64 | head -c 30) --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: metadata:
name: mikrotik name: mikrotik
spec: spec:
bearerTokenSecret: basicAuth:
username:
name: mikrotik-exporter name: mikrotik-exporter
key: PROMETHEUS_BEARER_TOKEN key: username
password:
name: mikrotik-exporter
key: password
prober: prober:
path: /metrics
url: mikrotik-exporter url: mikrotik-exporter
module: full
targets: targets:
staticConfig: staticConfig:
static: static:
- router.mgmt.k-space.ee - 172.23.0.1
- sw_chaos.mgmt.k-space.ee - 172.23.0.100
- sw_poe.mgmt.k-space.ee - 100.102.1.111
- sw_mgmt.mgmt.k-space.ee - 100.102.1.112
- sw_core02.mgmt.k-space.ee - 100.102.1.114
- sw_cyber.mgmt.k-space.ee - 100.102.1.115
- sw_ha.mgmt.k-space.ee - 100.102.1.121
- sw_asocial.mgmt.k-space.ee - 100.102.1.131
- sw_kitchen.mgmt.k-space.ee - 100.102.1.141
- sw_core01.mgmt.k-space.ee - 100.102.1.151
--- ---
apiVersion: monitoring.coreos.com/v1 apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule kind: PrometheusRule
@ -63,20 +67,10 @@ spec:
metadata: metadata:
labels: labels:
app: mikrotik-exporter app: mikrotik-exporter
annotations:
co.elastic.logs/multiline.pattern: '^ '
co.elastic.logs/multiline.negate: "false"
co.elastic.logs/multiline.match: after
spec: spec:
containers: containers:
- name: mikrotik-exporter - name: mikrotik-exporter
image: mirror.gcr.io/codemowers/mikrotik-exporter:latest image: mirror.gcr.io/codemowers/mikrotik-exporter:latest
env:
- name: MIKROTIK_USER
value: netpoller
envFrom:
- secretRef:
name: mikrotik-exporter
topologySpreadConstraints: topologySpreadConstraints:
- maxSkew: 1 - maxSkew: 1
topologyKey: topology.kubernetes.io/zone topologyKey: topology.kubernetes.io/zone