SNMP uptime query observation

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

Post Reply
mactfines
Posts: 9
Joined: Thu Apr 20, 2006 4:09 pm

SNMP uptime query observation

Post by mactfines »

Hi,

When I query a RedHat EL 3 system which has been up for 8 hours, 57 minutes, using an snmp query for uptime, I get back a value of :
3220881

My understanding is this is in 1/100ths of a second, so about 32,208 seconds, which is about 536 minutes (32,208/60), which is 8.94 hours (536/60). OK, that looks right.

I then query a FreeBSD system with the same query, only it has been up for 349 days. I get back a value of 11908608. Supposedly that is also in 1/100ths of seconds, so 119,086 seconds, which is 1,984 minutes (119,086/60), which is 33 hours, which is obviously not even close.

Then I query a RedHat 7.3 system which has been up for 2 days, 9h, 32m. I get an answer of 1227. I don't even have to start to try and calculate that one. The numbers don't line up.

I realized that the numbers returned by an snmp uptime query don't refer to the system uptime, but to the snmp daemon process uptime. I only recently installed it on all of the systems, and in fact only installed it on the last one in the middle of writing this message. The first system is correct, as I installed snmp on it yesterday and rebooted it just this morning, so the snmp daemon process uptime would match the system uptime.

This isn't really a question, just an observation, and post for others who might also be wondering why the results of the 'uptime' command and the snmp uptime query don't always match. This doesn't seem like the best way for the snmpd process to determine system uptime, since on Linux/FreeBSD/Windows, the OS provides this info.
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

Your FreeBSD uptime counter likely has rolled over a time or two, hence the too small number.
mactfines
Posts: 9
Joined: Thu Apr 20, 2006 4:09 pm

Post by mactfines »

That's what I thought might be happening also. But that isn't the problem.

SNMP's uptime shows the time the snmpd daemon has been running, and here is the proof:

qmail# ./snmp_uptime.pl localhost
SNMP::Info::_global uptime : sysUpTime.0
uptime: 17057898
qmail# /usr/local/etc/rc.d/snmpd.sh stop
Stopping snmpd.
Waiting for PIDS: 28827.
qmail# /usr/local/etc/rc.d/snmpd.sh start
Starting snmpd.
qmail# ./snmp_uptime.pl localhost
SNMP::Info::_global uptime : sysUpTime.0
uptime: 347

You'll see the same behavior on RHEL3 and RedHat 7.3 also. This is not the case with OSX, which I'm still not sure where it is getting its numbers.

I realize this is not a Cacti issue. Just an observation I thought worth sharing.
melchandra
Cacti User
Posts: 311
Joined: Tue Jun 29, 2004 12:52 pm
Location: Indiana

Post by melchandra »

BSOD2600 wrote:Your FreeBSD uptime counter likely has rolled over a time or two, hence the too small number.
Perhaps

these things are _generally_ stored in 32 bit counters

2^32 = 4294967296
(/ 100) = 42949672 seconds
(/ 60) = 715827 minutes
(/ 60) = 11930 hours
(/ 24) = 467 days
Dave
mactfines
Posts: 9
Joined: Thu Apr 20, 2006 4:09 pm

Post by mactfines »

From: http://www.alvestrand.no/objectid/1.3.6.1.2.1.1.3.html

OID value: 1.3.6.1.2.1.1.3

OID description:

sysUpTime OBJECT-TYPE
SYNTAX TimeTicks
ACCESS read-only
STATUS mandatory
DESCRIPTION
"The time (in hundredths of a second) since the
network management portion of the system was last
re-initialized."
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest