noc.core.script.metrics

Module Contents

noc.core.script.metrics.percent(value, total)
Convert absolute and total values to percent
noc.core.script.metrics.percent_usage(value, total)
Convert avail and usage values to percent
noc.core.script.metrics.percent_invert(value, total)
Convert avail and total values to percent
noc.core.script.metrics.convert_percent_str(x)
Convert 09% to 9.0 value
Convert 09 to 9.0 value
If x = None, return 0
noc.core.script.metrics.sum(*args)
Returns sum of all arguments
noc.core.script.metrics.subtract(*args)
Subtract from first arguments
noc.core.script.metrics.is1(x)
noc.core.script.metrics.invert0(x)
Invert 0 -> 1 if OK = 0, FALSE > 1
noc.core.script.metrics.scale(n)
High-order function to scale result to arbitrary value.

f = scale(10) f(5) -> 50

Parameters:x – Scaling factor
Returns:Callable, performing scaling