[Nagiosplug-devel] check_icmp min and max

Thomas Guyot-Sionnest dermoth at aei.ca
Tue Nov 4 07:17:28 CET 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 30/10/08 06:15 AM, Andreas Ericsson wrote:
> Thomas Guyot-Sionnest wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> On 29/10/08 07:59 AM, Andreas Ericsson wrote:
>>> Thomas Guyot-Sionnest wrote:
>>> DBL_MAX isn't always defined. Think broken header files here.
>>> otoh, defining DBL_MAX to something suitably huge if it isn't
>>> defined would get the best of both worlds.
>>>
>>
>> That's what I first though, but gnulib defines LDBL_MAX on some systems
>> where it's missing, but not DBL_MAX, so my guess was that's it's always
>> there. Anyways it never hurts to check for that though.
>>
>> So what about something like that:
>>
>> @@ -106,6 +106,7 @@
>>  # define ICMP_UNREACH_PRECEDENCE_CUTOFF 15
>>  #endif
>>
>> +#ifdef DBL_MAX
>> +# define RTMIN_MAGIC_CONSTANT DBL_MAX
>> +#else
>> +# define RTMIN_MAGIC_CONSTANT 9.999999999999999e999
>> +#endif
>>
>>  typedef unsigned short range_t;  /* type for get_range() --
>> unimplemented */
>>
>> @@ -120,6 +121,8 @@
>>
>>
>> Shall I commit his patch for you??
>>
> 
> Sure. An even better one would probably be
> #ifndef DBL_MAX
> # define DBL_MAX 9.9999999999e999
> #endif
> 
> and then just using DBL_MAX instead of RTMIN_MAGIC_CONSTANT, but I
> have no strong preference either way.
> 

Hi Andreas,

You can see my updated patch here (The perdata format was broken BTW):
http://solaris.beaubien.net/cgi-bin/gitweb.cgi/nagiosplug-dermoth.git

I didn't apply it yet as I still have one issue to work out... Then the
host is unresponsive rtamax is 0 and rtamin is 'inf' (I guess the latter
depends on the compiler/libc too):

> CRITICAL - 192.168.1.111: Host unreachable @ 192.168.1.116. rta nan, lost 100%|rta=0.000ms;200.000;500.000;0; pl=100%;40;80;; rtmax=0.000ms;;;; rtmin=infms;;;; 

I could easily force rtamin to print 0 if it's == to DBL_MAX, however
does is make sense to print them at all??

i.e. Solution 1:

> CRITICAL - 192.168.1.111: Host unreachable @ 192.168.1.116. rta nan, lost 100%|rta=0.000ms;200.000;500.000;0; pl=100%;40;80;; rtmax=0.000ms;;;; rtmin=0.000ms;;;; 

Solution 2:

> CRITICAL - 192.168.1.111: Host unreachable @ 192.168.1.116. rta nan, lost 100%|rta=0.000ms;200.000;500.000;0; pl=100%;40;80;; 

- From a RRD graphing standpoint, it's better to have no value when data
is unknown, however considering that we already print "rta=0.000" it
would probably look better to do the same with rtamax and rtamin. What
do you think?

- --
Thomas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJD+j46dZ+Kt5BchYRAkRwAJ9/kd5TNjh5tkfQUfA/3SiSvZNTiwCeMVew
AAfV5US5ahtIPsLIhRvJpwc=
=zI8R
-----END PGP SIGNATURE-----




More information about the Devel mailing list