On Fri, 2013-09-13 at 20:46 +0000, Andy Cress wrote:
> Folks,
> 
> Currently net-snmp measures sysUpTime relative to when the snmpd
> starts, and perhaps that is often the same as the overall system
> uptime, but in some systems, the services could be restarted without
> rebooting, so I am proposing that the sysUpTime should be measured
> against the /proc/uptime or /usr/bin/uptime value instead.  The daemon
> could read this at init time.

I recently came across this problem on an embedded system where I was
restarting the daemon in the (extremely rare) event that I needed to
change an account password.  Suddenly my "reboot" detection triggered
because sysUptime had gone backwards.

I could see various solutions to this problem:

1) Use the MIB based authentication configuration, but this wasn't an option
for me as we didn't want that enabled in the system.
2) Find some other way of re-configuring snmpd without restarting.  Well
I failed on that one.
3) Find some other, more appropriate object to use for reboot detection.
Again I failed.
4) Patch snmpd to use the system uptime.

I ended up doing the latter, even though I don't believe it's strictly correct
(see patch below).  I wonder if this could be put in inside #ifdefs for we
strange people who prefer the non-correct operation?


diff -Naur net-snmp-5.7.2_unpatched/agent/mibgroup/mibII/system_mib.c 
net-snmp-5.7.2/agent/mibgroup/mibII/system_mib.c
--- net-snmp-5.7.2_unpatched/agent/mibgroup/mibII/system_mib.c  2013-08-13 
16:10:04.653206559 +0100
+++ net-snmp-5.7.2/agent/mibgroup/mibII/system_mib.c    2013-08-13 
16:14:57.789213501 +0100
@@ -231,7 +231,7 @@
                    netsnmp_request_info *requests)
 {
     snmp_set_var_typed_integer(requests->requestvb, ASN_TIMETICKS,
-                               netsnmp_get_agent_uptime());
+                               get_uptime());
     return SNMP_ERR_NOERROR;
 }

                                          
------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to