proxmox-backup/src/api2/node/rrd.rs

46 lines
889 B
Rust
Raw Normal View History

use anyhow::Error;
use serde_json::Value;
use proxmox::api::{api, Router};
use crate::api2::types::*;
#[api(
input: {
properties: {
node: {
schema: NODE_SCHEMA,
},
timeframe: {
type: RRDTimeFrameResolution,
},
cf: {
type: RRDMode,
},
},
},
)]
/// Read node stats
fn get_node_stats(
timeframe: RRDTimeFrameResolution,
cf: RRDMode,
_param: Value,
) -> Result<Value, Error> {
2020-05-23 13:37:17 +00:00
crate::rrd::extract_data(
"host",
&[
"cpu", "iowait",
"memtotal", "memused",
"swaptotal", "swapused",
"netin", "netout",
"roottotal", "rootused",
],
timeframe,
cf,
)
}
pub const ROUTER: Router = Router::new()
.get(&API_METHOD_GET_NODE_STATS);