[Nagiosplug-devel] Patch for check_ntp when checking against cisco ios ntp servers

Subhendu Ghosh sghosh at sghosh.org
Wed Dec 17 09:39:03 CET 2003


On Thu, 4 Dec 2003, David Sullivan wrote:

> In it's current form check_ntp assumes it's talking to a unix ntp server and expects the 
> following output from ntpq:
> 
> *192.168.1.1  .GPS.            1 u   12  256  377    14.50    0.016    2.17
> 
> Whereas the cisco ios NTP implementation returns the following:
> 
> *192.168.1.1  .GPS.            1 -  392 1024  377    22.31   -4.749    2.29
> 
> The following patch modifies the regexp to recognise - for field 5 as well as l u m or b 
> returned by "normal" ntp servers.
> 
> 277c277
> <                       if (/^(\*|o)([-0-9.\s]+)\s+([-0-9A-Za-z.]+)\s+([-0-9.]+)\s+([lumb-]+)\s+([-0-9m.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)/) {
> ---
> >                       if (/^(\*|o)([-0-9.\s]+)\s+([-0-9A-Za-z.]+)\s+([-0-9.]+)\s+([\-lumb-]+)\s+([-0-9m.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)/) {
> 302c302
> <                                       $c =~ /^(#)([-0-9.\s]+)\s+([-0-9A-Za-z.]+)\s+([-0-9.]+)\s+([lumb-]+)\s+([-0-9m.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)/;
> ---
> >                                       $c =~ /^(#)([-0-9.\s]+)\s+([-0-9A-Za-z.]+)\s+([-0-9.]+)\s+([\-lumb-]+)\s+([-0-9m.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)/;
> 

Thanks for the correction, should have escaped the - in the regex...

-- 
-sg





More information about the Devel mailing list