Crate nagiosplugin[][src]

The nagiosplugin crate provides some basic utilities to make it easier to write nagios checks.

Macros

resource

Let’s you simply create a resource from multiple metrics. It’s a bit like the vec! macro.

Structs

PartialOrdMetric

A PartialOrdMetric is a metric which will automatically calculate the State based on the given value and warning and/or critical value.

Resource

A Resource basically represents a single service if you view it from the perspective of nagios. If you init it without a state it will determine one from the given metrics.

SimpleMetric

Represents a simple metric where no logic is performed. You give some values in and the same get out.

StaticCheckable

Use a StaticCheckable for things you want to check but which do not contain a metric.

Enums

State

Represents a service state from nagios.

Unit

Traits

Checkable

The checkable trait represents anything that has some relevance as a checkable entity in icinga. Most notably Metrics. There are also StaticCheckables which do not contain any metrics but influence the service state and output of the plugin.

Metric

This trait can be implemented for any kind of metric and will be used to generate the final string output for nagios. Calls to the functions should return immediately and not query the service every time.

ResourceMetric

Represents a single metric of a resource. You shouldn’t need to implement this by yourself since the crate provided types already implement this.

ToPerfString

The purpose of ToPerfString is only so one can define custom representations of custom types without using the ToString trait so we don’t interfere with that.

Functions

safe_run

Runs the given closure and exits with a State::Critical after printing out the error message if the Result contains an Err.

safe_run_sync

Runs the given closure and exits with a State::Critical after printing out the error message if the Result contains an Err.

safe_run_with_state

Runs the given closure and exits with the given State after printing out the error message if the Result contains an Err.

safe_run_with_state_sync

Runs the given closure and exits with the given State after printing out the error message if the Result contains an Err.