Skip to content

Instantly share code, notes, and snippets.

@hobopanda
Forked from Tafkas/xport-temp.sh
Created February 23, 2017 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hobopanda/ac3cffe06b0c1cf91126bf3a49f221ab to your computer and use it in GitHub Desktop.
Save hobopanda/ac3cffe06b0c1cf91126bf3a49f221ab to your computer and use it in GitHub Desktop.
Export RRDTool database to xml
#!/usr/bin/env bash
rrdtool xport -s now-3h -e now --step 300 \
DEF:a=/home/pi/weather/temperatures.rrd:temps1:AVERAGE \
DEF:b=/home/pi/weather/temperatures.rrd:temps2:AVERAGE \
DEF:c=/home/pi/weather/temperatures.rrd:temps3:AVERAGE \
DEF:d=/home/pi/weather/temperatures.rrd:temps4:AVERAGE \
DEF:e=/home/pi/weather/temperatures.rrd:temps5:AVERAGE \
DEF:f=/home/pi/weather/temperatures.rrd:temps6:AVERAGE \
XPORT:a:"Livingroom" \
XPORT:b:"Outside" \
XPORT:c:"Bathroom" \
XPORT:d:"Bedroom" \
XPORT:e:"Staircase" \
XPORT:f:"Basement" > temperature3h.xml
rrdtool xport -s now-24h -e now --step 900 \
DEF:a=/home/pi/weather/temperatures.rrd:temps1:AVERAGE \
DEF:b=/home/pi/weather/temperatures.rrd:temps2:AVERAGE \
DEF:c=/home/pi/weather/temperatures.rrd:temps3:AVERAGE \
DEF:d=/home/pi/weather/temperatures.rrd:temps4:AVERAGE \
DEF:e=/home/pi/weather/temperatures.rrd:temps5:AVERAGE \
DEF:f=/home/pi/weather/temperatures.rrd:temps6:AVERAGE \
XPORT:a:"Livingroom" \
XPORT:b:"Outside" \
XPORT:c:"Bathroom" \
XPORT:d:"Bedroom" \
XPORT:e:"Staircase" \
XPORT:f:"Basement" > temperature24h.xml
rrdtool xport -s now-48h -e now --step 1800 \
DEF:a=/home/pi/weather/temperatures.rrd:temps1:AVERAGE \
DEF:b=/home/pi/weather/temperatures.rrd:temps2:AVERAGE \
DEF:c=/home/pi/weather/temperatures.rrd:temps3:AVERAGE \
DEF:d=/home/pi/weather/temperatures.rrd:temps4:AVERAGE \
DEF:e=/home/pi/weather/temperatures.rrd:temps5:AVERAGE \
DEF:f=/home/pi/weather/temperatures.rrd:temps6:AVERAGE \
XPORT:a:"Livingroom" \
XPORT:b:"Outside" \
XPORT:c:"Bathroom" \
XPORT:d:"Bedroom" \
XPORT:e:"Staircase" \
XPORT:f:"Basement" > temperature48h.xml
rrdtool xport -s now-8d -e now --step 7200 \
DEF:a=/home/pi/weather/temperatures.rrd:temps1:AVERAGE \
DEF:b=/home/pi/weather/temperatures.rrd:temps2:AVERAGE \
DEF:c=/home/pi/weather/temperatures.rrd:temps3:AVERAGE \
DEF:d=/home/pi/weather/temperatures.rrd:temps4:AVERAGE \
DEF:e=/home/pi/weather/temperatures.rrd:temps5:AVERAGE \
DEF:f=/home/pi/weather/temperatures.rrd:temps6:AVERAGE \
XPORT:a:"Livingroom" \
XPORT:b:"Outside" \
XPORT:c:"Bathroom" \
XPORT:d:"Bedroom" \
XPORT:e:"Staircase" \
XPORT:f:"Basement" > temperature1w.xml
rrdtool xport -s now-1month -e now --step 10800 \
DEF:a=/home/pi/weather/temperatures.rrd:temps1:AVERAGE \
DEF:b=/home/pi/weather/temperatures.rrd:temps2:AVERAGE \
DEF:c=/home/pi/weather/temperatures.rrd:temps3:AVERAGE \
DEF:d=/home/pi/weather/temperatures.rrd:temps4:AVERAGE \
DEF:e=/home/pi/weather/temperatures.rrd:temps5:AVERAGE \
DEF:f=/home/pi/weather/temperatures.rrd:temps6:AVERAGE \
XPORT:a:"Livingroom" \
XPORT:b:"Outside" \
XPORT:c:"Bathroom" \
XPORT:d:"Bedroom" \
XPORT:e:"Staircase" \
XPORT:f:"Basement" > temperature1m.xml
rrdtool xport -s now-3month -e now --step 43200 \
DEF:a=/home/pi/weather/temperatures.rrd:temps1:AVERAGE \
DEF:b=/home/pi/weather/temperatures.rrd:temps2:AVERAGE \
DEF:c=/home/pi/weather/temperatures.rrd:temps3:AVERAGE \
DEF:d=/home/pi/weather/temperatures.rrd:temps4:AVERAGE \
DEF:e=/home/pi/weather/temperatures.rrd:temps5:AVERAGE \
DEF:f=/home/pi/weather/temperatures.rrd:temps6:AVERAGE \
XPORT:a:"Livingroom" \
XPORT:b:"Outside" \
XPORT:c:"Bathroom" \
XPORT:d:"Bedroom" \
XPORT:e:"Staircase" \
XPORT:f:"Basement" > temperature3m.xml
rrdtool xport -s now-1y -e now --step 86400 \
DEF:a=/home/pi/weather/temperatures.rrd:temps1:AVERAGE \
DEF:b=/home/pi/weather/temperatures.rrd:temps2:AVERAGE \
DEF:c=/home/pi/weather/temperatures.rrd:temps3:AVERAGE \
DEF:d=/home/pi/weather/temperatures.rrd:temps4:AVERAGE \
DEF:e=/home/pi/weather/temperatures.rrd:temps5:AVERAGE \
DEF:f=/home/pi/weather/temperatures.rrd:temps6:AVERAGE \
XPORT:a:"Livingroom" \
XPORT:b:"Outside" \
XPORT:c:"Bathroom" \
XPORT:d:"Bedroom" \
XPORT:e:"Staircase" \
XPORT:f:"Basement" > temperature1y.xml
rrdtool xport -s now-3h -e now --step 300 \
DEF:a=/home/pi/weather/temperatures.rrd:hums1:AVERAGE \
DEF:b=/home/pi/weather/temperatures.rrd:hums2:AVERAGE \
DEF:c=/home/pi/weather/temperatures.rrd:hums3:AVERAGE \
DEF:d=/home/pi/weather/temperatures.rrd:hums4:AVERAGE \
DEF:e=/home/pi/weather/temperatures.rrd:hums5:AVERAGE \
DEF:f=/home/pi/weather/temperatures.rrd:hums6:AVERAGE \
XPORT:a:"Livingroom" \
XPORT:b:"Outside" \
XPORT:c:"Bathroom" \
XPORT:d:"Bedroom" \
XPORT:e:"Staircase" \
XPORT:f:"Basement" > humid3h.xml
rrdtool xport -s now-24h -e now --step 900 \
DEF:a=/home/pi/weather/temperatures.rrd:hums1:AVERAGE \
DEF:b=/home/pi/weather/temperatures.rrd:hums2:AVERAGE \
DEF:c=/home/pi/weather/temperatures.rrd:hums3:AVERAGE \
DEF:d=/home/pi/weather/temperatures.rrd:hums4:AVERAGE \
DEF:e=/home/pi/weather/temperatures.rrd:hums5:AVERAGE \
DEF:f=/home/pi/weather/temperatures.rrd:hums6:AVERAGE \
XPORT:a:"Livingroom" \
XPORT:b:"Outside" \
XPORT:c:"Bathroom" \
XPORT:d:"Bedroom" \
XPORT:e:"Staircase" \
XPORT:f:"Basement" > humid24h.xml
rrdtool xport -s now-48h -e now --step 1800 \
DEF:a=/home/pi/weather/temperatures.rrd:hums1:AVERAGE \
DEF:b=/home/pi/weather/temperatures.rrd:hums2:AVERAGE \
DEF:c=/home/pi/weather/temperatures.rrd:hums3:AVERAGE \
DEF:d=/home/pi/weather/temperatures.rrd:hums4:AVERAGE \
DEF:e=/home/pi/weather/temperatures.rrd:hums5:AVERAGE \
DEF:f=/home/pi/weather/temperatures.rrd:hums6:AVERAGE \
XPORT:a:"Livingroom" \
XPORT:b:"Outside" \
XPORT:c:"Bathroom" \
XPORT:d:"Bedroom" \
XPORT:e:"Staircase" \
XPORT:f:"Basement" > humid48h.xml
rrdtool xport -s now-8d -e now --step 7200 \
DEF:a=/home/pi/weather/temperatures.rrd:hums1:AVERAGE \
DEF:b=/home/pi/weather/temperatures.rrd:hums2:AVERAGE \
DEF:c=/home/pi/weather/temperatures.rrd:hums3:AVERAGE \
DEF:d=/home/pi/weather/temperatures.rrd:hums4:AVERAGE \
DEF:e=/home/pi/weather/temperatures.rrd:hums5:AVERAGE \
DEF:f=/home/pi/weather/temperatures.rrd:hums6:AVERAGE \
XPORT:a:"Livingroom" \
XPORT:b:"Outside" \
XPORT:c:"Bathroom" \
XPORT:d:"Bedroom" \
XPORT:e:"Staircase" \
XPORT:f:"Basement" > humid1w.xml
rrdtool xport -s now-1month -e now --step 10800 \
DEF:a=/home/pi/weather/temperatures.rrd:hums1:AVERAGE \
DEF:b=/home/pi/weather/temperatures.rrd:hums2:AVERAGE \
DEF:c=/home/pi/weather/temperatures.rrd:hums3:AVERAGE \
DEF:d=/home/pi/weather/temperatures.rrd:hums4:AVERAGE \
DEF:e=/home/pi/weather/temperatures.rrd:hums5:AVERAGE \
DEF:f=/home/pi/weather/temperatures.rrd:hums6:AVERAGE \
XPORT:a:"Livingroom" \
XPORT:b:"Outside" \
XPORT:c:"Bathroom" \
XPORT:d:"Bedroom" \
XPORT:e:"Staircase" \
XPORT:f:"Basement" > humid1m.xml
rrdtool xport -s now-3month -e now --step 43200 \
DEF:a=/home/pi/weather/temperatures.rrd:hums1:AVERAGE \
DEF:b=/home/pi/weather/temperatures.rrd:hums2:AVERAGE \
DEF:c=/home/pi/weather/temperatures.rrd:hums3:AVERAGE \
DEF:d=/home/pi/weather/temperatures.rrd:hums4:AVERAGE \
DEF:e=/home/pi/weather/temperatures.rrd:hums5:AVERAGE \
DEF:f=/home/pi/weather/temperatures.rrd:hums6:AVERAGE \
XPORT:a:"Livingroom" \
XPORT:b:"Outside" \
XPORT:c:"Bathroom" \
XPORT:d:"Bedroom" \
XPORT:e:"Staircase" \
XPORT:f:"Basement" > humid3m.xml
rrdtool xport -s now-1year -e now --step 86400 \
DEF:a=/home/pi/weather/temperatures.rrd:hums1:AVERAGE \
DEF:b=/home/pi/weather/temperatures.rrd:hums2:AVERAGE \
DEF:c=/home/pi/weather/temperatures.rrd:hums3:AVERAGE \
DEF:d=/home/pi/weather/temperatures.rrd:hums4:AVERAGE \
DEF:e=/home/pi/weather/temperatures.rrd:hums5:AVERAGE \
DEF:f=/home/pi/weather/temperatures.rrd:hums6:AVERAGE \
XPORT:a:"Livingroom" \
XPORT:b:"Outside" \
XPORT:c:"Bathroom" \
XPORT:d:"Bedroom" \
XPORT:e:"Staircase" \
XPORT:f:"Basement" > humid1y.xml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment