mirror of
https://codeberg.org/icewind/palantir.git
synced 2026-06-03 18:24:08 +02:00
more ci work, clippy
This commit is contained in:
parent
73d4980fad
commit
f72f4689e6
8 changed files with 83 additions and 48 deletions
|
|
@ -126,10 +126,12 @@ impl Iterator for DiskUsageParser<'_> {
|
|||
return None;
|
||||
}
|
||||
let mount_point = parts.next()?;
|
||||
let stat = match statvfs(&mount_point) {
|
||||
let stat = match statvfs(mount_point) {
|
||||
Ok(stat) => stat,
|
||||
Err(e) => return Some(Err(e)),
|
||||
};
|
||||
// cast is needed on 32bit platforms
|
||||
#[allow(clippy::unnecessary_cast)]
|
||||
Some(Ok(DiskUsage {
|
||||
name: mount_point.to_string(),
|
||||
size: stat.f_blocks * stat.f_frsize as u64,
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ pub fn pools() -> impl Iterator<Item = DiskUsage> {
|
|||
|
||||
fn zpool_command() -> Result<String> {
|
||||
let mut z = Command::new("zpool");
|
||||
z.args(&["list", "-p", "-H", "-o", "name,size,free"]);
|
||||
z.args(["list", "-p", "-H", "-o", "name,size,free"]);
|
||||
let out = z.output()?;
|
||||
if out.status.success() {
|
||||
Ok(String::from_utf8(out.stdout)?)
|
||||
|
|
|
|||
|
|
@ -61,8 +61,8 @@ pub fn get_metrics(sensors: &Sensors) -> Result<String> {
|
|||
let pools = pools();
|
||||
let mut result = String::with_capacity(256);
|
||||
|
||||
cpu.write(&mut result, &hostname);
|
||||
memory.write(&mut result, &hostname);
|
||||
cpu.write(&mut result, hostname);
|
||||
memory.write(&mut result, hostname);
|
||||
|
||||
for pool in pools {
|
||||
writeln!(
|
||||
|
|
@ -78,21 +78,15 @@ pub fn get_metrics(sensors: &Sensors) -> Result<String> {
|
|||
)
|
||||
.ok();
|
||||
}
|
||||
for network in networks {
|
||||
if let Ok(network) = network {
|
||||
network.write(&mut result, &hostname);
|
||||
}
|
||||
for network in networks.flatten() {
|
||||
network.write(&mut result, hostname);
|
||||
}
|
||||
for disk in disks {
|
||||
if let Ok(disk) = disk {
|
||||
disk.write(&mut result, hostname);
|
||||
}
|
||||
for disk in disks.flatten() {
|
||||
disk.write(&mut result, hostname);
|
||||
}
|
||||
|
||||
for disk in disk_usage {
|
||||
if let Ok(disk) = disk {
|
||||
disk.write(&mut result, hostname);
|
||||
}
|
||||
for disk in disk_usage.flatten() {
|
||||
disk.write(&mut result, hostname);
|
||||
}
|
||||
for (label, temp) in temperatures {
|
||||
if temp != 0.0 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue