Compare commits

...

3 Commits

Author SHA1 Message Date
Michael Wyraz 72459f101b victoriametrics + grafana 2021-11-14 14:27:19 +01:00
Michael Wyraz ab42aec24d meshviewer 2021-11-14 14:27:00 +01:00
Michael Wyraz 99089b557f Yanic 2021-11-14 14:26:59 +01:00
13 changed files with 435 additions and 3 deletions

View File

@ -1 +1,2 @@
/envfile
/data

View File

@ -16,3 +16,30 @@ Umgebungsvariablen:
* FASTD_PEER`n`_NAME (optional): weitere Peers (fortlaufend numeriert)
* FASTD_LOG_LEVEL (default: info)
* IPV6_PREFIX (optional): Prefix für radvd, nötig um hosts im Netz über ihre nicht-link-lokale IPv6 anzupingen. z.B. `fdef:ffc0:7030::/64`
### yanic
Yanic ist ein Client für respondd und verantwortlich, Knoten-Broadcasts einzusammeln und daraus die Knoten-Daten für die Karte zu generieren. Der Container verwendet das Netzwerk von "fastd", um Zugang zum Feifunk-Netz zu bekommen.
Die generierten Daten werden auf ein Volume geschrieben, welches vom Meshviewer-Kartenserver aus zugäglich ist.
Umgebungsvariablen:
* keine
### meshviewer
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!)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -8,4 +8,47 @@ services:
privileged: true # required to create the tap device
sysctls:
net.ipv6.conf.all.disable_ipv6: 0 # enable ipv6 withn container
stop_grace_period: 0s
net.ipv6.conf.all.forwarding: 1
stop_grace_period: 0s
yanic:
build: ./yanic
network_mode: "service:fastd"
stop_grace_period: 10s
volumes:
- ./data/yanic:/data
meshviewer:
build: ./meshviewer
ports:
- 80:80
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

@ -47,7 +47,7 @@ while true; do
: ${remote:? ${r} must be set}
: ${key:? ${k} must be set}
cat << EOF > "config/fastd/peers/${name}"
cat << EOF > "/config/fastd/peers/${name}"
key "${key}";
remote ${remote};
EOF
@ -56,7 +56,7 @@ EOF
done
if [ ! -z "${IPV6_PREFIX}" ]; then
cat << EOF > "config/radvd.conf"
cat << EOF > "/config/radvd.conf"
interface bat0
{
AdvSendAdvert on;

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

@ -0,0 +1,17 @@
FROM node:14-alpine as builder
RUN apk add --update --no-cache git
RUN yarn global add gulp@4.0.2
RUN git clone --branch ffle https://git.dezentrale.cloud/Freifunk-Leipzig/meshviewer.git /meshviewer
RUN cd /meshviewer && yarn
RUN cd /meshviewer && gulp
FROM nginx:1-alpine
RUN rm -rf /usr/share/nginx/html/*
COPY --from=builder /meshviewer/build /usr/share/nginx/html/

View File

@ -0,0 +1,15 @@
FROM golang:1.16-alpine as builder
RUN go get -v -u github.com/FreifunkBremen/yanic@2c0b3c74fc42efb3e91a88939d341ed73c65d31a
FROM alpine:3.14
COPY --from=builder /go/bin/yanic /bin/yanic
RUN apk add --update --no-cache bash
ADD entrypoint.sh /entrypoint.sh
VOLUME /data
CMD /entrypoint.sh

78
mapserver/yanic/entrypoint.sh Executable file
View File

@ -0,0 +1,78 @@
#!/bin/bash
set -e
mkdir -p /config /data /data/meshviewer
cat << EOF > "/config/yanic.toml"
# Send respondd request to update information
[respondd]
enable = true
# Delay startup until a multiple of the period since zero time
synchronize = "1m"
# how often request per multicast
collect_interval = "1m"
[respondd.sites.l]
domains = []
[respondd.sites.m]
domains = ["meshkit"]
[[respondd.interfaces]]
ifname = "bat0"
multicast_address = "ff02::2:1001"
[[respondd.interfaces]]
ifname = "bat0"
multicast_address = "ff05::2:1001"
[webserver]
enable = false
[nodes]
state_path = "/data/state.json"
prune_after = "120d"
save_interval = "5s"
offline_after = "1h"
# definition for the new more compressed meshviewer.json
[[nodes.output.meshviewer-ffrgb]]
enable = true
path = "/data/meshviewer/meshviewer.json"
[nodes.output.meshviewer-ffrgb.filter]
# WARNING: if it is not set to true, it will publish contact information of other persons
no_owner = false
[[nodes.output.meshviewer]]
enable = false
[[nodes.output.nodelist]]
enable = false
[database]
delete_after = "60d"
delete_interval = "1h"
[[database.connection.influxdb]]
enable = true
address = "http://victoriametrics:8428"
database = "nodes"
username = ""
password = ""
[[database.connection.graphite]]
enable = false
[[database.connection.respondd]]
enable = false
[[database.connection.logging]]
enable = false
EOF
exec /bin/yanic serve --config /config/yanic.toml