<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. I'm not the greatest perl person so any criticism, corrections or improvements are greatly welcome. </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 (<PIPE>) {</div><div> chomp;</div><div> my @temp = split;</div><div> $i == 0 and @keys = @temp;</div><div> $i == 2 and $ts = shift @temp;</div><div> $ts =~ s/[^0-9]//;</div><div> $i == 2 and @values = @temp;</div><div> $i++;</div><div>}</div><div>close PIPE || die "bad rrdtool: $! $?";</div><div><br></div><div>%rrdhash = map { $keys[$_] => $values[$_] }0..$#keys;</div><div><br></div><div><br></div><div>Take care, </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, 16505A SE First Street<br>Vancouver, WA 98684</div><div>T. 360.326.2740 </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>