new settings because of new-install influxdb

This commit is contained in:
Joerg Lehmann 2020-10-15 19:18:23 +02:00
parent 3b2b39a3f0
commit 9296866fe9
2 changed files with 9 additions and 9 deletions

View File

@ -267,7 +267,7 @@ func CalcDaysUntil(mydate string) int {
func getLastMetrics(deveui string) OneMetric { func getLastMetrics(deveui string) OneMetric {
var res OneMetric var res OneMetric
url := "http://localhost:9999/api/v2/query?org=beieliorg" url := "http://localhost:8086/api/v2/query?org=beieliorg"
data := []byte(fmt.Sprintf(`from(bucket:"beielibucket") data := []byte(fmt.Sprintf(`from(bucket:"beielibucket")
|> range(start:-5d) |> range(start:-5d)
|> filter(fn: (r) => r._measurement == "measurement" and r.deveui == "%s") |> filter(fn: (r) => r._measurement == "measurement" and r.deveui == "%s")
@ -280,7 +280,7 @@ func getLastMetrics(deveui string) OneMetric {
} }
// Set headers // Set headers
req.Header.Set("Authorization", "Token OzSltiHLmm3WCaFPI0DrK0VFAVCiqcORNrGsgHO43jb0qodyVGAumJQ3HRtkaze53BVR3AmHqfkmrwrjq-xTyA==") req.Header.Set("Authorization", "Token nKYCoz3TA-LItYXG988DjdiStMhrfKmFXQqzxrjzJJ7Ek_iUttzFSE9lfe3s6q99EMdcrjuGlDAjp4Y0VnNRXw==")
req.Header.Set("accept", "application/csv") req.Header.Set("accept", "application/csv")
req.Header.Set("content-type", "application/vnd.flux") req.Header.Set("content-type", "application/vnd.flux")

View File

@ -116,7 +116,7 @@ func metricsHandler(response http.ResponseWriter, request *http.Request) {
mystart = start[0] mystart = start[0]
} }
url := "http://localhost:9999/api/v2/query?org=beieliorg" url := "http://localhost:8086/api/v2/query?org=beieliorg"
data := []byte(fmt.Sprintf(`from(bucket:"beielibucket") |> range(start: %s, stop: %s) |> filter(fn: (r) => r._measurement == "measurement") |> filter(fn: (r) => r._field == "%s") |> filter(fn: (r) => r.deveui == "%s")`, mystart, mystop, property[0], mydeveui)) data := []byte(fmt.Sprintf(`from(bucket:"beielibucket") |> range(start: %s, stop: %s) |> filter(fn: (r) => r._measurement == "measurement") |> filter(fn: (r) => r._field == "%s") |> filter(fn: (r) => r.deveui == "%s")`, mystart, mystop, property[0], mydeveui))
req, err := http.NewRequest("POST", url, bytes.NewBuffer(data)) req, err := http.NewRequest("POST", url, bytes.NewBuffer(data))
@ -125,7 +125,7 @@ func metricsHandler(response http.ResponseWriter, request *http.Request) {
} }
// Set headers // Set headers
req.Header.Set("Authorization", "Token OzSltiHLmm3WCaFPI0DrK0VFAVCiqcORNrGsgHO43jb0qodyVGAumJQ3HRtkaze53BVR3AmHqfkmrwrjq-xTyA==") req.Header.Set("Authorization", "Token nKYCoz3TA-LItYXG988DjdiStMhrfKmFXQqzxrjzJJ7Ek_iUttzFSE9lfe3s6q99EMdcrjuGlDAjp4Y0VnNRXw==")
req.Header.Set("accept", "application/csv") req.Header.Set("accept", "application/csv")
req.Header.Set("content-type", "application/vnd.flux") req.Header.Set("content-type", "application/vnd.flux")
@ -197,7 +197,7 @@ func lastmetricsHandler(response http.ResponseWriter, request *http.Request) {
log.Println("Url Param 'deveui' is: " + string(mydeveui)) log.Println("Url Param 'deveui' is: " + string(mydeveui))
url := "http://localhost:9999/api/v2/query?org=beieliorg" url := "http://localhost:8086/api/v2/query?org=beieliorg"
//data := []byte(fmt.Sprintf(`from(bucket:"beielibucket") |> range(start:-365d) |> filter(fn: (r) => r.deveui == "%s") |> filter(fn: (r) => r._field == "v" or r._field == "t") |> last() |> yield(name: "last")`,mydeveui)) //data := []byte(fmt.Sprintf(`from(bucket:"beielibucket") |> range(start:-365d) |> filter(fn: (r) => r.deveui == "%s") |> filter(fn: (r) => r._field == "v" or r._field == "t") |> last() |> yield(name: "last")`,mydeveui))
data := []byte(fmt.Sprintf(`from(bucket:"beielibucket") data := []byte(fmt.Sprintf(`from(bucket:"beielibucket")
|> range(start:-365d) |> range(start:-365d)
@ -211,7 +211,7 @@ func lastmetricsHandler(response http.ResponseWriter, request *http.Request) {
} }
// Set headers // Set headers
req.Header.Set("Authorization", "Token OzSltiHLmm3WCaFPI0DrK0VFAVCiqcORNrGsgHO43jb0qodyVGAumJQ3HRtkaze53BVR3AmHqfkmrwrjq-xTyA==") req.Header.Set("Authorization", "Token nKYCoz3TA-LItYXG988DjdiStMhrfKmFXQqzxrjzJJ7Ek_iUttzFSE9lfe3s6q99EMdcrjuGlDAjp4Y0VnNRXw==")
req.Header.Set("accept", "application/csv") req.Header.Set("accept", "application/csv")
req.Header.Set("content-type", "application/vnd.flux") req.Header.Set("content-type", "application/vnd.flux")
@ -295,7 +295,7 @@ func CalcDaysUntil(mydate string) int {
func getLastMetrics(deveui string) OneMetric { func getLastMetrics(deveui string) OneMetric {
var res OneMetric var res OneMetric
url := "http://localhost:9999/api/v2/query?org=beieliorg" url := "http://localhost:8086/api/v2/query?org=beieliorg"
data := []byte(fmt.Sprintf(`from(bucket:"beielibucket") data := []byte(fmt.Sprintf(`from(bucket:"beielibucket")
|> range(start:-365d) |> range(start:-365d)
|> filter(fn: (r) => r._measurement == "measurement" and r.deveui == "%s") |> filter(fn: (r) => r._measurement == "measurement" and r.deveui == "%s")
@ -307,8 +307,8 @@ func getLastMetrics(deveui string) OneMetric {
log.Fatal("Error reading request. ", err) log.Fatal("Error reading request. ", err)
} }
// Set headers // Set headers
req.Header.Set("Authorization", "Token OzSltiHLmm3WCaFPI0DrK0VFAVCiqcORNrGsgHO43jb0qodyVGAumJQ3HRtkaze53BVR3AmHqfkmrwrjq-xTyA==") req.Header.Set("Authorization", "Token nKYCoz3TA-LItYXG988DjdiStMhrfKmFXQqzxrjzJJ7Ek_iUttzFSE9lfe3s6q99EMdcrjuGlDAjp4Y0VnNRXw==")
req.Header.Set("accept", "application/csv") req.Header.Set("accept", "application/csv")
req.Header.Set("content-type", "application/vnd.flux") req.Header.Set("content-type", "application/vnd.flux")