From e2eb52fbb9ff251e9d1f39933711920be3c20b4f Mon Sep 17 00:00:00 2001 From: Gordon Bleux <33967640+UiP9AV6Y@users.noreply.github.com> Date: Fri, 13 Oct 2023 20:12:02 +0200 Subject: [PATCH] log script probe output if any is generated closes #138 --- src/prober/manager.rs | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/src/prober/manager.rs b/src/prober/manager.rs index 97dd2b9..82e683f 100644 --- a/src/prober/manager.rs +++ b/src/prober/manager.rs @@ -521,11 +521,25 @@ fn proceed_replica_probe_script(script: &String) -> (Status, Option) { let start_time = SystemTime::now(); let status = match run_script::run(script, &Vec::new(), &ScriptOptions::new()) { - Ok((code, _, _)) => { - debug!( - "prober script execution succeeded with return code: {}", - code - ); + Ok((code, stdout, stderr)) => { + if stdout == "" { + debug!( + "prober script execution succeeded with return code: {}", + code + ); + } else { + debug!( + "prober script execution succeeded with return code: {} (output: {})", + code, stdout + ); + } + + if stderr != "" { + info!( + "prober script emitted error data: {}", + stderr + ); + } // Return code '0' goes for 'healthy', '1' goes for 'sick'; any other code is 'dead' match code {