On Fri, Jul 27, 2012 at 22:41 UTC, Anssi Johansson wrote:
> my $status = `/usr/sbin/ntpdc -c iostats`;
> if($status =~ m!received packets:\s*(-?\d+)!) {
>     $received=$1 + 2147483648;
> }
> if($status =~ m!packets sent:\s*(-?\d+)!) {
>     $sent=$1 + 2147483648;
> }
>
> print "$received\n$sent\n$uptime\n$hostname\n";
> ---
>
> The "+ 2147483648" part is there to make the number always positive. My
> version of ntpdc wraps around at 2^31 to -2^31, which confuses MRTG. The "+
> 2147483648" part makes the scale to be 0 from 2^32.

If your ntpd is running on a 64-bit system, and you upgrade ntpq and
ntpd to 4.2.7, you can use "ntpq -c iostats" to get the same numbers
without the 32-bit truncation mandated by ntpdc's binary NTP mode 7
protocol.

Cheers,
Dave Hart
_______________________________________________
pool mailing list
[email protected]
http://lists.ntp.org/listinfo/pool

Reply via email to