<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:PMingLiU;
        panose-1:2 2 5 0 0 0 0 0 0 0;}
@font-face
        {font-family:PMingLiU;
        panose-1:2 2 5 0 0 0 0 0 0 0;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"\@PMingLiU";
        panose-1:2 2 5 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.hps
        {mso-style-name:hps;}
span.ita-kd-inputtools-div
        {mso-style-name:ita-kd-inputtools-div;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body bgcolor=white lang=EN-NZ link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>The problem you have is that by default, when you create the RRD, the last update time is set to ‘now’. It sets up an initial set of ‘unkown’ RRA stretching back intime from the last update time.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Then you subsequently use ‘rrdtool first’ which returns the time of the START of the RRA, and attempt to update using this. <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Of course, it does not work, because this time is in the past, and you can only update by adding new records with a time after the LAST update.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>This is probably counterintuitive to you, as you might think you need to allocate the records that you are intending to update in advance. In fact, with RRDtool, you do not do this and records are automatically created and expired by the RRD mechanism.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>So, rather than using ‘rrdtool first’, try using ‘rrdtool lastupdate’ and incrementing from that.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Steve<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div><p class=MsoNormal><b><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Steve Shipway<o:p></o:p></span></b></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>s.shipway@auckland.ac.nz<o:p></o:p></span></p></div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div style='border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt'><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext'> rrd-users-bounces+s.shipway=auckland.ac.nz@lists.oetiker.ch [mailto:rrd-users-bounces+s.shipway=auckland.ac.nz@lists.oetiker.ch] <b>On Behalf Of </b>spiderslack<br><b>Sent:</b> Friday, 27 June 2014 8:23 a.m.<br><b>To:</b> rrd-users@lists.oetiker.ch<br><b>Subject:</b> [rrd-users] doubt behavior database RRD<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Hi all.<br><br>i testing the database rrd. I create the shellscript follow bellow:<br><br><br>------------------- test.sh ----------------------<br>set -x<br>ARQUIVO_RRD="kakaroto.rrd"<br>rm $ARQUIVO_RRD<br>rrdtool create $ARQUIVO_RRD \<br> --start N --step 15 \<br> DS:dados:COUNTER:20:U:U \<br> RRA:AVERAGE:0.5:1:60 \<br><br><br>date +%s<br>INICIO=$( rrdtool first $ARQUIVO_RRD )<br>ATUAL=$INICIO<br>sleep 15<br>INICIO=$( expr $INICIO + 15)<br>rrdtool update $ARQUIVO_RRD $INICIO:10<br>---------------------------------------------------<br><br>when execute the shell script<br><br>--------------------<br>[ricardobarbosa@shark transito]$ bash eeee.sh<br>+ ARQUIVO_RRD=kakaroto.rrd<br>+ rm kakaroto.rrd<br>+ rrdtool create kakaroto.rrd --start N --step 15 DS:dados:COUNTER:20:U:U RRA:AVERAGE:0.5:1:60<br>+ date +%s<br>1403813403<br>++ rrdtool first kakaroto.rrd<br>+ INICIO=1403812515<br>+ ATUAL=1403812515<br>+ sleep 15<br>++ expr 1403812515 + 15<br>+ INICIO=1403812530<br>+ rrdtool update kakaroto.rrd 1403812530:10<br>ERROR: kakaroto.rrd: illegal attempt to update using time 1403812530 when last update time is 1403813403 (minimum one second step)<br>[ricardobarbosa@shark transito]$<br>---------------------------<br>[ricardobarbosa@shark transito]$ bash eeee.sh<br>+ ARQUIVO_RRD=kakaroto.rrd<br>+ rm kakaroto.rrd<br>+ rrdtool create kakaroto.rrd --start N --step 15 DS:dados:COUNTER:20:U:U RRA:AVERAGE:0.5:1:60<br>+ date +%s<br>1403813422<br>++ rrdtool first kakaroto.rrd<br>+ INICIO=1403812530<br>+ ATUAL=1403812530<br>+ sleep 15<br>++ expr 1403812530 + 15<br>+ INICIO=1403812545<br>+ rrdtool update kakaroto.rrd 1403812545:10<br>ERROR: kakaroto.rrd: illegal attempt to update using time 1403812545 when last update time is 1403813422 (minimum one second step)<br>[ricardobarbosa@shark transito]$<br><br><br>--------------------<br><br>The value th output command (rrdtool first) is correct?<span class=hps><span lang=EN> should not be</span></span><span lang=EN> <span class=hps>the current</span> <span class=hps>epoch</span>, since it was <span class=hps>not</span> <span class=hps>updated</span> <span class=hps>anything in the</span> <span class=hps>file.</span> <span class=hps>rrd</span>?<br><br><span class=hps>in the last</span> <span class=hps>example</span> <span class=hps>the timestamp</span> <span class=hps>used</span> <span class=hps>when</span> <span class=hps>creating the</span> <span class=hps>rrd</span> <span class=hps>file is</span> <span class=hps>1403813422</span>, but <span class=hps>the</span> <span class=hps>output of</span> <span class=hps>command</span> <span class=hps>(rrdtool first)</span> <span class=hps>he shows how</span> <span class=hps>the timestamp</span> <span class=hps>1403812530</span> <span class=hps>is smaller.</span> <span class=hps>The value of the</span> <span class=hps>output</span> <span class=hps>of the command (</span>rrdtool <span class=hps>first)</span> <span class=hps>should not be</span> <span class=hps>at least</span> <span class=hps>1403813XXX.</span><br><br></span><o:p></o:p></p><div id=gt-res-content><div><p class=MsoNormal><span class=hps><span lang=EN>each</span></span><span lang=EN> <span class=hps>execution of the script</span> <span class=hps>I delete</span> <span class=hps>the</span> <span class=hps>rrd</span> <span class=hps>file.</span> <span class=hps>he should not</span> <span class=hps>reset</span>? <span class=hps>it seems that</span> <span class=hps>he is</span> <span class=hps>guarding the</span> <span class=hps>first</span> <span class=hps>of the previous file</span>. <span class=hps>If</span> <span class=hps>someone can</span> <span class=hps>help me understand</span> <span class=hps>I thank</span>.</span><o:p></o:p></p></div></div><p class=MsoNormal><span lang=EN><br><span class=hps>Regards.</span><br><br></span><o:p></o:p></p></div></div></body></html>