SNMP Tutorial: Getting System Uptime

First Example - Getting System Uptime

As an example, we'll show how to retrieve the system uptime for a device. We're going to use a tool called "snmpget". It comes with most versions of Linux and other Unix-like operating systems. It doesn't come with Windows but it is available to download and we'll talk more about that later.

Here is an example of how to retrieve system uptime using "snmpget":

localhost$ snmpget -M MIBs -v1 -c public myrouter .1.3.6.1.2.1.1.3.0
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (37673001) 4 days, 8:38:00.00

Running the command "snmpget -M MIBs -v1 -c public myrouter .1.3.6.1.2.1.1.3.0" retrieved the value "37673001" which is a time tick value that corresponds to 4 days, 8 hours and 38 minutes.