mirror of
https://codeberg.org/icewind/palantir.git
synced 2026-06-03 18:24:08 +02:00
sync hostname
This commit is contained in:
parent
14817cf422
commit
61261ca227
4 changed files with 26 additions and 5 deletions
|
|
@ -11,13 +11,13 @@ use std::collections::HashSet;
|
|||
use std::fmt::Write;
|
||||
|
||||
pub async fn get_metrics() -> Result<String> {
|
||||
let (hostname, cpu, network, disks, disk_usage) = try_join! {
|
||||
hostname(),
|
||||
let (cpu, network, disks, disk_usage) = try_join! {
|
||||
cpu_time(),
|
||||
network_stats(),
|
||||
disk_stats(),
|
||||
disk_usage(),
|
||||
}?;
|
||||
let hostname = hostname()?;
|
||||
let memory = memory()?;
|
||||
let temperatures = temperatures()?;
|
||||
let pools = pools();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use color_eyre::Result;
|
||||
use color_eyre::{Report, Result};
|
||||
use futures_util::future;
|
||||
use futures_util::stream::{Stream, StreamExt};
|
||||
use heim::cpu::time;
|
||||
|
|
@ -127,8 +127,10 @@ pub async fn network_stats() -> Result<impl Stream<Item = IOStats>> {
|
|||
}))
|
||||
}
|
||||
|
||||
pub async fn hostname() -> Result<String> {
|
||||
Ok(heim::host::platform().await?.hostname().to_string())
|
||||
pub fn hostname() -> Result<String> {
|
||||
hostname::get()?
|
||||
.into_string()
|
||||
.map_err(|_| Report::msg("non utf8 hostname"))
|
||||
}
|
||||
|
||||
pub async fn disk_stats() -> Result<impl Stream<Item = IOStats>> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue