0

I'm storing some simple temperature values in an RRDtool GAUGE:

DS:temperature:GAUGE:600:50:90

The values I'm putting in are tempreatures with a few decimal points of precision, between 50 and 90, as shown in the above DS. When I fetch, RRDtool gives me values back that are in scientific (exponent) notation:

~$ rrdtool fetch tmp/temp.rrd AVERAGE --start 1404784800 --end `date +%s`
1404784800: 7.8472672909e+01
1404786600: 7.6521632364e+01
1404788400: 7.5231260078e+01

How do I get RRDtool to display normal numbers, not in scientific notation?

Drew Stephens
  • 17,207
  • 15
  • 66
  • 82

1 Answers1

1

I used the sprintf() function in awk to easily reformat from scientific notation to normal decimals:

~$ rrdtool fetch tmp/temp.rrd AVERAGE --start 1404784800 --end `date +%s`|awk '{printf "%.1f\n", $2;}'
78.5
76.5
75.2

That awk command prints out the second value on each line (the temperature value that is in scientific notation) and runs it through sprintf(), which outputs it as a non-scientific notation number, with just a single digit after the decimal.

Drew Stephens
  • 17,207
  • 15
  • 66
  • 82