This commit is contained in:
2024-06-04 10:04:47 +02:00
parent b56cfdc165
commit 28d296bb65
7 changed files with 183 additions and 2 deletions

4
.env.example Normal file
View File

@@ -0,0 +1,4 @@
INFUXDB_USERNAME=admin
INFLUXDB_PASSWORD=password
INFLUXDB_TOKEN=
GRAFANA_PASSWORD="password123#"

3
.gitignore vendored
View File

@@ -129,4 +129,5 @@ dist
.yarn/install-state.gz
.pnp.*
influxdb
influxdb
grafana

View File

@@ -1 +1,7 @@
# influxdb-allnet-connector
## Usage
- Projekt clonen
- `.env` erstellen und mit den Daten aus `.env.example` befüllen
- Ausführen: `docker-compose up -d`

View File

@@ -44,4 +44,15 @@ services:
ports:
- 3000:3000
environment:
- TZ=Europe/Berlin
- TZ=Europe/Berlin
- GF_AUTH_ANONYMOUS_ENABLED=true
- GF_AUTH_ANONYMOUS_ORG_ROLE=Viewer
- GF_SECURITY_ALLOW_EMBEDDING=true
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD}
- INFLUXDB_TOKEN=${INFLUXDB_TOKEN}
volumes:
- ./grafana/storage:/var/lib/grafana
- ./grafana-provisioning/datasources:/etc/grafana/provisioning/datasources
- ./grafana-provisioning/dashboards-prov:/etc/grafana/provisioning/dashboards
- ./grafana-provisioning/dashboards:/var/lib/grafana/dashboards

View File

@@ -0,0 +1,11 @@
apiVersion: 1
providers:
- name: "default"
orgId: 1
folder: ""
type: file
disableDeletion: false
updateIntervalSeconds: 10
options:
path: /var/lib/grafana/dashboards

View File

@@ -0,0 +1,134 @@
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "grafana",
"uid": "-- Grafana --"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"type": "dashboard"
}
]
},
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": 4,
"links": [],
"panels": [
{
"datasource": {
"type": "influxdb",
"uid": "f607742f-31b6-4340-8557-c7b2d0770e0a"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": 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
}
]
},
"unit": "celsius"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 0
},
"id": 1,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"maxHeight": 600,
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "influxdb",
"uid": "f607742f-31b6-4340-8557-c7b2d0770e0a"
},
"query": "from(bucket: \"allnet\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r[\"_measurement\"] == \"sId_107\")\r\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n |> yield(name: \"mean\")",
"refId": "A"
}
],
"title": "Temperatur",
"type": "timeseries"
}
],
"schemaVersion": 39,
"tags": [],
"templating": {
"list": []
},
"time": {
"from": "now-6h",
"to": "now"
},
"timeRangeUpdatedDuringEditOrView": false,
"timepicker": {},
"timezone": "browser",
"title": "Allnet",
"uid": "bdnqkz6ow70u8a",
"version": 1,
"weekStart": ""
}

View File

@@ -0,0 +1,14 @@
apiVersion: 1
datasources:
- name: InfluxDB
type: influxdb
access: proxy
url: http://influxdb:8086
jsonData:
version: Flux
organization: org
defaultBucket: allnet
tlsSkipVerify: true
secureJsonData:
token: ${INFLUXDB_TOKEN}