diff --git a/monitoring/README.md b/monitoring/README.md index c63f75b..55ddb29 100644 --- a/monitoring/README.md +++ b/monitoring/README.md @@ -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 +``` diff --git a/monitoring/mikrotik-exporter.yaml b/monitoring/mikrotik-exporter.yaml index e79073f..36243ea 100644 --- a/monitoring/mikrotik-exporter.yaml +++ b/monitoring/mikrotik-exporter.yaml @@ -4,25 +4,29 @@ kind: Probe metadata: name: mikrotik spec: - bearerTokenSecret: - name: mikrotik-exporter - key: PROMETHEUS_BEARER_TOKEN + basicAuth: + username: + name: mikrotik-exporter + 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