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,
},
};
此数据在MW(毫米)中,我想将其转换为Descibel-Milliwatts(DBM),为此,我添加了具有0.01值的乘数。但是它不是在DBM中转换值。我怎样才能做到这一点?我可以在这里添加任何公式吗?
使用子例程并将数据传递给它。
data => calc(0.01),
然后在其他地方定义子例程
sub calc
{
my $var = shift;
return $var+100;
}