send influx datapoints only when enabled
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful

This commit is contained in:
Stefan Hoffmann 2024-03-18 19:34:06 +01:00
parent 7549eaa5d0
commit 73166fcedc
Signed by: stefan
GPG Key ID: 230E4E5FC468C133
4 changed files with 10 additions and 4 deletions

View File

@ -57,7 +57,9 @@ func processGateways() []node {
if err != nil { if err != nil {
log.Fatalln("Error: ", err) log.Fatalln("Error: ", err)
} }
sendInfluxBatchDataPoint(point, conf.General.FreifunkInfluxPort) if conf.General.InfluxEnabled {
sendInfluxBatchDataPoint(point, conf.General.FreifunkInfluxPort)
}
//Build Nodes //Build Nodes
nodes = append(nodes, node{ nodes = append(nodes, node{

View File

@ -11,6 +11,7 @@ import (
type config struct { type config struct {
General struct { General struct {
InfluxEnabled bool `json:"influx_enabled"`
FreifunkInfluxPort string `json:"freifunk_influx_port"` FreifunkInfluxPort string `json:"freifunk_influx_port"`
ProxmoxInfluxPort string `json:"proxmox_influx_port"` ProxmoxInfluxPort string `json:"proxmox_influx_port"`
InfluxURL string `json:"influx_url"` InfluxURL string `json:"influx_url"`

View File

@ -125,7 +125,9 @@ func processUcAPIs() ([]node, []link, error) {
log.Fatalln("Error: ", err) log.Fatalln("Error: ", err)
} }
sendInfluxBatchDataPoint(point, conf.General.FreifunkInfluxPort) if conf.General.InfluxEnabled {
sendInfluxBatchDataPoint(point, conf.General.FreifunkInfluxPort)
}
// INFLUX STOP // INFLUX STOP

View File

@ -192,8 +192,9 @@ func processUNMSAPIRouter() ([]node, error) {
if err != nil { if err != nil {
log.Fatalln("Error: ", err) log.Fatalln("Error: ", err)
} }
if conf.General.InfluxEnabled {
sendInfluxBatchDataPoint(point, conf.General.FreifunkInfluxPort) sendInfluxBatchDataPoint(point, conf.General.FreifunkInfluxPort)
}
// Get info from json file (static) // Get info from json file (static)
nodes = append(nodes, node{ nodes = append(nodes, node{
Firstseen: dev.Overview.CreatedAt.Format(iso8601), Firstseen: dev.Overview.CreatedAt.Format(iso8601),