⚡️ Improve metrics consistency
This commit is contained in:
parent
3c03f77ddf
commit
5cd3293aae
@ -14,18 +14,18 @@ fn index() -> Result<String, Status> {
|
||||
if result == 0 {
|
||||
let block_size = stat.f_frsize as u64;
|
||||
let total = stat.f_blocks as u64 * block_size;
|
||||
let free = stat.f_bfree as u64 * block_size;
|
||||
let used = total - free;
|
||||
let available = stat.f_bavail as u64 * block_size;
|
||||
let used = total - available;
|
||||
let percentage_used = ((used as f64 / total as f64) * 100.0) as u64;
|
||||
let percentage_available = 100 - percentage_used;
|
||||
|
||||
return Ok(format!("path:{}\ntotal-space:{}\nused-space:{}\npercentage_used:{}", host_path,total, used, percentage_used))
|
||||
return Ok(format!("path:{}\ntotal-space:{}\nused-space:{}\npercentage-used:{}\npercentage-available{}", host_path,total, used, percentage_used, percentage_available))
|
||||
}
|
||||
Err(Status::InternalServerError)
|
||||
}
|
||||
|
||||
#[launch]
|
||||
fn rocket() -> _ {
|
||||
|
||||
println!("____ __ __ __ ___ _ __ _ ");
|
||||
println!("__/ |/ /__ ___/ /__ / |/ /__ ___ (_) /____ ____(_)__ ___ _");
|
||||
println!("_/ / _ \\/ _ / -_) /|_/ / _ \\/ _ \\/ / __/ _ \\/ __/ / _ \\/ _ `/");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user