Created
February 11, 2017 10:50
-
-
Save mkf/f08675ab2b42966e9b5b98d230b96159 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=hey | |
[Service] | |
Type=oneshot | |
ExecStart=/home/mf/temperatury.sh | |
User=mf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
read temp < /sys/class/thermal/thermal_zone0/temp | |
rrdtool update /home/mf/temperatury.rrd N:$temp | |
#perl -e 'sleep 10 - time % 10' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=hey run temperatury | |
[Timer] | |
OnBootSec=10 | |
OnUnitActiveSec=3 | |
[Install] | |
WantedBy=timers.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import rrdtool | |
for shed in ['minutely', 'daily', 'weekly', 'hourly']: | |
if shed=='weekly': | |
period = '1w' | |
elif shed=='daily': | |
period = '1d' | |
elif shed=='monthly': | |
period='1m' | |
elif shed=="hourly": | |
period="6000" | |
elif shed=='minutely': | |
period='1800' | |
ret=rrdtool.graph("/srv/http/temp-%s.png" %(shed), "--start", "-%s" %(period), | |
"-S 20", | |
"-w 1000", | |
"-h 800", | |
"DEF:tempa=/home/mf/temperatury.rrd:temp:AVERAGE", | |
"DEF:tempi=/home/mf/temperatury.rrd:temp:MIN", | |
"DEF:tempx=/home/mf/temperatury.rrd:temp:MAX", | |
"LINE1:tempa#aaaa00:tempa\r", | |
"LINE2:tempi#0000ff:tempi\r", | |
"LINE3:tempx#ff0000:tempx\r" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=hey | |
[Service] | |
Type=oneshot | |
ExecStart=/usr/bin/python2 /home/mf/tempergraph.py | |
User=root | |
Group=wheel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=hey run temperatury | |
[Timer] | |
OnBootSec=60 | |
OnUnitActiveSec=120 | |
[Install] | |
WantedBy=timers.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mf ~ rrdtool create temperatury.rrd \ | |
> --start 1486804613 \ | |
> --step 10 \ | |
> DS:temp:GAUGE:60:120:200000 \ | |
> RRA:AVERAGE:0.1:1:180 \ | |
> RRA:AVERAGE:0.1:12:90 \ | |
> RRA:AVERAGE:0.1:60:60 \ | |
> RRA:AVERAGE:0.001:120:10000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment