perf_data – Performance Data Classes¶
Tools for creating performance data for Icinga plugin responses.
If you’re adding performance data to a Response
object, then set_perf_data() can be
called instead of having to create an entire PerfData object.
-
class
pycinga.perf_data.PerfData(label, value[, uom=None[, warn=None[, crit=None[, minval=None[, maxval=None]]]]])[source]¶ Creates a new object representing a single performance data item for an Icinga response.
Performance data is extra key/value data that can be returned along with a response. The performance data is not used immediately by Icinga itself, but can be extracted by 3rd party tools and can often be helpful additional information for system administrators to view. The label can be any string, but value must be a numeric value.
Raises
ValueErrorif any of the parameters are invalid. The exact nature of the error is in the human readable message attribute of the exception.Parameters: - label: Label for the performance data. This must be a string.
- value: Value of the data point. This must be a number whose characters are in the class of [-0-9.]
- uom (optional): Unit of measure. This must only be %, s for seconds, c for continous data, or a unit of bit space measurement (“b”, “kb”, etc.)
- warn (optional): Warning range for this metric.
- crit (optional): Critical range for this metric.
- minval (optional): Minimum value possible for this metric, if one exists.
- maxval (optional): Maximum value possible for this metric, if one exists.
-
value¶ The value of this metric.
-
warn¶ The warning range of this metric. This return value of this will always be a
Rangeobject, even if it was set with a string.
-
crit¶ The critical range of this metric. This return value of this will always be a
Rangeobject, even if it was set with a string.
-
minval¶ The minimum value possible for this metric. This doesn’t make a lot of sense if the uom is “%”, since that is obviously going to be 0, but this will return whatever was set.
-
maxval¶ The maximum value possible for this metric. This doesn’t make a lot of sense if the uom is “%”, since that is obviously going to be 100, but this will return whatever was set.
-
uom¶ The unit of measure (UOM) for this metric.