src/bin/proxmox-backup-proxy.rs: gather loadavg stats
This commit is contained in:
parent
e8f5810aa1
commit
485841da2c
|
@ -602,7 +602,7 @@ async fn run_stat_generator() {
|
||||||
|
|
||||||
async fn generate_host_stats() {
|
async fn generate_host_stats() {
|
||||||
use proxmox::sys::linux::procfs::{
|
use proxmox::sys::linux::procfs::{
|
||||||
read_meminfo, read_proc_stat, read_proc_net_dev};
|
read_meminfo, read_proc_stat, read_proc_net_dev, read_loadavg};
|
||||||
use proxmox_backup::rrd;
|
use proxmox_backup::rrd;
|
||||||
|
|
||||||
proxmox_backup::tools::runtime::block_in_place(move || {
|
proxmox_backup::tools::runtime::block_in_place(move || {
|
||||||
|
@ -659,6 +659,17 @@ async fn generate_host_stats() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
match read_loadavg() {
|
||||||
|
Ok(loadavg) => {
|
||||||
|
if let Err(err) = rrd::update_value("host/loadavg", loadavg.0 as f64, rrd::DST::Gauge) {
|
||||||
|
eprintln!("rrd::update_value 'host/roottotal' failed - {}", err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(err) => {
|
||||||
|
eprintln!("read_loadavg failed - {}", err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
match disk_usage(std::path::Path::new("/")) {
|
match disk_usage(std::path::Path::new("/")) {
|
||||||
Ok((total, used, _avail)) => {
|
Ok((total, used, _avail)) => {
|
||||||
if let Err(err) = rrd::update_value("host/roottotal", total as f64, rrd::DST::Gauge) {
|
if let Err(err) = rrd::update_value("host/roottotal", total as f64, rrd::DST::Gauge) {
|
||||||
|
|
Loading…
Reference in New Issue