[mrtg] Convert temperature from C to F

Steve Shipway s.shipway at auckland.ac.nz
Wed Dec 16 20:55:24 CET 2009

This is easy -- if you are using Routers2 as your frontend :)

There are the extended options, c2fi and c2fo that convert the in and out values from Celsius to Farenheit, for the benefit of USAians, at display time, for precisely this purpose.  It also has the rather nice side benefit that you can get the frontend to produce two separate graphs, one in Celsius and one in Farenheit, or else have a dual graph showing two separate scales (if you have v2.20 or later which has dual axis support).  This is details as an advanced example in the MRTG/RRD/Routers2 book.
To use these options, you'll just need to have routers.cgi*Options[]:c2fo and then appropriately change the ShortLegend and YLegend.  You will porbably also want the extended option 'fixunit' if the temperature changes are small to prevent the 'milli-' prefix.


From: mrtg-bounces at lists.oetiker.ch [mrtg-bounces at lists.oetiker.ch] On Behalf Of Lyle Giese [lyle at lcrcomputer.net]
Sent: Thursday, 17 December 2009 8:16 a.m.
To: Mrtg List
Subject: [mrtg] Convert temperature from C to F

I have some APC SmartUPS's that I monitor with MRTG(I have SNMP cards in
them).  I live in the US and we normally look at temperature in F.  I am
running mrtg in rrd mode now and using routers2.cgi

I know the math can be done using this formula  (((temp / 5) * 9) + 32),
but the data in the rrd databases is already in C and if I apply this to
the data as it's gathered, then the temperature is stored in F instead.
Not my first choice.  Also, am not 100% certain that if I just put / 5 *
9 + 32, would that be applied to the data properly?  This is not
something I want to play with on the fly here without some other opinions.

Or is there a way to apply the conversion to the graphs as they are
generated to convert from C to F?

Lyle Giese

mrtg mailing list
mrtg at lists.oetiker.ch

More information about the mrtg mailing list