victoriametrics + grafana

This commit is contained in:
Michael Wyraz 2021-11-14 13:43:45 +01:00
parent 784f2b4187
commit 5cb0b1444d
7 changed files with 295 additions and 2 deletions

View File

@ -31,3 +31,15 @@ Umgebungsvariablen:
Der Meshviewer-Container stellt die Meshviewer-Anwendung aus https://git.dezentrale.cloud/Freifunk-Leipzig/meshviewer/src/branch/ffle sowie die zugehörigen Meshviewer-Daten bereit.
### victoriametrics
VictoriaMetrics ist eine Prometheus-kompatible, hoch performante Zeitreihen-Datenbank, welche das InfluxDB Protokoll unterstützt. Sie kommt zur Speicherung der Knoten-Metriken zum Einsatz.
### grafana
Grafana wird zur Visualisierung der Knoten-Metriken verwendet. Dabei werden die Datenquelle und die Dashboards automatisch beim Start provisioniert.
Umgebungsvariablen:
* GF_SECURITY_ADMIN_USER: initialier Admin-Benutzer für Grafana
* GF_SECURITY_ADMIN_PASSWORD: initiales Admin-Passwort (sollte beim ersten Login unbedingt geändert werden!)

View File

@ -10,6 +10,7 @@ services:
net.ipv6.conf.all.disable_ipv6: 0 # enable ipv6 withn container
net.ipv6.conf.all.forwarding: 1
stop_grace_period: 0s
yanic:
build: ./yanic
network_mode: "service:fastd"
@ -23,4 +24,31 @@ services:
volumes:
- ./data/yanic/meshviewer:/usr/share/nginx/html/data
victoriametrics:
image: victoriametrics/victoria-metrics:v1.69.0
command: |
-retentionPeriod=24
-selfScrapeInterval=30s
volumes:
- ./data/victoriametrics:/victoria-metrics-data
grafana:
image: grafana/grafana:8.2.3
volumes:
- ./data/grafana:/var/lib/grafana
# https://blog.56k.cloud/provisioning-grafana-datasources-and-dashboards-automagically/
- ./grafana/provisioning/datasources:/etc/grafana/provisioning/datasources
- ./grafana/provisioning/dashboards:/etc/grafana/provisioning/dashboards
env_file: envfile
environment:
GF_LOG_MODE: console
GF_AUTH_ANONYMOUS_ENABLED: "true"
ports:
- 81:3000
user: root
entrypoint:
- /bin/sh
- -c
- |
chown grafana /var/lib/grafana
exec su grafana -s /bin/sh -c /run.sh

View File

@ -18,3 +18,13 @@ FASTD_PEER1_REMOTE="gluon3.leipzig.freifunk.net" port 10061
FASTD_PEER1_KEY=1111111111111111111111111111111111111111111111111111111111111111
IPV6_PREFIX=fdef:ffc0:7030::/64
# Grafana settings
# Initial user for grafana
GF_SECURITY_ADMIN_USER=admin
# Initial password for grafana (change at first login!)
GF_SECURITY_ADMIN_PASSWORD=admin

View File

@ -0,0 +1,12 @@
apiVersion: 1
providers:
# https://grafana.com/docs/grafana/latest/administration/provisioning/#dashboards
- name: 'dashboard_provisioner'
# <int> Org id. Default to 1
orgId: 1
updateIntervalSeconds: 10
allowUiUpdates: false
options:
path: /etc/grafana/provisioning/dashboards
foldersFromFilesStructure: true

View File

@ -0,0 +1,215 @@
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"target": {
"limit": 100,
"matchAny": false,
"tags": [],
"type": "dashboard"
},
"type": "dashboard"
}
]
},
"editable": true,
"fiscalYearStartMonth": 0,
"gnetId": null,
"graphTooltip": 0,
"id": 1,
"iteration": 1636893346139,
"links": [],
"liveNow": false,
"panels": [
{
"datasource": null,
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 3,
"w": 12,
"x": 0,
"y": 0
},
"id": 4,
"interval": null,
"maxDataPoints": 1,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"text": {},
"textMode": "name"
},
"pluginVersion": "8.2.3",
"targets": [
{
"exemplar": false,
"expr": "node_clients.total{nodeid=\"$node_id\"}",
"format": "time_series",
"instant": true,
"interval": "",
"legendFormat": "{{hostname}}",
"refId": "A"
}
],
"timeFrom": "1y",
"timeShift": null,
"title": "hostname",
"type": "stat"
},
{
"datasource": null,
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 9,
"w": 12,
"x": 0,
"y": 3
},
"id": 2,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "single"
}
},
"targets": [
{
"exemplar": true,
"expr": "node_clients.total{nodeid=\"$node_id\"}",
"interval": "",
"legendFormat": "",
"refId": "A"
}
],
"title": "Connected clients",
"type": "timeseries"
}
],
"schemaVersion": 31,
"style": "dark",
"tags": [],
"templating": {
"list": [
{
"allValue": null,
"datasource": null,
"definition": "label_values(nodeid)",
"description": null,
"error": null,
"hide": 0,
"includeAll": false,
"label": null,
"multi": false,
"name": "node_id",
"options": [],
"query": {
"query": "label_values(nodeid)",
"refId": "StandardVariableQuery"
},
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"type": "query"
}
]
},
"time": {
"from": "now-6h",
"to": "now"
},
"timepicker": {},
"timezone": "",
"title": "Node (public)",
"uid": "KoKOqJc7k",
"version": 3
}

View File

@ -0,0 +1,12 @@
# config file version
apiVersion: 1
datasources:
- name: Victoriametrics
type: prometheus
access: proxy
uid: victoriametrics
url: http://victoriametrics:8428
isDefault: true
editable: false
version: 1

View File

@ -56,7 +56,11 @@ delete_after = "60d"
delete_interval = "1h"
[[database.connection.influxdb]]
enable = false
enable = true
address = "http://victoriametrics:8428"
database = "nodes"
username = ""
password = ""
[[database.connection.graphite]]
enable = false