Commit 7c19055b authored by Johannes Schilling's avatar Johannes Schilling
Browse files

cip-grafana-tempgraph-extract: refactor

parent 505fa707
......@@ -3,13 +3,18 @@
set -eu
CURDATE=$(date +%s)
url() {
olddate=$(date --date="$1" +%s)
printf "http://localhost:3621/render/dashboard-solo/db/public-temperature?orgId=1&from=%d000&to=%d000&panelId=1&width=1000&height=500&theme=light" "${olddate}" "${CURDATE}"
/usr/bin/curl -H 'X-Remote-User: nobody' "$(url '24 hours ago')" > /var/www/temperature/day.png
/usr/bin/curl -H 'X-Remote-User: nobody' "$(url '7 days ago')" > /var/www/temperature/week.png
/usr/bin/curl -H 'X-Remote-User: nobody' "$(url '30 days ago')" > /var/www/temperature/month.png
/usr/bin/curl -H 'X-Remote-User: nobody' "$(url '360 days ago')" > /var/www/temperature/year.png
fetch() {
/usr/bin/curl -H 'X-Remote-User: nobody' "$(url "$1")" > "${OUTDIR}/${2}.png"
fetch "24 hours ago" day
fetch "7 days ago" week
fetch "30 days ago" month
fetch "360 days ago" year
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment