spedisce a influxdb la data

This commit is contained in:
Miki 2016-04-21 16:11:27 +02:00
parent e3d7b1dae5
commit 2e53d3fb4f
2 changed files with 22 additions and 14 deletions

View file

@ -11,13 +11,14 @@ import (
type InfluxdbOutput struct {
CountOK int
CountTOT int
Start time.Time
Stop time.Duration
Pipe time.Duration
Find time.Duration
Insert time.Duration
}
func writeStats(start time.Time) {
func writeStats(start time.Time, ys time.Time) {
if opts.Debug {
fmt.Printf("writing to influxdb server: %s", opts.Influxdb)
}
@ -41,10 +42,11 @@ func writeStats(start time.Time) {
return
}
tags := map[string]string{"server": opts.Hostname}
tags := map[string]string{"server": opts.Hostname, "date": ys.String()}
fields := map[string]interface{}{
"LoginOK": idb.CountOK,
"LoginTOT": idb.CountTOT,
"start": ys,
"stop": idb.Stop.Seconds(),
"pipe": idb.Pipe.Nanoseconds(),
"find": idb.Find.Nanoseconds(),