add experimental rrd api to get cpu stats

This commit is contained in:
Dietmar Maurer
2020-05-23 11:10:02 +02:00
parent eaeda365e0
commit a2f862eed6
5 changed files with 68 additions and 15 deletions

View File

@ -9,6 +9,8 @@ use serde_json::Value;
use proxmox::tools::fs::{create_path, CreateOptions};
use crate::api2::types::{RRDMode, RRDTimeFrameResolution};
use super::*;
const PBS_RRD_BASEDIR: &str = "/var/lib/proxmox-backup/rrdb";

View File

@ -4,23 +4,10 @@ use std::path::Path;
use anyhow::{bail, Error};
use serde_json::{json, Value};
use crate::api2::types::{RRDMode, RRDTimeFrameResolution};
const RRD_DATA_ENTRIES: usize = 70;
#[derive(Copy, Clone)]
pub enum RRDMode {
Max,
Average,
}
#[repr(u64)]
#[derive(Copy, Clone)]
pub enum RRDTimeFrameResolution {
Hour = 60, // 1 min => last 70 minutes
Day = 60*30, // 30 min => last 35 hours
Week = 60*180, // 3 hours => about 8 days
Month = 60*720, // 12 hours => last 35 days
Year = 60*10080, // 1 week => last 490 days
}
#[repr(C)]
#[derive(Default, Copy, Clone)]