Har ett litet problem med mina grafer, de blir väldigt taggiga, hur fixar man det?
Se exempel på http://winserv.9c.se
Jag har lagt upp det så här i crontab
Kod: Markera allt
*/1.5 * * * *
Kör så på scriptet som skapar png filen och hämtar temperaturen.
Min rrd fil.
Kod: Markera allt
filename = "outside_temp.rrd"
rrd_version = "0003"
step = 150
last_update = 1362842943
header_size = 2872
ds[outsidetemp].index = 0
ds[outsidetemp].type = "GAUGE"
ds[outsidetemp].minimal_heartbeat = 300
ds[outsidetemp].min = -5.0000000000e+01
ds[outsidetemp].max = 6.0000000000e+01
ds[outsidetemp].last_ds = "1.57"
ds[outsidetemp].value = 1.4653112853e+02
ds[outsidetemp].unknown_sec = 0
rra[0].cf = "AVERAGE"
rra[0].rows = 576
rra[0].cur_row = 74
rra[0].pdp_per_row = 1
rra[0].xff = 5.0000000000e-01
rra[0].cdp_prep[0].value = NaN
rra[0].cdp_prep[0].unknown_datapoints = 0
rra[1].cf = "AVERAGE"
rra[1].rows = 2016
rra[1].cur_row = 550
rra[1].pdp_per_row = 2
rra[1].xff = 5.0000000000e-01
rra[1].cdp_prep[0].value = 1.5923928713e+00
rra[1].cdp_prep[0].unknown_datapoints = 0
rra[2].cf = "AVERAGE"
rra[2].rows = 52560
rra[2].cur_row = 35651
rra[2].pdp_per_row = 4
rra[2].xff = 5.0000000000e-01
rra[2].cdp_prep[0].value = 4.6469872468e+00
rra[2].cdp_prep[0].unknown_datapoints = 0
rra[3].cf = "AVERAGE"
rra[3].rows = 175200
rra[3].cur_row = 156821
rra[3].pdp_per_row = 24
rra[3].xff = 5.0000000000e-01
rra[3].cdp_prep[0].value = 1.7812978850e+01
rra[3].cdp_prep[0].unknown_datapoints = 0
rra[4].cf = "MAX"
rra[4].rows = 5760
rra[4].cur_row = 4278
rra[4].pdp_per_row = 1
rra[4].xff = 5.0000000000e-01
rra[4].cdp_prep[0].value = NaN
rra[4].cdp_prep[0].unknown_datapoints = 0
rra[5].cf = "MAX"
rra[5].rows = 2016
rra[5].cur_row = 1761
rra[5].pdp_per_row = 2
rra[5].xff = 5.0000000000e-01
rra[5].cdp_prep[0].value = 1.5923928713e+00
rra[5].cdp_prep[0].unknown_datapoints = 0
rra[6].cf = "MAX"
rra[6].rows = 52560
rra[6].cur_row = 4686
rra[6].pdp_per_row = 4
rra[6].xff = 5.0000000000e-01
rra[6].cdp_prep[0].value = 1.5923928713e+00
rra[6].cdp_prep[0].unknown_datapoints = 0
rra[7].cf = "MAX"
rra[7].rows = 175200
rra[7].cur_row = 140712
rra[7].pdp_per_row = 24
rra[7].xff = 5.0000000000e-01
rra[7].cdp_prep[0].value = 1.7609123530e+00
rra[7].cdp_prep[0].unknown_datapoints = 0
rra[8].cf = "MIN"
rra[8].rows = 5760
rra[8].cur_row = 601
rra[8].pdp_per_row = 1
rra[8].xff = 5.0000000000e-01
rra[8].cdp_prep[0].value = NaN
rra[8].cdp_prep[0].unknown_datapoints = 0
rra[9].cf = "MIN"
rra[9].rows = 2016
rra[9].cur_row = 900
rra[9].pdp_per_row = 2
rra[9].xff = 5.0000000000e-01
rra[9].cdp_prep[0].value = 1.5923928713e+00
rra[9].cdp_prep[0].unknown_datapoints = 0
rra[10].cf = "MIN"
rra[10].rows = 52560
rra[10].cur_row = 47410
rra[10].pdp_per_row = 4
rra[10].xff = 5.0000000000e-01
rra[10].cdp_prep[0].value = 1.5013064638e+00
rra[10].cdp_prep[0].unknown_datapoints = 0
rra[11].cf = "MIN"
rra[11].rows = 175200
rra[11].cur_row = 23614
rra[11].pdp_per_row = 24
rra[11].xff = 5.0000000000e-01
rra[11].cdp_prep[0].value = 1.4866955796e+00
rra[11].cdp_prep[0].unknown_datapoints = 0
emil@ubuntu:~/rrddata$
Kod: Markera allt
#!/usr/bin/perl
use RRDs;
my $cur_time = time();
my $start_time = $cur_time - 86400; # set end time to 24 hours ago
RRDs::graph "/var/www/graph_temp.png",
"--start= $start_time",
"--end= $cur_time",
"--title= Outside forradet",
"--height= 300",
"--width= 500",
"--vertical-label= �C",
"DEF:OutsideTemp=/home/emil/rrddata/outside_temp.rrd:outsidetemp:AVERAGE",
"COMMENT:\t\t\t\tNu Medel Max Min\\n",
"HRULE:0#0000FF",
"LINE2:OutsideTemp#0000FF:Ute\t\t\t",
"GPRINT:OutsideTemp:LAST:%6.1lf",
"GPRINT:OutsideTemp:AVERAGE:%6.1lf",
"GPRINT:OutsideTemp:MAX:%6.1lf",
"GPRINT:OutsideTemp:MIN:%6.1lf\\n";
my $err=RRDs::error;
if ($err) {print "problem generating the graph: $err\n";}
print "Done!\n"