mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-09-25 18:58:39 +02:00
enh(generic-snmp): output improved a little with thresholds
This commit is contained in:
parent
ee54e1a0ed
commit
8b2de7283a
@ -1,4 +1,4 @@
|
|||||||
use log::{debug, error, trace};
|
use log::{error, trace};
|
||||||
use std::str;
|
use std::str;
|
||||||
|
|
||||||
pub type Spanned<Tok, Loc, Error> = Result<(Loc, Tok, Loc), Error>;
|
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::*;
|
use super::*;
|
||||||
|
|
||||||
fn init() {
|
fn init() {
|
||||||
|
@ -98,7 +98,7 @@ impl<'a> Parser<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mod Test {
|
mod test {
|
||||||
use super::*;
|
use super::*;
|
||||||
use log::info;
|
use log::info;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
@ -116,7 +116,7 @@ impl Threshold {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mod Test {
|
mod test {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -85,9 +85,14 @@ pub struct Collect {
|
|||||||
pub struct Command {
|
pub struct Command {
|
||||||
collect: Collect,
|
collect: Collect,
|
||||||
compute: Compute,
|
compute: Compute,
|
||||||
|
#[serde(default = "default_output")]
|
||||||
pub output: Output,
|
pub output: Output,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn default_output() -> Output {
|
||||||
|
Output::new()
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct CmdResult {
|
pub struct CmdResult {
|
||||||
pub status: Status,
|
pub status: Status,
|
||||||
@ -403,7 +408,7 @@ impl Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
trace!("collect: {:#?}", collect);
|
trace!("collect: {:#?}", collect);
|
||||||
println!("metrics: {:#?}", metrics);
|
trace!("metrics: {:#?}", metrics);
|
||||||
let output_formatter = OutputFormatter::new(status, &metrics, &self.output);
|
let output_formatter = OutputFormatter::new(status, &metrics, &self.output);
|
||||||
let output = output_formatter.to_string();
|
let output = output_formatter.to_string();
|
||||||
Ok(CmdResult { status, output })
|
Ok(CmdResult { status, output })
|
||||||
|
Loading…
x
Reference in New Issue
Block a user