[Nagiosplug-devel] [ nagiosplug-Patches-1769653 ] check_by_ssh multiline capability

Matthias Flacke Matthias.Flacke at gmx.de
Sun Sep 23 19:07:38 CEST 2007

Hello John,

John P. Rouillard wrote:
> In message <E1IZQe7-0003ZE-1t at sc8-sf-web24.sourceforge.net>,
> "SourceForge.net" writes:
>> Submitted By: mflacke (mflacke)
>> Assigned to: Nobody/Anonymous (nobody)
>> Summary: check_by_ssh multiline capability
>> [...]
>> being not sure whether this is an enhancement or a bugfix ;-) I
>> attached a small patch against nagios-plugins-trunk-200708071200 which
>> provides multiline capability for check_by_ssh.
>> The existing code prints out only the first line of output while the
>> patch appends all lines.
>> The backward compatibility to Nagios 2.x installations is still given
>> because all additional lines are discarded there.
> Actually they aren't supposed to be. You are supposed to be able to
> specify multiple commands for check_by_ssh to run. The first line is
> returned as output for the check_by_ssh command and the subsequent
> output is supposed to be sent to the nagios core as as passive
> commands to set the status of the additional services check_by_ssh is
> supposed to check.

The passive 'trick' is untouched by the patch. The additional multiline 
transport is only working for _active_ commands:

   109 	/* this is simple if we're not supposed to be passive.
   110 	 * Wrap up quickly and keep the tricks below */
**111 	if(!passive) {**
   112 		if (chld_out.lines > skip_stdout)
   113 			for (i = skip_stdout; i < chld_out.lines; i++)
   114 				puts (chld_out.line[i]);
   115 		else
   116 			printf (_("%s - check_by_ssh: Remote command '%s' returned status 
   117 			        state_text(result), remotecmd, result);
   118 		return result; 	/* return error status from remote command */
   119 	}

The passive stuff is following and behaves like you know it.

>>> Comment By: Matthias Eble (psychotrahe)
>> Date: 2007-09-23 14:33
>> Message:
>> Logged In: YES 
>> user_id=1694341
>> Originator: NO
>> Hi Matthias,
>> thanks for the patch. I checked it in, a couple of minutes ago.
> So does this mean that there is no chance to fix check_by_ssh to run
> multiple commands (which is really useful for reducing load)?

For that I'm with you - in fact my patch should just provide the means to run 
multiline plugins in Nagios 3.x in order to save resources.


> 				-- rouilj
> John Rouillard
> ===========================================================================
> My employers don't acknowledge my existence much less my opinions.
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________________
> Nagios Plugin Development Mailing List Nagiosplug-devel at lists.sourceforge.net
> Unsubscribe at https://lists.sourceforge.net/lists/listinfo/nagiosplug-devel
> ::: Please include plugins version (-v) and OS when reporting any issue. 
> ::: Messages without supporting info will risk being sent to /dev/null


More information about the Devel mailing list