fix(generic-snmp): remove threshold_suffix

I don't remember why it was created, and i think we can use the name to point threshold ?
This commit is contained in:
evan Adam 2025-06-13 21:25:47 +02:00
parent 4a6ff4d997
commit 5a2a35720a
2 changed files with 4 additions and 18 deletions

View File

@ -22,8 +22,6 @@ pub struct Metric {
pub min: Option<f64>,
pub max_expr: Option<String>,
pub max: Option<f64>,
#[serde(rename = "threshold-suffix")]
pub threshold_suffix: Option<String>,
pub warning: Option<String>,
pub critical: Option<String>,
}

View File

@ -121,10 +121,7 @@ impl Command {
self.compute
.metrics
.iter_mut()
.find(|metric| match &metric.threshold_suffix {
Some(suffix) => suffix == name,
None => false,
})
.find(|metric| &metric.name == name)
{
debug!("Adding warning to metric {}", metric.name);
metric.warning = Some(value);
@ -132,10 +129,7 @@ impl Command {
if let Some(metric) =
aggregations
.iter_mut()
.find(|metric| match &metric.threshold_suffix {
Some(suffix) => suffix == name,
None => false,
})
.find(|metric| &metric.name == name)
{
debug!("Adding warning to aggregation metric {}", metric.name);
metric.warning = Some(value);
@ -148,10 +142,7 @@ impl Command {
self.compute
.metrics
.iter_mut()
.find(|metric| match &metric.threshold_suffix {
Some(suffix) => suffix == name,
None => false,
})
.find(|metric| &metric.name == name)
{
metric.critical = Some(value);
debug!("Adding critical to metric {}", metric.name);
@ -159,10 +150,7 @@ impl Command {
if let Some(metric) =
aggregations
.iter_mut()
.find(|metric| match &metric.threshold_suffix {
Some(suffix) => suffix == name,
None => false,
})
.find(|metric| &metric.name == name)
{
debug!("Adding critical to aggregation metric {}", metric.name);
metric.critical = Some(value);