<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">One of the things that bugs me is that lastupdate isn't available in the perl RRDs;<div><br></div><div>So I've hacked this together. &nbsp;I'm not the greatest perl person so any criticism, corrections or improvements are greatly welcome. &nbsp;</div><div><br></div><div>When you run this you get the last updated timestamp as $ts and the values in the rrd file in the %rrdhash.</div><div><br></div><div><br></div><div><div>use RRDs;</div><div><br></div><div>my $file = 'path/and/filename/of/rrd/file.rrd';</div><div>my $ts;</div><div>my %rrdhash;</div><div>my @values;</div><div>my @keys;</div><div>my @i=0;</div><div><br></div><div>open (PIPE, "/usr/bin/rrdtool lastupdate $file |") || die "can't fork: $!";</div><div>while (&lt;PIPE&gt;) {</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;chomp;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;my @temp = split;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;$i == 0 and @keys = @temp;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;$i == 2 and $ts = shift @temp;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;$ts =~ s/[^0-9]//;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;$i == 2 and @values = @temp;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;$i++;</div><div>}</div><div>close PIPE &nbsp;|| die "bad rrdtool: $! $?";</div><div><br></div><div>%rrdhash = map { $keys[$_] =&gt; $values[$_] }0..$#keys;</div><div><br></div><div><br></div><div>Take care,&nbsp;</div><div><br></div><div>Sean</div><div><br></div><div><br></div><div>
<span class="Apple-style-span" style="font-family: 'Lucida Grande'; font-size: 10px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Lucida Grande'; font-size: 10px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Lucida Grande'; font-size: 10px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Lucida Grande'; font-size: 10px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: 'Lucida Grande'; font-size: 10px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>=======================================</div><div>Sean Whitney</div><div>PMB #120,&nbsp;16505A SE First Street<br>Vancouver, WA&nbsp; 98684</div><div>T. 360.326.2740&nbsp;</div><div>C. 360.607.7945</div><div>F. 815.364.0687</div><div>aim: seanmwhitney</div><div>email: <a href="mailto:sean@visionary-networks.com">sean@visionary-networks.com</a></div><div>skype: visionary_networks</div><div>=======================================</div><div><br class="khtml-block-placeholder"></div></div><br class="Apple-interchange-newline"></span></div></span><br class="Apple-interchange-newline"></div></span><br class="Apple-interchange-newline"></div></span><br class="Apple-interchange-newline"></div></span><br class="Apple-interchange-newline"><br class="Apple-interchange-newline">
</div>
<br></div></body></html>