The current one doesn't really work.  It basically did nothing if there was a \n anywhere in the command output (most commands return a \n at the end :)  This makes it better by writing the last output line (up to the \n) in the log, and doesn't abort if one of the commands has an error.  Still isn't perfect but it's usable.
<br>Enjoy,<br>Mike<br><br><br>--- check_by_ssh.c.orig 2007-09-23 05:26:03.000000000 -0700<br>+++ check_by_ssh.c      2008-01-07 14:59:42.000000000 -0800<br>@@ -100,7 +100,7 @@ main (int argc, char **argv)<br>                skip_stderr = chld_err.lines;
<br><br>        /* UNKNOWN if (non-skipped) output found on stderr */<br>-       if(chld_err.lines > skip_stderr) {<br>+       if(!passive && chld_err.lines > skip_stderr) {<br>                printf (_("Remote command execution failed: %s\n"),
<br>                        chld_err.line[skip_stderr]);<br>                return STATE_UNKNOWN;<br>@@ -133,16 +133,14 @@ main (int argc, char **argv)<br>        commands = 0;<br>        for(i = skip_stdout; i < chld_out.lines; i++) {
<br>                status_text = strstr (chld_out.line[i], "STATUS CODE: ");<br>-               if (status_text == NULL) {<br>-                       printf ("%s", chld_out.line[i]);<br>-                       return result;
<br>-               }<br>                if (service[commands] && status_text<br>                        && sscanf (status_text, "STATUS CODE: %d", &cresult) == 1)<br>                {<br>-                       fprintf (fp, "[%d] PROCESS_SERVICE_CHECK_RESULT;%s;%s;%d;%s\n",
<br>-                                (int) local_time, host_shortname, service[commands++],<br>-                                cresult, chld_out.line[i]);<br>+                       fprintf (fp, "[%d] PROCESS_SERVICE_CHECK_RESULT;%s;%s;%d;",
<br>+                                (int) local_time, host_shortname, service[commands++], cresult);<br>+                       if (cresult == 0) fprintf (fp, "%s\n", chld_out.line[i-1]);<br>+                       else if(chld_err.lines > skip_stderr)
<br>+                               fprintf (fp, "%s\n", chld_err.line[skip_stderr]);<br>                }<br>        }<br><br><br><br>