Browse Source

First commit

Signed-off-by: Blagovest Petrov <blagovest@petrovs.info>
master
Blagovest Petrov 8 months ago
commit
d34a5c8dbc
3 changed files with 64 additions and 0 deletions
  1. +26
    -0
      docker/influx_grafana/docker-compose.yml
  2. +4
    -0
      docker/influx_grafana/env.sample
  3. +34
    -0
      fetch_data.go

+ 26
- 0
docker/influx_grafana/docker-compose.yml View File

@ -0,0 +1,26 @@
---
version: 3.8
services:
influxdb:
image: influxdb:1.8-alpine
ports:
- "8083:8083"
- "8086:8086"
- "8090:8090"
env_file:
- ".env"
volumes:
- influx-data:/var/lib/influxdb
grafana:
image: grafana/grafana:latest
ports:
- "3000:3000"
env_file:
- ".env"
user: "0"
links:
- influxdb
volumes:
- grafana-data:/var/lib/grafana

+ 4
- 0
docker/influx_grafana/env.sample View File

@ -0,0 +1,4 @@
INFLUXDB_DATA_ENGINE=tsm1
INFLUXDB_REPORTING_DISABLED=false
GF_INSTALL_PLUGINS=grafana-clock-panel,briangann-gauge-panel,natel-plotly-panel,grafana-simple-json-datasource

+ 34
- 0
fetch_data.go View File

@ -0,0 +1,34 @@
package main
import (
"fmt"
"io/ioutil"
"net/http"
"crypto/tls"
)
func fetch_data() string {
url := "https://213.240.235.145/web-site-service/rest/parkingBoardsRequest/allFreePlaces"
//because the certificate of the server is self signed
http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
resp, err := http.Get(url)
if err != nil {
panic(err)
}
defer resp.Body.Close()
traffic_rawdata, err := ioutil.ReadAll(resp.Body)
if err != nil {
panic(err)
}
// fmt.Printf("%s\n", traffic_data)
return string(traffic_rawdata)
}
func main() {
fmt.Printf("%s\n", fetch_data())
}

Loading…
Cancel
Save