How to add formula in parameters of RRD graph parameters?

105 Views Asked by At
E.g. I have following code,

our $timeseries = {
   _type      => 'array',
   _pdpstep   => 300,    # Time resolution
   _heartbeat => 700,    # Time of loss before going to Unknown
   _storage   => 'day',
   _ylabel    => "dBm",
   _mandatory => 'yes',

   # hwEntityOpticalRxPower dBm * 100
   ahwEORxPowre    => { label      => 'Rx Power',
                        type       => 'GAUGE',
                        probe      => '1.2.3.4.5.6.7.8',
                        min        => -3999,
                        multiplier => 0.01,
                      },

   # hwEntityOpticalTxPower dBm * 100
   bhwEOTxPower    => { label      => 'Tx Power',
                        type       => 'GAUGE',
                        probe      => '1.2.3.4.5.6.7.8',
                        # -4000 means no signal
                        min        => -3999,
                        multiplier => 0.01,
                      },

};

This data is in mw(milliwatts) and I want to convert it into decibel-milliwatts (dBm), To do that I have added multiplier with 0.01 value. but its not converting value in dBm. How can I do that? Can I add any formula here ?

1

There are 1 best solutions below

0
On

use a sub routine and pass the data to it.

data => calc(0.01),

then somewhere else define the sub routine

sub calc
{
    my $var = shift;
    return $var+100;
}