Cacti / cacti

Cacti ™
http://www.cacti.net
GNU General Public License v2.0
1.63k stars 404 forks source link

device uptime is incorrect. should use sysUpTime if snmpEngineTime returns negative. #5650

Closed haris1024 closed 7 months ago

haris1024 commented 8 months ago

image

image

snmpget -c public -v 2c mydevice .1.3.6.1.6.3.10.2.1.3.0 SNMP-FRAMEWORK-MIB::snmpEngineTime.0 = INTEGER: -1051833 seconds snmpget -c public -v 2c mydevice .1.3.6.1.2.1.1.3 SNMPv2-MIB::sysUpTime = Timeticks: (4189785092) 484 days, 22:17:30.92

TheWitness commented 8 months ago

What device type is this?

TheWitness commented 8 months ago

I would suggest that this is a vendor issue. That value should not be negative. What was the actual uptime of the device at this time? If it was 1,219 days, then we should just use the absolute value of the thing. In any event, this would appear to be a bug in the SNMP agent and not Cacti. Please advise on this and the other question about "what device", from what hardware vendor...

haris1024 commented 8 months ago

What device type is this?

snmpwalk -v2c -cpublic mydevice 1.3.6.1.2.1.1.1.0 SNMPv2-MIB::sysDescr.0 = STRING: FiberHome Fengine S5800-28F-S Routing Switch Sw Ver V310R240M30,Hw Ver 1.02

haris1024 commented 8 months ago

I don't know the actual uptime of the device. My suggestion is simply to fall back to sysuptime if snmpEngineTime returns an invalid value.

TheWitness commented 8 months ago

Do you have support from the vendor? If so, open a ticket.

TheWitness commented 8 months ago

Do you have a login to the devices CLI? If so, usually the uptime command will suffice.

TheWitness commented 8 months ago

Please learn your tool.

image

bernisys commented 7 months ago

Just my 2 cents on this - i know this will not help with the issue, but maybe give some insight into the actual madness behind the scenes, because both the system uptime as well as the engine uptime can be both quite non-saying in certain situations.

First of all the system uptime is a 32 bit integer representing MILLI(!)seconds, which is completely stupid if you ask me, because the timer wraps to zero at around 497 days. If it would count seconds (which is more than enough for the purpose) or (in case somebody needs such an extraordinary high precision) if it was a 64bit number, then this wouldn't be an issue.

And secondly, the SNMP engine uptime shows ONLY the time the current instance of the SNMP engine is up. So if you needed to restart the engine on the device, this would not show the OS uptime any more and is therefor a majorly misleading value.

I would wish for an implementation of a "uptime in seconds" counter within the MIB carrying the System description. Unfortunately this would need all vendors to implement this ...

haris1024 commented 7 months ago

Device vendor issues.