Skip to content

Commit

Permalink
chore(docs): improve for influxdb2
Browse files Browse the repository at this point in the history
  • Loading branch information
maurerle authored and genofire committed Jul 4, 2024
1 parent f98fea7 commit 4aa93bc
Show file tree
Hide file tree
Showing 9 changed files with 957 additions and 86 deletions.
4 changes: 3 additions & 1 deletion cmd/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ var serveCmd = &cobra.Command{

if config.Webserver.Enable {
log.Infof("starting webserver on %s", config.Webserver.Bind)
srv := webserver.New(config.Webserver.Bind, config.Webserver.Webroot)
srv := webserver.New(config.Webserver, nodes)
go webserver.Start(srv)
defer srv.Close()
} else if prom := config.Webserver.Prometheus; prom != nil && prom.Enable {
log.Error("to enable prometheus exporter, please enable webserver ")
}

if config.Respondd.Enable {
Expand Down
20 changes: 15 additions & 5 deletions config_example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ enable = false
bind = "127.0.0.1:8080"
webroot = "/var/www/html/meshviewer"

[webserver.prometheus]
# need webserver
enable = false
disable_labels = [
# "hostname",
# "owner",
# "location",
]



[nodes]
# Cache file
Expand Down Expand Up @@ -195,7 +205,7 @@ delete_interval = "1h"
#enable = true

# Save collected data to InfluxDB.
# There are the following measurments:
# There are the following measurements:
# node: store node specific data i.e. clients memory, airtime
# link: store link tq between two interfaces of two different nodes
# global: store global data, i.e. count of clients and nodes
Expand All @@ -220,7 +230,7 @@ password = ""
#site = "ffhb"

# Save collected data to InfluxDB2.
# There are the following measurments:
# There are the following measurements:
# node: store node specific data i.e. clients memory, airtime
# link: store link tq between two interfaces of two different nodes with i.e. nodeid, address, hostname
# global: store global data, i.e. count of clients and nodes
Expand All @@ -233,12 +243,12 @@ address = "http://localhost:8086"
token = ""
organization_id = ""
# fallback of no specific bucket for measurement is setup
bucket_default = ""
bucket_default = "yanic"

# Specify bucket per measurement (of not set fallback bucket_default is used or panic)
#
# WARNING:
# yanic do NOT prune node's data (so please setup it in InfluxDB2 setup).
# yanic does NOT prune node's data (so please set up data retention in InfluxDB2 setup).
#
# We highly recommend to setup e.g. Data retention in your InfluxDB2 server per measurements.
# https://docs.influxdata.com/influxdb/v2/reference/internals/data-retention/
Expand All @@ -247,7 +257,7 @@ bucket_default = ""
#link = "yanic-temp"
#node = "yanic-temp"
#dhcp = "yanic-temp"
global = "yanic"
global = "yanic-persistent"
#firmware = "yanic-temp"
#model = "yanic-temp"
#autoupdater = "yanic-temp"
Expand Down
18 changes: 9 additions & 9 deletions docs/docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ site = "ffhb"
### [[database.connection.influxdb2]]
Save collected data to InfluxDB2.

There are the following measurments:
There are the following measurements:

- **node**: store node specific data i.e. clients memory, airtime
- **link**: store link tq between two interfaces of two different nodes with i.e. nodeid, address, hostname
Expand All @@ -407,7 +407,7 @@ There are the following measurments:
A bucket has to be set in buckets and buchet_default otherwise yanic would panic.

!!! warning
yanic do NOT prune node's data (so please setup it in InfluxDB2 setup).
yanic does NOT prune node's data (so please set up data retention in InfluxDB2 setup).

We highly recommend to setup e.g. [Data retention](https://docs.influxdata.com/influxdb/v2/reference/internals/data-retention/) in your InfluxDB2 server per measurements.

Expand All @@ -417,13 +417,13 @@ enable = false
address = "http://localhost:8086" # (1)
token = "" # (2)
organization_id = "" # (3)
bucket_default = "" # (4)
bucket_default = "yanic" # (4)

[database.connection.influxdb2.buckets] # (5)
#link = "yanic-temp"
#node = "yanic-temp"
#dhcp = "yanic-temp"
global = "yanic"
global = "yanic-persistent"
#firmware = "yanic-temp"
#model = "yanic-temp"
#autoupdater = "yanic-temp"
Expand All @@ -438,19 +438,19 @@ global = "yanic"
#site = "ffhb"
```

1. Address to connect on InfluxDB2 server.
2. Token to get acces to InfluxDB2 server.
1. Address to connect to the InfluxDB2 server.
2. Token to get access to InfluxDB2 server.
3. Set organization using the InfluxDB2 server.

4. Bucket in which are the data stored.

Fallback of bucket per measurment, see `[database.connection.influxdb2.buckets]`
Fallback of bucket per measurement, see `[database.connection.influxdb2.buckets]`

5. Buckets per measurement.

If not set data `bucket_default` is used.
If no buckets are set, the default bucket `bucket_default` is used.

6. You could set manuelle tags with inserting into a influxdb.
6. You can set additional tags which are added to all data written into the influxdb.

Useful if you want to identify the yanic instance when you use multiple own on the same influxdb (e.g. multisites).

Expand Down
93 changes: 52 additions & 41 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,98 +1,109 @@
module github.com/FreifunkBremen/yanic

go 1.21
go 1.22

toolchain go1.22.3

require (
github.com/BurntSushi/toml v1.3.2
github.com/BurntSushi/toml v1.4.0
github.com/NYTimes/gziphandler v1.1.1
github.com/bdlm/log v0.1.20
github.com/bdlm/std v1.0.1
github.com/fgrosse/graphigo v0.0.0-20151222101953-5770fe631d9a
github.com/influxdata/influxdb-client-go/v2 v2.12.3
github.com/influxdata/influxdb-client-go/v2 v2.13.0
github.com/influxdata/influxdb1-client v0.0.0-20220302092344-a9ab5670611c
github.com/paulmach/go.geojson v1.5.0
github.com/pkg/errors v0.9.1
github.com/spf13/cobra v1.7.0
github.com/stretchr/testify v1.8.4
github.com/tidwall/gjson v1.16.0
golang.org/x/sys v0.12.0
github.com/prometheus/client_golang v1.19.1
github.com/spf13/cobra v1.8.1
github.com/stretchr/testify v1.9.0
github.com/tidwall/gjson v1.17.1
golang.org/x/sys v0.22.0
)

require (
github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53 // indirect
github.com/CloudyKit/jet/v6 v6.2.0 // indirect
github.com/Joker/jade v1.1.3 // indirect
github.com/Shopify/goreferrer v0.0.0-20220729165902-8cddb4f5de06 // indirect
github.com/andybalholm/brotli v1.0.5 // indirect
github.com/andybalholm/brotli v1.1.0 // indirect
github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect
github.com/aymerick/douceur v0.2.0 // indirect
github.com/bytedance/sonic v1.10.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bytedance/sonic v1.11.9 // indirect
github.com/bytedance/sonic/loader v0.1.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect
github.com/chenzhuoyu/iasm v0.9.0 // indirect
github.com/chenzhuoyu/iasm v0.9.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/deepmap/oapi-codegen v1.15.0 // indirect
github.com/deepmap/oapi-codegen v1.16.3 // indirect
github.com/fatih/structs v1.1.0 // indirect
github.com/flosch/pongo2/v4 v4.0.2 // indirect
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
github.com/gabriel-vasile/mimetype v1.4.4 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/gin-gonic/gin v1.9.1 // indirect
github.com/gin-gonic/gin v1.10.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.15.4 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/go-playground/validator/v10 v10.22.0 // indirect
github.com/goccy/go-json v0.10.3 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/gomarkdown/markdown v0.0.0-20230916125811-7478c230c7cd // indirect
github.com/google/uuid v1.3.1 // indirect
github.com/gorilla/css v1.0.0 // indirect
github.com/gomarkdown/markdown v0.0.0-20240626202925-2eda941fd024 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/css v1.0.1 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/influxdata/line-protocol v0.0.0-20210922203350-b1ad95c89adf // indirect
github.com/iris-contrib/schema v0.0.6 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kataras/blocks v0.0.7 // indirect
github.com/kataras/golog v0.1.9 // indirect
github.com/kataras/iris/v12 v12.2.6-0.20230908161203-24ba4e8933b9 // indirect
github.com/kataras/pio v0.0.12 // indirect
github.com/kataras/blocks v0.0.8 // indirect
github.com/kataras/golog v0.1.12 // indirect
github.com/kataras/iris/v12 v12.2.11 // indirect
github.com/kataras/pio v0.0.13 // indirect
github.com/kataras/sitemap v0.0.6 // indirect
github.com/kataras/tunnel v0.0.4 // indirect
github.com/klauspost/compress v1.17.0 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/labstack/echo/v4 v4.11.1 // indirect
github.com/labstack/gommon v0.4.0 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/klauspost/cpuid/v2 v2.2.8 // indirect
github.com/labstack/echo/v4 v4.12.0 // indirect
github.com/labstack/gommon v0.4.2 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/mailgun/raymond/v2 v2.0.48 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/microcosm-cc/bluemonday v1.0.25 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/microcosm-cc/bluemonday v1.0.27 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/oapi-codegen/runtime v1.1.1 // indirect
github.com/onsi/ginkgo v1.16.5 // indirect
github.com/onsi/gomega v1.19.0 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.55.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/schollz/closestmatch v2.1.0+incompatible // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/tdewolff/minify/v2 v2.12.9 // indirect
github.com/tdewolff/parse/v2 v2.6.8 // indirect
github.com/tdewolff/minify/v2 v2.20.35 // indirect
github.com/tdewolff/parse/v2 v2.7.15 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.1 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.11 // indirect
github.com/ugorji/go/codec v1.2.12 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.2 // indirect
github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/yosssi/ace v0.0.5 // indirect
golang.org/x/arch v0.5.0 // indirect
golang.org/x/crypto v0.13.0 // indirect
golang.org/x/net v0.15.0 // indirect
golang.org/x/term v0.12.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.3.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
golang.org/x/arch v0.8.0 // indirect
golang.org/x/crypto v0.24.0 // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/term v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/time v0.5.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/fgrosse/graphigo.v2 v2.0.0-20151220153422-55a0a92a7030 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
Loading

0 comments on commit 4aa93bc

Please sign in to comment.