func try_088() { iclient, err := backends.NewInfluxdbClient(map[string]interface{}{ "Host": "192.168.59.103:8086", "Username": "******", "Password": "******", "Database": "metrics", "FlatTemplate": "{{.Key}}.{{.Tags}}", }, "0.8.8") if err != nil { fmt.Println("InfluxdbClient: Error: ", err) return } fmt.Println("InfluxdbClient:", iclient, err) t, v, err := iclient.Ping() fmt.Println(t, v, err) // ----------- write --------------- write := mockWrite() // pretty.Println(write) fmt.Println(len(write.Points)) res, err := iclient.Write(write) fmt.Println(res, err) // -------------- query ------------------- res, err = iclient.Query(client.Query{ Command: "select * from data1", Database: "metrics", }) if err != nil { fmt.Println("err", err) return } if res != nil { // fmt.Println("len res.Results: ", len(res.Results)) for _, r := range res.Results { for _, s := range r.Series { for _, v := range s.Values { fmt.Println(v) } } } } else { // fmt.Println("res == nil ") } }
func try_090() { iclient, err := backends.NewInfluxdbClient(map[string]interface{}{ "URL": "http://192.168.59.103:8086/write", "Username": "******", "Password": "******", "UserAgent": "", }, "0.9.0-rc7") fmt.Println("InfluxdbClient:", iclient, err) t, v, err := iclient.Ping() fmt.Println(t, v, err) // ----------- write --------------- write := mockWrite() // pretty.Println(write) fmt.Println(len(write.Points)) res, err := iclient.Write(write) fmt.Println(res, err) // -------------- query ------------------- res, err = iclient.Query(client.Query{ Command: "select * from data1", Database: "metrics", }) if err != nil { fmt.Println("err", err) return } if res != nil { // fmt.Println("len res.Results: ", len(res.Results)) for _, r := range res.Results { for _, s := range r.Series { for _, v := range s.Values { fmt.Println(v) } } } } else { // fmt.Println("res == nil ") } }