enh(generic-snmp): output improved a little with thresholds

This commit is contained in:
David Boucher 2025-06-04 19:40:14 +02:00
parent 3e23f6af87
commit 13ff270486
4 changed files with 10 additions and 5 deletions

View File

@ -1,4 +1,4 @@
use log::{debug, error, trace};
use log::{error, trace};
use std::str;
pub type Spanned<Tok, Loc, Error> = Result<(Loc, Tok, Loc), Error>;
@ -155,7 +155,7 @@ impl<'input> Iterator for Lexer<'input> {
}
}
mod Test {
mod test {
use super::*;
fn init() {

View File

@ -98,7 +98,7 @@ impl<'a> Parser<'a> {
}
}
mod Test {
mod test {
use super::*;
use log::info;
use std::collections::HashMap;

View File

@ -116,7 +116,7 @@ impl Threshold {
}
}
mod Test {
mod test {
use super::*;
#[test]

View File

@ -85,9 +85,14 @@ pub struct Collect {
pub struct Command {
collect: Collect,
compute: Compute,
#[serde(default = "default_output")]
pub output: Output,
}
fn default_output() -> Output {
Output::new()
}
#[derive(Debug)]
pub struct CmdResult {
pub status: Status,
@ -403,7 +408,7 @@ impl Command {
}
trace!("collect: {:#?}", collect);
println!("metrics: {:#?}", metrics);
trace!("metrics: {:#?}", metrics);
let output_formatter = OutputFormatter::new(status, &metrics, &self.output);
let output = output_formatter.to_string();
Ok(CmdResult { status, output })