[Nagiosplug-devel] Suggested alterations to the Performance Protocoll

Yves Mettier ymettier at libertysurf.fr
Mon Sep 20 03:32:02 CEST 2004


> Date: Fri, 17 Sep 2004 11:55:27 +0200
> From: Andreas Ericsson <ae at op5.se>
> To: nagiosplug-devel at lists.sourceforge.net
> Subject: Re: [Nagiosplug-devel] Suggested alterations to the Performance
>      Protocoll
>

[...]

>> Could we have label:type=value ?
>>
>> label1:string='any string'
>> label2:perf=valueUOM;range...
>> label3:log=timestamp;'log line'
>> label4:double=value   (just a value, that can be stored in a "double" variable in C)
>> label5:int=value      (just an integer value...)
>>
>> label:type=value
>>
>
> I suggest following the KISS rule. Please don't turn perfparse into
> something too complicated for users to use, and don't make it too
> monolithic to install.

This was just a bad example. For now, I only see the following uses :
label1:string='any string'
label2:perf=valueUOM;range...
label3:log=timestamp;'log line'


>> - label allows any character except one of " :'" and if you want to put one of those
>> chars inside the label, you can still do it if you put the label between quotes, and
>> ''
>> is considered as ' inside quotes, like now.
>>
>
> Use shell (backslash) escapes or die. ;)

I prefer the backslash too. Others said '' to escape a '
This is not too hard to code and I can change that in my parser. What should I do ?

>> - type is an allowed one. My parser allows "string" and "perf" but recognize it from a
>> value with or without quotes. For compatibility, I will keep that behaviour when the
>> type is not specified. Allowed types are discussed here of course :)
>>
>> - value follows the syntax corresponding to the type. "string" syntax is any string
>> inside quotes. "perf" syntax is the current one. "log" would be (remove the double
>> quotes) "timestamp;'log line'". "ipaddress" would be A.B.C.D where A->D are either
>> decimal or hexa numbers. We can even have a type "error" where the string explain the
>> error. This is probably for debugging purpose. And so on...
>>
>
> How about ip-ranges?
> ip=192.168.0.1, network=192.168.0.255
> or
> ip_mask=192.168.0.0/24 ?

We can have them all if we specify the type.
We can defined them another day because with the type, we can define a lot formats
inside the value.
Without the type, the only way to do it is to put that in a string, and I bet that a new
discussion will take place to define what kind of data we can put in a string (a log, an
IP adress, an IP range...)


>>>I think we should use standard C convention for the strings - eg, use
>>>single quotes, allow any characters with two single quotes for a single
>>>quote within the string, so check_procs may return:
>>>   process_warn='httpd' process_warn='java program'
>>>process_critical='/usr/bin/xntpd'
>>>Also allow duplicate labels (for pie chart purposes).
>>
>>
>> My parser already allows this, so I can only agree :)
>>
>
> Since when is single quotes in the C convention for strings? Single
> quotes is generally considered for script languages in non-interpolated
> strings, and in C for alpha-numeric characters.

Since the day when someone suggested that to put a ' inside the label, you have to write
'' :)
I agree with you to end that and to change the protocol and have \' for a ' inside the
label (and the string), and of course \\ for a backslask :)

I now wait for comments, and some changes in the doc, to update my parser.

Yves

-- 
- Homepage    - http://ymettier.free.fr - http://www.logicacmg.com -
- GPG key     - http://ymettier.free.fr/gpg.txt                    -
- Maitretarot - http://www.nongnu.org/maitretarot/                 -
- GTKtalog    - http://www.nongnu.org/gtktalog/                    -







More information about the Devel mailing list