cmk.graphing.v1.metrics
- class AutoPrecision(digits)
A unit with auto precision rounds the fractional part to the given digits or to the latest non-zero digit.
- class Color(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)
- class Constant(title, unit, color, value)
A constant can be used within other metric operations, perfometers or graphs.
- Parameters:
Example
>>> Constant( ... Title("A title"), ... Unit(IECNotation("bits")), ... Color.BLUE, ... 23.5, ... ) Constant(title=Title('A title'), unit=Unit(notation=IECNotation(symbol='bits'), precision=AutoPrecision(digits=2)), color=<Color.BLUE: 14>, value=23.5)
- class CriticalOf(metric_name)
Extracts the critical level of a metric by its name. It can be used within other metric operations, perfometers or graphs.
- Parameters:
metric_name (
str) – Name of a metric
Example
>>> CriticalOf("metric-name") CriticalOf(metric_name='metric-name')
- class DecimalNotation(symbol)
A unit with decimal notation has no special format.
- class Difference(title, color, *, minuend, subtrahend)
Defines the metric operation difference which can be used within other metric operations, perfometers or graphs.
- Parameters:
title (
Title) – A titlecolor (
Color) – A colorminuend (
str|Constant|WarningOf|CriticalOf|MinimumOf|MaximumOf|Sum|Product|Difference|Fraction) – A metric name or objectsubtrahend (
str|Constant|WarningOf|CriticalOf|MinimumOf|MaximumOf|Sum|Product|Difference|Fraction) – A metric name or object
Example
>>> Difference( ... Title("A title"), ... Color.BLUE, ... minuend="metric-name-1", ... subtrahend="metric-name-2", ... ) Difference(title=Title('A title'), color=<Color.BLUE: 14>, minuend='metric-name-1', subtrahend='metric-name-2')
- class EngineeringScientificNotation(symbol)
A unit with the engineering scientific notation formats a number as following: m * 10**n, where 1 <= |m| < 1000 and n % 3 == 0.
- class Fraction(title, unit, color, *, dividend, divisor)
Defines the metric operation fraction which can be used within other metric operations, perfometers or graphs.
- Parameters:
title (
Title) – A titleunit (
Unit) – A unitcolor (
Color) – A colordividend (
str|Constant|WarningOf|CriticalOf|MinimumOf|MaximumOf|Sum|Product|Difference|Fraction) – A metric name or objectdivisor (
str|Constant|WarningOf|CriticalOf|MinimumOf|MaximumOf|Sum|Product|Difference|Fraction) – A metric name or object
Example
>>> Fraction( ... Title("A title"), ... Unit(IECNotation("bits")), ... Color.BLUE, ... dividend="metric-name-1", ... divisor="metric-name-2", ... ) Fraction(title=Title('A title'), unit=Unit(notation=IECNotation(symbol='bits'), precision=AutoPrecision(digits=2)), color=<Color.BLUE: 14>, dividend='metric-name-1', divisor='metric-name-2')
- class IECNotation(symbol)
A unit with the IEC notation formats a number with the following magnitudes: “”, Ki, Mi, Gi, Ti, Pi, Ei, Zi, Yi. Positive number below one use the decimal notation.
- class MaximumOf(metric_name, color)
Extracts the maximum value of a metric by its name. It can be used within other metric operations, perfometers or graphs.
- Parameters:
metric_name (
str) – Name of a metriccolor (
Color) – A color
Example
>>> MaximumOf("metric-name", Color.BLUE) MaximumOf(metric_name='metric-name', color=<Color.BLUE: 14>)
- class Metric(*, name, title, unit, color)
Instances of this class will only be picked up by Checkmk if their names start with
metric_.A metric can be used within
WarningOf,CriticalOf,MinimumOf,MaximumOf, perfometers or graphs by its name.- Parameters:
Example
>>> metric_metric_name = Metric( ... name="metric_name", ... title=Title("A metric"), ... unit=Unit(DecimalNotation("")), ... color=Color.BLUE, ... )
- class MinimumOf(metric_name, color)
Extracts the minimum value of a metric by its name. It can be used within other metric operations, perfometers or graphs.
- Parameters:
metric_name (
str) – Name of a metriccolor (
Color) – A color
Example
>>> MinimumOf("metric-name", Color.BLUE) MinimumOf(metric_name='metric-name', color=<Color.BLUE: 14>)
- class Product(title, unit, color, factors)
Defines the metric operation product which can be used within other metric operations, perfometers or graphs.
- Parameters:
Example
>>> Product( ... Title("A title"), ... Unit(IECNotation("bits")), ... Color.BLUE, ... ["metric-name-1", "metric-name-2"], ... ) Product(title=Title('A title'), unit=Unit(notation=IECNotation(symbol='bits'), precision=AutoPrecision(digits=2)), color=<Color.BLUE: 14>, factors=['metric-name-1', 'metric-name-2'])
- class SINotation(symbol)
A unit with the SI notation formats a number with the following magnitudes: y, z, a, f, p, n, µ, m, “”, k, M, G, T, P, E, Z, Y.
- class StandardScientificNotation(symbol)
A unit with the standard scientific notation formats a number as following: m * 10**n, where 1 <= |m| < 10.
- class StrictPrecision(digits)
A unit with strict precision rounds the fractional part to the given digits.
- class Sum(title, color, summands)
Defines the metric operation sum which can be used within other metric operations, perfometers or graphs.
- Parameters:
Example
>>> Sum( ... Title("A title"), ... Color.BLUE, ... ["metric-name-1", "metric-name-2"], ... ) Sum(title=Title('A title'), color=<Color.BLUE: 14>, summands=['metric-name-1', 'metric-name-2'])
- class TimeNotation
A unit with the time notation formats a number with the following magnitudes: µs, ms, s, min, h, d, y.
- class Unit(notation, precision=AutoPrecision(digits=2))
Defines a unit which can be used within metrics and metric operations.
Examples
>>> Unit(DecimalNotation(""), StrictPrecision(0)) # rendered as integer Unit(notation=DecimalNotation(symbol=''), precision=StrictPrecision(digits=0))
>>> Unit(DecimalNotation(""), StrictPrecision(2)) # rendered as float with two digits Unit(notation=DecimalNotation(symbol=''), precision=StrictPrecision(digits=2))
>>> Unit(SINotation("bytes")) # bytes which are scaled with SI prefixes Unit(notation=SINotation(symbol='bytes'), precision=AutoPrecision(digits=2))
>>> Unit(IECNotation("bits")) # bits which are scaled with IEC prefixes Unit(notation=IECNotation(symbol='bits'), precision=AutoPrecision(digits=2))
- class WarningOf(metric_name)
Extracts the warning level of a metric by its name. It can be used within metric other metric operations, perfometers or graphs.
- Parameters:
metric_name (
str) – Name of a metric
Example
>>> WarningOf("metric-name") WarningOf(metric_name='metric-name')