Create a gist now

Instantly share code, notes, and snippets.

colours=('#dd0000' '#00dd00' '#0000dd')
colours=('#e41a1c' '#377eb8' '#4daf4a' '#984ea3')
for type in humidity temperature; do
i=0
for host in 10.0.0.100 10.0.0.101 10.0.0.102 10.0.0.103; do
for sensor in DS18B20 DHT11; do
rrdtool graph temperature/$host-$sensor-$type-1d.png \
--start='end - 1 day'\
--end=now \
--title="$host - $sensor: Last Day"\
--imgformat=PNG \
DEF:series=$host-$sensor.rrd:$type:AVERAGE \
LINE:series#dd0000
done
done
done
for type in humidity temperature; do
for sensor in DS18B20 DHT11; do
i=0
defs=""
lines=""
for host in 10.0.0.100 10.0.0.101 10.0.0.102 10.0.0.103; do
colour=${colours[i]}
defs="$defs DEF:s$i=$host-$sensor.rrd:$type:AVERAGE"$'\n'
lines="$lines LINE:s$i$colour:$host"$'\n'
i=$((i + 1))
done
rrdtool graph temperature/$type-$sensor-1d.png \
--start='end - 1 day'\
--end=now \
--title="$type - $sensor: Last Day"\
--imgformat=PNG \
$defs \
$lines
rrdtool graph temperature/$type-$sensor-7d.png \
--start='end - 7 day'\
--end=now \
--title="$type - $sensor: Last Week"\
--imgformat=PNG \
$defs \
$lines
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment