logo       

Re: Temperatures plugin: msg#00030

db.rddtool.munin.general

Subject: Re: Temperatures plugin

On Fri, 08 Dec 2006, Bjørn Ruberg wrote:

> S. Banerian wrote:
>
> >actually, i needed to modify the regex just a little:
> >if ($response->content =~
> >/Temperature:\s*(\d+\.+\d+)\s*F\s*\(\s*(\d+\.+\d+)\s*C/) {
>
> Thanks for your input. Seems like we also forgot degrees below zero,
> which this regexp will handle:
>
> if ($response->content =~
> /Temperature:\s*(\-?\d+(?:\.\d+)?)\s*F\s*\(\s*(\-?\d+(?:\.\d+)?)\s*C/) {
>
> # munin-run temperatures
> ENGM.value 5
> KNYC.value -3.3
>

I was able to reproduce the error on munin 1.2.3. On munin 1.3.3
everything worked just fine.

Since the regexp is greedy, there should be no need to specify type of
result and/or minus. The regexp need only a minor change:

from: if ($response->content =~ /Temperature:\s*(.*)\s*F\s*\(\s*(.*)\s*C/) {
to: if ($response->content =~ /Temperature:\s*(.*)\s+F\s*\(\s*(.*)\s+C/) {

Fixed plugin uploaded to muninexchange.

--
Lars Strand

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise