Kaynağa Gözat

Add credit + minor fix for #619

madlohe 4 yıl önce
ebeveyn
işleme
6e66030362
2 değiştirilmiş dosya ile 3 ekleme ve 1 silme
  1. 1 0
      NEWS
  2. 2 1
      plugins/check_by_ssh.c

+ 1 - 0
NEWS

@@ -2,6 +2,7 @@ This file documents the major additions and syntax changes between releases.
 
 2.3.4 ????-??-??
 	pst3.c: Fix build issue on Solaris (#537)
+	check_by_ssh: Fix return code when ssh or the shell itself fails (#618) (Guillaume Rousse)
 	check_disk: Fix false DISK CRITICAL alerts on btrfs systems (#569) (George Hansper)
 	check_http: Add -o option (Append page body as performance data) (#615) (Tobias Leich)
 	check_log: Fix error message for systems that don't use bash (#539)

+ 2 - 1
plugins/check_by_ssh.c

@@ -118,13 +118,14 @@ main (int argc, char **argv)
 	if(!passive) {
 		/* UNKNOWN if result exceed nagios plugins conventions,
 		 * such as ssh or other remote execution error */
+		int chld_return_code = result;
 		result = min(result, STATE_UNKNOWN);
 		if (chld_out.lines > skip_stdout)
 			for (i = skip_stdout; i < chld_out.lines; i++)
 				puts (chld_out.line[i]);
 		else
 			printf (_("%s - check_by_ssh: Remote command '%s' returned status %d\n"),
-			        state_text(result), remotecmd, result);
+			        state_text(result), remotecmd, chld_return_code);
 		return result;
 	}