<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 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:\5B8B\4F53;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:\5B8B\4F53;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"\@\5B8B\4F53";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        text-align:justify;
        text-justify:inter-ideograph;
        font-size:10.5pt;
        font-family:"Calibri","sans-serif";}
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.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;}
/* Page Definitions */
@page Section1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.Section1
        {page:Section1;}
-->
</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 lang=ZH-CN link=blue vlink=purple style='text-justify-trim:punctuation'>
<div class=Section1>
<p class=MsoNormal><span lang=EN-US>hi!<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>create a rrd database with the following
statement:<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>#!/bin/sh<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>start=`date +'00:00 %m/%e/%Y'`<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>/usr/bin/rrdtool create $1.rrd \<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> --start "$start" \<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> --step 300 \<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> DS:total:GAUGE:600:0:U \<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> DS:new:GAUGE:600:0:U \<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> RRA:LAST:0.5:1:288 \<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> RRA:LAST:0.5:12:720 \<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> RRA:LAST:0.5:288:37200 \<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> RRA:AVERAGE:0.5:1:288 \<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> RRA:AVERAGE:0.5:12:720 \<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> RRA:AVERAGE:0.5:288:37200<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>when fetch data between several days with rrd_fetch,
rrd_fecth will crash. gdb the core file, finally I found that there is a overflow
in rrd_fetch.c. here is the patch<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>[CODE]<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>diff -Nur
rrdtool-1.3.4/rrdtool-1.3.4/src/rrd_fetch.c
rrdtool-1.3.4_/rrdtool-1.3.4/src/rrd_fetch.c<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>---
rrdtool-1.3.4/rrdtool-1.3.4/src/rrd_fetch.c Sun
Oct 5 00:04:04 2008<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>+++
rrdtool-1.3.4_/rrdtool-1.3.4/src/rrd_fetch.c Tue Nov 25 16:55:04
2008<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>@@ -345,7 +345,7 @@<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> rra_start_time =
(rra_end_time<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>
- (*step * (rrd.rra_def[chosen_rra].row_cnt - 1)));<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> /* here's an error
by one if we don't be careful */<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>- start_offset = (long)
(*start + *step - rra_start_time) / (long) *step;<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>+ start_offset =
(long)(((double)(*start)/(long)*step) + 1 -
((double)(rra_start_time)/(long)*step));<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> end_offset =
(long) (rra_end_time - *end) / (long) *step;<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> #ifdef DEBUG<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US> fprintf(stderr,<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>[/CODE]<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>--<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>zou guangxian <o:p></o:p></span></p>
</div>
</body>
</html>