netpulse/
lib.rs

1//! Netpulse is a network monitoring tool that performs connectivity checks and stores results for analysis.
2//!
3//! # Architecture
4//!
5//! The crate is organized into several key modules:
6//! - [`store`] - Handles persistence of check results
7//! - [`records`] - Defines core types for representing checks and their results
8//! - [`checks`] - Implements the actual connectivity checks
9//! - [`analyze`] - Provides analysis of check results
10//! - [`errors`] - Error types
11//! - [`analyze`] - Analysis functionalities for extrapolating the data in the [Store](store)
12//!
13//! # Example Usage
14//!
15//! ```rust,no_run
16//! use netpulse::store::Store;
17//!
18//! // Load or create store
19//! let mut store = Store::load_or_create().unwrap();
20//!
21//! // Add checks for configured targets
22//! store.make_checks();
23//!
24//! // Save results
25//! store.save().unwrap();
26//! ```
27
28#![warn(missing_docs)]
29
30/// How long to wait until considering a connection as timed out, in milliseconds
31pub const TIMEOUT_MS: u16 = 10_000;
32/// How long to wait until considering a connection as timed out
33pub const TIMEOUT: std::time::Duration = std::time::Duration::new(TIMEOUT_MS as u64 / 1000, 0);
34
35/// Lockfile of the daemon containing it#s pid
36pub const DAEMON_PID_FILE: &str = "/run/netpulse/netpulse.pid";
37/// Redirect the stderr of the daemon here
38pub const DAEMON_LOG_ERR: &str = "/var/log/netpulse.err";
39/// Redirect the stdout of the daemon here
40pub const DAEMON_LOG_INF: &str = "/var/log/netpulse.log";
41/// username of the user the daemon should drop to after being started
42pub const DAEMON_USER: &str = "netpulse";
43
44pub mod analyze;
45pub mod checks;
46#[cfg(feature = "executable")]
47pub mod common;
48pub mod errors;
49pub mod records;
50pub mod store;