field order has changed with influxdb 2.0.8
This commit is contained in:
parent
61f61c474f
commit
a505fc5709
18
metrics.go
18
metrics.go
|
|
@ -164,10 +164,10 @@ func metricsHandler(response http.ResponseWriter, request *http.Request) {
|
||||||
for scanner.Scan() {
|
for scanner.Scan() {
|
||||||
s := strings.Split(scanner.Text(), ",")
|
s := strings.Split(scanner.Text(), ",")
|
||||||
fmt.Printf("Scanned Line: %v, %d elements\n", s, len(s))
|
fmt.Printf("Scanned Line: %v, %d elements\n", s, len(s))
|
||||||
if (len(s) >= 12) && !(strings.HasPrefix(s[3], "_")) {
|
if (len(s) >= 12) && !(strings.HasPrefix(s[5], "_")) {
|
||||||
t, err := time.Parse(time.RFC3339, s[3])
|
t, err := time.Parse(time.RFC3339, s[5])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("error converting time: %s\n", s[3])
|
fmt.Printf("error converting time: %s\n", s[5])
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
a := t.Unix()
|
a := t.Unix()
|
||||||
|
|
@ -317,7 +317,7 @@ func downloadmetricsHandler(response http.ResponseWriter, request *http.Request)
|
||||||
for scanner.Scan() {
|
for scanner.Scan() {
|
||||||
s := strings.Split(scanner.Text(), ",")
|
s := strings.Split(scanner.Text(), ",")
|
||||||
fmt.Printf("Scanned Line: %v, elements: %d\n", s, len(s))
|
fmt.Printf("Scanned Line: %v, elements: %d\n", s, len(s))
|
||||||
if (len(s) >= 10) && !(strings.HasPrefix(s[3], "_")) {
|
if (len(s) >= 10) && !(strings.HasPrefix(s[5], "_")) {
|
||||||
s_flags := ""
|
s_flags := ""
|
||||||
lat := s[len(s)-2]
|
lat := s[len(s)-2]
|
||||||
lon := s[len(s)-1]
|
lon := s[len(s)-1]
|
||||||
|
|
@ -335,9 +335,9 @@ func downloadmetricsHandler(response http.ResponseWriter, request *http.Request)
|
||||||
s_flags = s_flags + "+OUTSIDE_GREENZONE"
|
s_flags = s_flags + "+OUTSIDE_GREENZONE"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
t, err := time.Parse(time.RFC3339, s[3])
|
t, err := time.Parse(time.RFC3339, s[5])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("error converting time: %s\n", s[3])
|
fmt.Printf("error converting time: %s\n", s[5])
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
mytime := t.In(location).Format("02.01.2006 15:04")
|
mytime := t.In(location).Format("02.01.2006 15:04")
|
||||||
|
|
@ -450,10 +450,10 @@ func getLastMetrics(deveui string) OneMetric {
|
||||||
for scanner.Scan() {
|
for scanner.Scan() {
|
||||||
s := strings.Split(scanner.Text(), ",")
|
s := strings.Split(scanner.Text(), ",")
|
||||||
fmt.Printf("BlaBla: %v, elements: %d\n", s, len(s))
|
fmt.Printf("BlaBla: %v, elements: %d\n", s, len(s))
|
||||||
if (len(s) >= 12) && !(strings.HasPrefix(s[3], "_")) {
|
if (len(s) >= 12) && !(strings.HasPrefix(s[5], "_")) {
|
||||||
t, err := time.Parse(time.RFC3339, s[3])
|
t, err := time.Parse(time.RFC3339, s[5])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("error converting time: %s\n", s[3])
|
fmt.Printf("error converting time: %s\n", s[5])
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue