[Nagiosplug-devel] RFC: Plugin API Changes

Andreas Ericsson ae at op5.se
Wed Mar 1 01:53:17 CET 2006


Subhendu Ghosh wrote:
> On Tue, 28 Feb 2006, Andreas Ericsson wrote:
> 
>> Ethan Galstad wrote:
>>
>>> On 28 Feb 2006 at 10:52, Jason Martin wrote:
>>>
>>>
>>>> On Tue, Feb 28, 2006 at 12:10:02PM -0600, Ethan Galstad wrote:
>>>>
>>>>> Line1: "Short output | Perf1"
>>>>> Line2: "Long output 1"
>>>>> Line3: "Long output 2"
>>>>> Line4: "Long output3 | Perf2"
>>>>> Line5: "Perf3"
>>>>> Line6: "Perf4"
>>>>> $SERVICEOUTPUT$="Short output"
>>>>> $PERFDATA$="Perf1 Perf2 Perf3 Perf4"
>>>>> $LONGSERVICEOUTPUT$="Long output 1\nLong output2\nLong output3\n"
>>>
>>>
>>>
>>>> How does Nagios differentiate between Line2 being 'long output'
>>>> and line5 being perfdata? Both follow a line with a | character
>>>> in it.
>>>
>>>
>>>
>>> Any additional lines (beyond the first one) are considered standard 
>>> text output and made a part of the $LONGSERVICEOUTPUT$ macro.  Once a 
>>> pipe symbol is found in those additional lines, anything after that 
>>> symbol (including additional full lines of text) are considered to be 
>>> performance data.
>>>
>>
>> Seems like a tricky rule. Why not just stick with current behaviour 
>> (that is, first pipe-char splits output and perf-data)? One can 
>> already do multiple perf-data entries with that, using the current 
>> parsers.
>>
>>
> 
> Either that - or each new line is either output or perfdata with 
> separators allowing multiple parts but the line will be prefixed to 
> distinguish betwwen the two.
> 
> current parsers will have to be modified to handle multiline, so adding 
> line prefix detection in the loop should be trivial.
> 

Going with my suggestion, that will be as easy as

	echo "$perf_data" | tr '\n' ' '

and even simpler in C, Python, Perl or whatever.

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231




More information about the Devel mailing list