For Linux , heres wt I have done :
snmp_vars.c :
long my_starttime;
int
init_agent(const char *app)
{
int r = 0;
/*
* get current time (ie, the time the agent started)
*/
gettimeofday(&starttime, NULL);
starttime.tv_sec--;
starttime.tv_usec += 1000000L;
my_starttime = get_uptime(); /*gets the current time during startup*/
......
}
*********************
while in snmp_agent.c:
extern long my_starttime;
u_long
netsnmp_get_agent_uptime(void)
{
long now;
now = get_uptime();
return (now - my_starttime);
}
Have tested it on my system(FC1 2.6.9 ) for sysUpTime
What other implications do I need to see...checked for traps too.
On 1/18/06, Dave Shield <[EMAIL PROTECTED]> wrote:
> On Wed, 2006-01-18 at 15:18 +0530, Suma C wrote:
> > The function get_uptime is in snmplib/system.c
>
> <doh>
> No wonder I couldn't find a system man page for it!
>
>
> OK - checking the logs, 'get_uptime()' seems to
> go back to the very start of the UCD-SNMP project,
> and is part of the code we inherited from CMU.
>
> Right from the start, this was handled separately
> from the 'sysUpTime' MIB object, so it looks as we've
> just developed the two in parallel.
>
> I *think* it should just be a matter of tweaking
> the 'netsnmp_get_agent_uptime()' routine to use
> get_uptime(), but I wouldn't want to make this
> tweak with a clearer idea of the implications.
>
> I hope that some of the other core developers
> might chip in here.....
>
> Dave
>
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders