Struct nagiosplugin::Resource[][src]

pub struct Resource { /* fields omitted */ }

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.

You can also create a Resource filled with metrics via the resource! macro, which is much like the vec! macro.

let m1 = SimpleMetric::new("test", Some(State::Ok), 12, None, None, None, None);
let m2 = SimpleMetric::new("other", None, true, None, None, None, None);
let resource = resource![m1, m2];
assert_eq!(&resource.to_nagios_string(), "OK | test=12 other=true")

Methods

impl Resource
[src]

If state is set to Some(State) then it will always use this instead of determining it from the given metrics.

If you want to create a Resource from some metrics with automatic determination of the state you can use the resource! macro.

Pushes a single ResourceMetric into the resource.

Returns a slice of the pushed metrics.

Returns a string which nagios understands to determine the service state.

This function will automatically determine which service state is appropriate based on the included metrics. If state has been set manually it will always use the manually set state.

Will determine a State by the given metrics.

Get the description of this resource.

Set the description of this resource.

Will return the exit code of the determined state via Self::state.

Will print Self::to_nagios_string and exit with the exit code from Self::exit_code

Trait Implementations

impl Default for Resource
[src]

Returns the "default value" for a type. Read more

Auto Trait Implementations

impl !Send for Resource

impl !Sync for Resource