proxmox-rrd: support CF::Last
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com> Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
c68fa58a59
commit
03664514ab
|
@ -51,6 +51,8 @@ pub enum CF {
|
||||||
Maximum,
|
Maximum,
|
||||||
/// Minimum
|
/// Minimum
|
||||||
Minimum,
|
Minimum,
|
||||||
|
/// Use the last value
|
||||||
|
Last,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
|
@ -209,6 +211,7 @@ impl RRA {
|
||||||
let new_value = match self.cf {
|
let new_value = match self.cf {
|
||||||
CF::Maximum => if last_value > value { last_value } else { value },
|
CF::Maximum => if last_value > value { last_value } else { value },
|
||||||
CF::Minimum => if last_value < value { last_value } else { value },
|
CF::Minimum => if last_value < value { last_value } else { value },
|
||||||
|
CF::Last => value,
|
||||||
CF::Average => {
|
CF::Average => {
|
||||||
(last_value*(self.last_count as f64))/(new_count as f64)
|
(last_value*(self.last_count as f64))/(new_count as f64)
|
||||||
+ value/(new_count as f64)
|
+ value/(new_count as f64)
|
||||||
|
|
Loading…
Reference in New Issue