Metrs is a lightweight and efficient service that provides real-time metrics information about a host's CPU, memory, disk, and network usage.
Unlike traditional services, Metrs doesn't store data in a database; its sole purpose is to emit information.
To use the Metrs daemon, run the following command:
Usage: metrsd --hosts <HOSTS>
Options:
-H, --hosts <HOSTS> Hosts to listen on
-h, --help Print help
Example:
metrsd --hosts tcp://127.0.0.1:8080
Metrs provides a Rust client that you can use with ntex. To install the client, run the following command:
cargo add metrsd_client
You can then call the subscribe event using the following code:
use metrsd_client::MetrsdClient;
#[ntex::main]
async fn main() -> std::io::Result<()> {
let client = MetrsdClient::connect("http://localhost:8080");
let stream = client.subscribe().await.unwrap();
while let Some(ev) = stream.next().await {
println!("{ev:#?}");
}
Ok(())
}
There is no CLI available for Metrs at the moment, but it's planned for future releases.