Skip to main content

HealthMonitor

Struct HealthMonitor 

Source
pub struct HealthMonitor { /* private fields */ }
Expand description

Health monitoring daemon with background thread.

Captures snapshots every 60 seconds and alerts on threshold violations. Thread-safe state access via RwLock.

Implementations§

Source§

impl HealthMonitor

Source

pub fn start() -> Result<Self, String>

Starts the health monitoring background thread.

The monitor checks system health every 60 seconds and updates the shared health state. Alerts are generated for:

  • Zombie count > 10
  • CPU > 90% for 5+ consecutive minutes
  • Monotonic RAM increase
§Returns

Ok(HealthMonitor) on success, or error if thread spawn fails.

Source

pub fn health(&self) -> HealthState

Returns the current health state snapshot.

Source

pub fn alerts(&self) -> Vec<HealthAlert>

Returns recent health alerts (up to 100).

Source

pub fn stop(&self)

Stops the background monitoring thread.

Source

pub fn is_running(&self) -> bool

Returns whether the monitor is still running.

Trait Implementations§

Source§

impl Drop for HealthMonitor

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.