Struct nagiosplugin::Metric
source · pub struct Metric<T> { /* private fields */ }
Expand description
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.
Implementations§
source§impl<T> Metric<T>
impl<T> Metric<T>
pub fn new(name: impl Into<String>, value: T) -> Self
pub fn with_thresholds( self, warning: impl Into<Option<T>>, critical: impl Into<Option<T>>, trigger_if_value: TriggerIfValue ) -> Self
pub fn with_minimum(self, minimum: T) -> Self
pub fn with_maximum(self, maximum: T) -> Self
sourcepub fn with_fixed_state(self, state: ServiceState) -> Self
pub fn with_fixed_state(self, state: ServiceState) -> Self
If a fixed state is set, this metric will always report the given state if turned in to a CheckResult.
pub fn with_unit(self, unit: Unit) -> Self
Trait Implementations§
source§impl<T: PartialOrd + ToPerfString> From<Metric<T>> for CheckResult
impl<T: PartialOrd + ToPerfString> From<Metric<T>> for CheckResult
Auto Trait Implementations§
impl<T> Freeze for Metric<T>where
T: Freeze,
impl<T> RefUnwindSafe for Metric<T>where
T: RefUnwindSafe,
impl<T> Send for Metric<T>where
T: Send,
impl<T> Sync for Metric<T>where
T: Sync,
impl<T> Unpin for Metric<T>where
T: Unpin,
impl<T> UnwindSafe for Metric<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more