Intermediate data API¶
The following classes allow to handle intermediate data that are used during the
plugin’s execution in a structured way. Most of them are used by the
nagiosplugin
library itself to create objects which are passed into
code written by plugin authors. Other classes (like
Metric
) are used by plugin authors to generate
intermediate data during acquisition or evaluation steps.
Note
All classes that plugin authors typically need are imported directly into the
nagiosplugin
name space. For example, use
import nagiosplugin
# ...
result = nagiosplugin.Result(nagiosplugin.Ok)
to get a Result
instance.
nagiosplugin.metric¶
nagiosplugin.state¶
Note
ServiceState
is not imported into the nagiosplugin
top-level name space since there is usually no need to access it directly.
State subclasses¶
The state subclasses are singletons. Plugin authors should use the class name (without parentheses) to access the instance. For example:
state = nagiosplugin.Critical