set influxdb fields time to "start" time

This commit is contained in:
Miki 2016-02-18 13:36:33 +01:00
parent 98226a042a
commit 5ef381fd79
2 changed files with 5 additions and 4 deletions

View file

@ -3,11 +3,12 @@ package main
import (
"fmt"
"time"
influxdb "github.com/influxdata/influxdb/client/v2"
)
func writeStats() {
func writeStats(start time.Time) {
if opts.Debug {
fmt.Printf("writing to influxdb server: %s", opts.Influxdb)
}
@ -39,7 +40,7 @@ func writeStats() {
"dup": count.GetDup(),
"stop": count.GetTime(),
}
pt, err := influxdb.NewPoint("ll2mongo", tags, fields)
pt, err := influxdb.NewPoint("ll2mongo", tags, fields, start)
if err != nil {
fmt.Printf("Error: %+v\n", err)
return

View file

@ -11,7 +11,7 @@ import (
)
const (
_VERSION = "v2.5.0"
_VERSION = "v2.5.1"
)
var (
@ -107,7 +107,7 @@ func main() {
log.Printf("Stop %v - user: %d - login: %d - errors: %d - rem: %d - duplicate: %d\n\r", count.GetTime(), count.GetUser(), count.GetLog(), count.GetErr(), count.GetRem(), count.GetDup())
if opts.Influxdb != "" {
writeStats()
writeStats(start)
}
if opts.Xymon != "" {