<HTML>
<HEAD>
<TITLE>Re: [rrd-users] LAST always returning zero</TITLE>
</HEAD>
<BODY>
<FONT FACE="Arial"><SPAN STYLE='font-size:12.0px'>I thought it was working with the last changes suggested by Alex, but still not quite there.<BR>
<BR>
The first problem is that if "last / 10 * 10" returns *720, the graph/fetch tool returns me through *730 instead of *720. See the first rrdfetch below - I still get a nan.<BR>
<BR>
No problem - I'll just subtract a couple of seconds. Now I get exactly the data I'm after. However, GPRINT still randomly prints 0 instead of 1.<BR>
<BR>
In the data below, examples 2 and 5 print the correct value of 1 for queue 2. The queue2_enabled is inverted from a 0 to a 1 and GPRINT prints it correctly. In examples 3 and 4, the data is identical, but GPRINT prints a 0 instead of a 1.<BR>
<BR>
The graph looks perfect. It is just the GPRINT that is randomly wrong. Any other ideas?<BR>
<BR>
Wes<BR>
<BR>
<BR>
The command, keeping only the first two queues:<BR>
<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Arial"><SPAN STYLE='font-size:12.0px'>/usr/local/rrdtool/bin/rrdtool graph /docs/enabled.png -a PNG -l 0 -t "Disabled Queues (mmp11es)" \<BR>
DEF:queue1=/var/log/test.rrd:queue1_enabled:AVERAGE \<BR>
DEF:queue2=/var/log/test.rrd:queue2_enabled:AVERAGE \<BR>
CDEF:queue1N=queue1,UN,1,queue1,IF,0,GT,0,1,IF \<BR>
VDEF:queue1L=queue1N,LAST \<BR>
CDEF:queue2N=queue2,UN,1,queue2,IF,0,GT,0,1,IF \<BR>
VDEF:queue2L=queue2N,LAST \<BR>
AREA:queue1N#00FF00:"MTA-SunSecure-In-Polic" \<BR>
GPRINT:queue1L:'%1.0lf' \<BR>
AREA:queue2N#0000FF:"MTA-SunSecure-In-sendm":STACK \<BR>
GPRINT:queue2L:'%1.0lf' \<BR>
GPRINT:queue9L:'%1.0lf' \<BR>
--upper-limit 10 --vertical-label "xDisabled Queue Count" -w 400 -h 100 -s "now-2h" -e "1204935598"<BR>
<BR>
</SPAN></FONT></BLOCKQUOTE><FONT FACE="Arial"><SPAN STYLE='font-size:12.0px'>'end' is defined as: “int (`$RRDTOOL last $rrdFile` / 10) * 10” <BR>
<BR>
<BR>
Sample rrdfetch and debug output. Rrdfetch is using the same --end rrdgraph.<BR>
<BR>
<BR>
In this one, GPRINT prints 0 instead of the correct 1.<BR>
<BR>
--end specifies 720, but rrdfetch returns through 730. 0 expected.<BR>
<BR>
<BR>
rrdtool last: 1204934725<BR>
rounded end=1204934720<BR>
queue1_depth queue1_added queue1_removed queue1_enabled queue2_depth queue2_added queue2_removed queue2_enabled <BR>
1204934700: 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 1.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00<BR>
1204934710: 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 1.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00<BR>
1204934720: 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 1.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00<BR>
1204934730: nan nan nan nan nan nan nan nan<BR>
<BR>
<BR>
'end' is defined as: “int (`$RRDTOOL last $rrdFile` / 10) * 10 – 2”. Now it returns the correct data.<BR>
<BR>
Returns 1:<BR>
<BR>
rrdtool last: 1204934846<BR>
rounded end=1204934838<BR>
queue1_depth queue1_added queue1_removed queue1_enabled queue2_depth queue2_added queue2_removed queue2_enabled<BR>
<BR>
1204934820: 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 1.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 <BR>
1204934830: 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 1.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 <BR>
1204934840: 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 1.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 <BR>
<BR>
<BR>
Same data, but GPRINT displays ‘0’.<BR>
<BR>
rrdtool last: 1204934876<BR>
rounded end=1204934868<BR>
queue1_depth queue1_added queue1_removed queue1_enabled queue2_depth queue2_added queue2_removed queue2_enabled<BR>
<BR>
1204934850: 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 1.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 <BR>
1204934860: 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 1.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 <BR>
1204934870: 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 1.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 <BR>
<BR>
<BR>
Another 0 from GPRINT:<BR>
<BR>
rrdtool last: 1204934996<BR>
rounded end=1204934988<BR>
queue1_depth queue1_added queue1_removed queue1_enabled queue2_depth queue2_added queue2_removed queue2_enabled<BR>
<BR>
1204934960: 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 1.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 <BR>
1204934970: 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 1.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 <BR>
1204934980: 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 1.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 <BR>
1204934990: 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 1.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 <BR>
<BR>
<BR>
This time GPRINT correctly displays 1:<BR>
<BR>
rrdtool last: 1204935107<BR>
rounded end=1204935098<BR>
queue1_depth queue1_added queue1_removed queue1_enabled queue2_depth queue2_added queue2_removed queue2_enabled<BR>
<BR>
1204935080: 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 1.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00<BR>
1204935090: 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 1.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00<BR>
1204935100: 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 1.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00<BR>
</SPAN></FONT>
</BODY>
</HTML>