package main
import (
db "github.com/DanKans/myinfluxdb"
)
func main() {
var (
InfluxConfig db.InfluxConfig
Metric db.InfluxMetric
Metrics []db.InfluxMetric
)
// Connection
InfluxConfig.Hostname = "127.0.0.1"
InfluxConfig.Protocol = "udp"
InfluxConfig.Port = "8086"
InfluxConfig.Tags = map[string]string{"name": "Collector1"}
// Sample metric
Metric.Measurement = "temperature"
Metric.Tags = map[string]string {
"room": "bathroom",
}
Metric.Values = map[string]interface{} {
"probe1": 22,
"probe2": 21,
}
// Append sample Metric to array of Metrics
Metrics = append(Metrics, Metric)
InfluxConfig.Send(&Metrics)
}
-
Notifications
You must be signed in to change notification settings - Fork 0
dsalbert/myinfluxdb
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Wrapper for influxdb client
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published