Crate nagiosplugin

Source
Expand description

This crate provides utilities to write Icinga/Nagios checks/plugins. If you want to use this library only for compatible output take a look at the Resource. If you also want error handling, take a look at safe_run.

Structs§

CheckResult
Represents a single item of a check. Multiple of these are used to form a Resource.
Metric
Defines a metric with a required name and value. Also takes optional thresholds (warning, critical) minimum, maximum. Can also be set to ignore thresholds and have a fixed ServiceState.
PerfData
Represents a single performance metric.
PerfString
Newtype wrapper around a string to ensure only valid strings end up in the final output. This is used for the performance data / metric part of the output.
Resource
Represents a single service / resource from the perspective of Icinga.
ServiceStateFromStrError
This error is returned by the FromStr implementation of ServiceState.
UnitString
Newtype wrapper around a string to ensure only valid strings end up in the performance data.

Enums§

RunResult
The result of a runner execution.
ServiceState
Represents the state of a service / resource.
TriggerIfValue
Defines if a metric triggers if value is greater or less than the thresholds.
Unit
This represents the unit for a metric. It can be one of the predefined units or a custom one. See Nagios Plugin Development Guidelines for more information.
UnitStringCreateError
This error is returned if a UnitString is created with an invalid string.

Traits§

ToPerfString
Implement this if you have a value which can be converted to a performance metric value.

Functions§

safe_run
Helper function to safely run a check with a defined ServiceState on error and return a RunResult which can be used to print and exit.