From 6b51c53eb2e678be4998e2e2bc7b5b7d5b746059 Mon Sep 17 00:00:00 2001 From: Jaime Melis Date: Mon, 25 Nov 2013 17:51:46 +0100 Subject: [PATCH] Bug #2490: errors in probes in the monitoring system are not reported as errors (cherry picked from commit 2cad5fc87c760d52c65d96cadb5dc9cc6d635df2) --- src/im_mad/remotes/common.d/collectd-client.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/im_mad/remotes/common.d/collectd-client.rb b/src/im_mad/remotes/common.d/collectd-client.rb index fdad00f461..b24ca16ecb 100644 --- a/src/im_mad/remotes/common.d/collectd-client.rb +++ b/src/im_mad/remotes/common.d/collectd-client.rb @@ -66,13 +66,17 @@ class CollectdClient def run_probes data = `#{@run_probes_cmd}` + code = $?.exitstatus == 0 + data = "Error executing probes" if !code data64 = Base64::encode64(data).strip.delete("\n") - return data64 + [data64, code] end def send(data) - @s.send("MONITOR SUCCESS #{@number} #{data}\n", 0, @host, @port) + message, code = data + result = code ? "SUCCESS" : "FAILURE" + @s.send("MONITOR #{result} #{@number} #{message}\n", 0, @host, @port) end def monitor