<div dir="ltr"><div><div>Hi there Everyone,<br><br></div>Hoping someone can help me out. I'm trying to build up graphs on a Raspberry Pi (2B) running Rasbian Jessie.<br><br></div>I'm using cron to run a script every 5 minutes to get some values and update the RRD files and then draw the graphs.<br><p>My script to populate the RRAs in the RRD:</p>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><pre style="" class=""><code><span class="">#! /bin/bash</span><span class="">
LOAD</span><span class="">=</span><span class="">`cat /proc/loadavg | awk '{print $1}'`</span><span class="">
RXBYTES</span><span class="">=</span><span class="">`cat /sys/class/net/eth0/statistics/rx_bytes`</span><span class="">
TXBYTES</span><span class="">=</span><span class="">`cat /sys/class/net/eth0/statistics/tx_bytes`</span><span class="">
TEMP</span><span class="">=</span><span class="">`/opt/vc/bin/vcgencmd measure_temp|cut -c6-9`</span><span class="">
MEM</span><span class="">=</span><span class="">`free -b | grep Mem | awk '{print $4/$2 * 100.0}'`</span><span class="">
</span><span class="">/</span><span class="">usr</span><span class="">/</span><span class="">bin</span><span class="">/</span><span class="">rrdtool update load</span><span class="">.</span><span class="">rrd N</span><span class="">:</span><span class="">$LOAD
</span><span class="">/</span><span class="">usr</span><span class="">/</span><span class="">bin</span><span class="">/</span><span class="">rrdtool update data</span><span class="">.</span><span class="">rrd </span><span class="">-</span><span class="">t datadown</span><span class="">:</span><span class="">dataup N</span><span class="">:</span><span class="">$RXBYTES</span><span class="">:</span><span class="">$TXBYTES
</span><span class="">/</span><span class="">usr</span><span class="">/</span><span class="">bin</span><span class="">/</span><span class="">rrdtool update pitemp</span><span class="">.</span><span class="">rrd N</span><span class="">:</span><span class="">$TEMP
</span><span class="">/</span><span class="">usr</span><span class="">/</span><span class="">bin</span><span class="">/</span><span class="">rrdtool update mem</span><span class="">.</span><span class="">rrd N</span><span class="">:</span><span class="">$MEM
echo $LOAD
echo $RXBYTES
echo $TXBYTES
echo $TEMP
echo $MEM</span></code></pre></blockquote><p>As you can see, I'm drawing graphs for:</p>
<ul><li>Load Averages</li><li>Data Throughput Counter</li><li>CPU/GPU/SoC Temperature</li><li>Memory Percentage</li></ul>
<p>As well as outputting the values to the terminal as a confirmation that the values being passed are numbers.</p>
<p>So I run the script and get this:</p>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><pre style="" class=""><code><span class="">0.36</span><span class="">
</span><span class="">2665426950</span><span class="">
</span><span class="">1669124151</span><span class="">
</span><span class="">41.7</span><span class="">
</span><span class="">2.36093</span></code></pre></blockquote>
<p>This all looks fine, especially as there are no data type definitions
in bash (so no need to worry about integers/doubles/strings/etc). I
then run the script to draw the graphs:</p>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><pre style="" class=""><code><span class="">#! /bin/bash</span><span class="">
</span><span class="">/</span><span class="">usr</span><span class="">/</span><span class="">bin</span><span class="">/</span><span class="">rrdtool graph </span><span class="">'data.png'</span><span class=""> \
</span><span class="">--</span><span class="">title </span><span class="">'Odin traffic (eth0)'</span><span class=""> \
</span><span class="">--</span><span class="">watermark </span><span class="">"Graph Drawn `date`"</span><span class=""> \
</span><span class="">--</span><span class="">vertical</span><span class="">-</span><span class="">label </span><span class="">'Bytes'</span><span class=""> \
</span><span class="">--</span><span class="">alt</span><span class="">-</span><span class="">autoscale \
</span><span class="">--</span><span class="">units</span><span class="">=</span><span class="">si \
</span><span class="">--</span><span class="">width </span><span class="">'640'</span><span class=""> \
</span><span class="">--</span><span class="">height </span><span class="">'300'</span><span class=""> \
</span><span class="">--</span><span class="">full</span><span class="">-</span><span class="">size</span><span class="">-</span><span class="">mode \
</span><span class="">--</span><span class="">start end</span><span class="">-</span><span class="">172800s</span><span class=""> \
</span><span class="">'DEF:rx=data.rrd:datadown:AVERAGE'</span><span class=""> \
</span><span class="">'DEF:tx=data.rrd:dataup:AVERAGE'</span><span class=""> \
</span><span class="">'AREA:rx#FF0000FF:Tx\:'</span><span class=""> \
</span><span class="">'GPRINT:tx:LAST:\:%8.2lf %s]'</span><span class=""> \
</span><span class="">'STACK:tx#0709FDFF:Rx\:'</span><span class=""> \
</span><span class="">'GPRINT:rx:LAST:\:%8.2lf %s]\n'</span><span class="">
</span><span class="">/</span><span class="">usr</span><span class="">/</span><span class="">bin</span><span class="">/</span><span class="">rrdtool graph </span><span class="">'load.png'</span><span class=""> \
</span><span class="">--</span><span class="">title </span><span class="">'Odin Load Average'</span><span class=""> \
</span><span class="">--</span><span class="">watermark </span><span class="">"Graph Drawn `date`"</span><span class=""> \
</span><span class="">--</span><span class="">alt</span><span class="">-</span><span class="">autoscale \
</span><span class="">--</span><span class="">width </span><span class="">'640'</span><span class=""> \
</span><span class="">--</span><span class="">height </span><span class="">'300'</span><span class=""> \
</span><span class="">--</span><span class="">full</span><span class="">-</span><span class="">size</span><span class="">-</span><span class="">mode \
</span><span class="">--</span><span class="">start end</span><span class="">-</span><span class="">172800s</span><span class=""> \
</span><span class="">'DEF:load=load.rrd:load:AVERAGE'</span><span class=""> \
</span><span class="">'AREA:load#FF0000FF:Load Average\:'</span><span class=""> \
</span><span class="">'GPRINT:load:LAST:\:%8.2lf %s]'</span><span class="">
</span><span class="">/</span><span class="">usr</span><span class="">/</span><span class="">bin</span><span class="">/</span><span class="">rrdtool graph </span><span class="">'mem.png'</span><span class=""> \
</span><span class="">--</span><span class="">title </span><span class="">'Odin Memory Usage'</span><span class=""> \
</span><span class="">--</span><span class="">watermark </span><span class="">"Graph Drawn `date`"</span><span class=""> \
</span><span class="">--</span><span class="">vertical</span><span class="">-</span><span class="">label </span><span class="">'%'</span><span class=""> \
</span><span class="">--</span><span class="">upper</span><span class="">-</span><span class="">limit </span><span class="">'100'</span><span class=""> \
</span><span class="">--</span><span class="">lower</span><span class="">-</span><span class="">limit </span><span class="">'0'</span><span class=""> \
</span><span class="">--</span><span class="">width </span><span class="">'640'</span><span class=""> \
</span><span class="">--</span><span class="">height </span><span class="">'300'</span><span class=""> \
</span><span class="">--</span><span class="">full</span><span class="">-</span><span class="">size</span><span class="">-</span><span class="">mode \
</span><span class="">--</span><span class="">start end</span><span class="">-</span><span class="">172800s</span><span class=""> \
</span><span class="">'DEF:mem=mem.rrd:mem:AVERAGE'</span><span class=""> \
</span><span class="">'AREA:mem#FF0000FF:Memory\:'</span><span class=""> \
</span><span class="">'GPRINT:mem:LAST:\:%8.2lf %s]'</span><span class="">
</span><span class="">/</span><span class="">usr</span><span class="">/</span><span class="">bin</span><span class="">/</span><span class="">rrdtool graph </span><span class="">'pitemp.png'</span><span class=""> \
</span><span class="">--</span><span class="">title </span><span class="">'Odin SoC Temperature'</span><span class=""> \
</span><span class="">--</span><span class="">watermark </span><span class="">"Graph Drawn `date`"</span><span class=""> \
</span><span class="">--</span><span class="">vertical</span><span class="">-</span><span class="">label </span><span class="">'°C'</span><span class=""> \
</span><span class="">--</span><span class="">alt</span><span class="">-</span><span class="">autoscale \
</span><span class="">--</span><span class="">width </span><span class="">'640'</span><span class=""> \
</span><span class="">--</span><span class="">height </span><span class="">'300'</span><span class=""> \
</span><span class="">--</span><span class="">full</span><span class="">-</span><span class="">size</span><span class="">-</span><span class="">mode \
</span><span class="">--</span><span class="">start end</span><span class="">-</span><span class="">172800s</span><span class=""> \
</span><span class="">'DEF:pitemp=pitemp.rrd:pitemp:AVERAGE'</span><span class=""> \
</span><span class="">'AREA:pitemp#FF0000FF:CPU/GPU Temperature\:'</span><span class=""> \
</span><span class="">'GPRINT:pitemp:LAST:\:%8.2lf %s]'</span></code></pre></blockquote>
<p>I get the expected output:</p>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><pre style="" class=""><code><span class="">640x300</span><span class="">
</span><span class="">640x300</span><span class="">
</span><span class="">640x300</span><span class="">
</span><span class="">640x300</span></code></pre></blockquote>
<p>But when I view the graphs (all of them are like the one below), all
the values are not numbers (nan). Any help would be appreciated.</p>
<p><a href="http://i.stack.imgur.com/qWl8l.png" rel="nofollow"><img src="http://i.stack.imgur.com/qWl8l.png" alt="Data Throughput Counter Graph"></a>
<a href="http://i.stack.imgur.com/nR1Z7.png" rel="nofollow"><img src="http://i.stack.imgur.com/nR1Z7.png" alt="Load Average Graph"></a>
<a href="http://i.stack.imgur.com/9KQfe.png" rel="nofollow"><img src="http://i.stack.imgur.com/9KQfe.png" alt="Memory Usage Percentage Graph"></a>
<a href="http://i.stack.imgur.com/5TJua.png" rel="nofollow"><img src="http://i.stack.imgur.com/5TJua.png" alt="SoC Temperature Graph"></a></p><p><br></p><p>Regards,</p><p>Jim</p><p><br></p><p>P.S. I'll be cleaning up the formatting of the graphs themselves once i get the values to start displaying.</p><p><a href="http://i.stack.imgur.com/5TJua.png" rel="nofollow"></a></p><div><div><div><div>
</div></div></div></div></div>