Re: sysUpTime question

Bart Van Assche <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
On Sun, Nov 29, 2009 at 7:39 PM, Dave Shield <[email protected]>wrote:

> 2009/11/29  <[email protected]>:
> > the issue could have been resolved by sampling the
> > system uptime when the snmp daemon starts, and using
> > it to calculate the sysUptime value, instead of relaying
> > on the system clock
>
> But the value of system uptime when the agent starts is 0,
> by definition.
>
> The SNMP agent needs to relate this point to future
> timestamps, and does so by using the local clock.
>
> Yes - if that clock time changes, you've got a problem.
>

Computing the system uptime via gettimeofday() is wrong. A better solution
would be to let get_uptime() in snmplib/system.c compute the system uptime
using methods that do not depend on the wall clock time,  e.g.
clock_gettime(CLOCK_MONOTONIC) on POSIX systems that support monotonic
clocks or GetTickCount() on Windows systems. Note: the clock rate of
CLOCK_MONOTONIC takes the clock drift computed by the NTP algorithm in
account, while GetTickCount() does not.

Bart.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july

_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.