Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto provision InfluxDB data source in Grafana #512

Merged
merged 9 commits into from
Sep 1, 2024
Prev Previous commit
Next Next commit
Request freeipapi.com once
  • Loading branch information
longzheng committed Sep 1, 2024
commit f236b39898c681da2d00cf710386059a4103ef50
5 changes: 3 additions & 2 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ LAT="0.0"
LONG="0.0"
PYTHON=$(command -v python3 || command -v python)
if [ -n "${PYTHON}" ]; then
LAT=$(curl -s https://freeipapi.com/api/json | "${PYTHON}" -c "import sys, json; print(json.load(sys.stdin)['latitude'])")
LONG=$(curl -s https://freeipapi.com/api/json | "${PYTHON}" -c "import sys, json; print(json.load(sys.stdin)['longitude'])")
IP_RESPONSE=$(curl -s https://freeipapi.com/api/json)
LAT=$(echo "$IP_RESPONSE" | "${PYTHON}" -c "import sys, json; print(json.load(sys.stdin)['latitude'])")
LONG=$(echo "$IP_RESPONSE" | "${PYTHON}" -c "import sys, json; print(json.load(sys.stdin)['longitude'])")
fi

# Docker Dependency Check
Expand Down
5 changes: 3 additions & 2 deletions weather.sh
longzheng marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ LAT="0.0"
LONG="0.0"
PYTHON=$(command -v python3 || command -v python)
if [ -n "${PYTHON}" ]; then
LAT=$(curl -s https://freeipapi.com/api/json | "${PYTHON}" -c "import sys, json; print(json.load(sys.stdin)['latitude'])")
LON=$(curl -s https://freeipapi.com/api/json | "${PYTHON}" -c "import sys, json; print(json.load(sys.stdin)['longitude'])")
IP_RESPONSE=$(curl -s https://freeipapi.com/api/json)
LAT=$(echo "$IP_RESPONSE" | "${PYTHON}" -c "import sys, json; print(json.load(sys.stdin)['latitude'])")
LONG=$(echo "$IP_RESPONSE" | "${PYTHON}" -c "import sys, json; print(json.load(sys.stdin)['longitude'])")
fi

# Setup Weather?
Expand Down