OID for Windows Uptime
Moderators: Developers, Moderators
OID for Windows Uptime
I'm trying to put a simple graph into Cacti showing Windows uptime. Trouble is, there seems to be multiple OID's showing different uptimes in Windows, and I need to know one that's actually accurate.
The summary is;
If I query the standard sysuptime OID (1.3.6.1.2.1.1.3), then the value I get is actually the time the SNMP stack has been running (not reliable on a Windows host!)
If I query hrSystemUptime (1.3.6.1.21.25.1.1) I get another figure which is very high (and wrong!), and if I run the standard uptime.exe on Windows, I get yet another uptime (which might be more accurate, but doesn't seem to have an OID).
So, which is the most accurate way of polling uptime on a Windows host?
The summary is;
If I query the standard sysuptime OID (1.3.6.1.2.1.1.3), then the value I get is actually the time the SNMP stack has been running (not reliable on a Windows host!)
If I query hrSystemUptime (1.3.6.1.21.25.1.1) I get another figure which is very high (and wrong!), and if I run the standard uptime.exe on Windows, I get yet another uptime (which might be more accurate, but doesn't seem to have an OID).
So, which is the most accurate way of polling uptime on a Windows host?
I believe hrSystemUptime is the better way to go. Reading through the RFC for it, "The amount of time since this host was last initialized. Note that this is different from sysUpTime in MIB-II [3] because sysUpTime is the uptime of the network management portion of the system." This is represented in TimeTicks. A TimeTicks is,
Being the case its only 32bits, after X days, the counter will wrap and become invalid, FYI.The TimeTicks type represents a non-negative integer which represents the time, modulo 2^32 (4294967296 decimal), in hundredths of a second between two epochs. When objects are defined which use this ASN.1 type, the description of the object identifies both of the reference epochs.
For example, [3] defines the TimeStamp textual convention which is based on the TimeTicks type. With a TimeStamp, the first reference epoch is defined as the time when sysUpTime [5] was zero, and the second reference epoch is defined as the current value of sysUpTime.
The TimeTicks type may not be sub-type
| Scripts: Monitor processes | RFC1213 MIB | DOCSIS Stats | Dell PowerEdge | Speedfan | APC UPS | DOCSIS CMTS | 3ware | Motorola Canopy |
| Guides: Windows Install | [HOWTO] Debug Windows NTFS permission problems |
| Tools: Windows All-in-one Installer |
Thanks for the replies.
I going to have to say that the hrSystemUptime OID on Windows hosts is not giving the correct value. The example I give is for a Windows 2003 server that has been up for 64 days 21 hours (checked).
sysuptime OID gives the correct value, but can't be trusted because it's relevant to the time the management subsystem has been up.
hrSysUptime for the host shows 151 days 17 hours or 1310824344 timeticks (!), and this is the OID polled by the Generic Uptime template. For the life of me, I can't understand why this amount of uptime is showing, if this was meant to be from the last point of initialization.
Running 'uptime.exe' on the host shows the correct value, but I believe this is making an RPC query against the host, so can't easily be used.
I can replicate this on all our Windows hosts. hrSysUptime always shows a 'way off' value, so I can't use it. If I try querying sysuptime and hsSysUptime on *nix hosts though, the values are *almost* the same (maybe a couple of minutes difference). I guess this may be the difference in time between the counter starting from a boot and the management subsystem to start on the host.
I going to have to say that the hrSystemUptime OID on Windows hosts is not giving the correct value. The example I give is for a Windows 2003 server that has been up for 64 days 21 hours (checked).
sysuptime OID gives the correct value, but can't be trusted because it's relevant to the time the management subsystem has been up.
hrSysUptime for the host shows 151 days 17 hours or 1310824344 timeticks (!), and this is the OID polled by the Generic Uptime template. For the life of me, I can't understand why this amount of uptime is showing, if this was meant to be from the last point of initialization.
Running 'uptime.exe' on the host shows the correct value, but I believe this is making an RPC query against the host, so can't easily be used.
I can replicate this on all our Windows hosts. hrSysUptime always shows a 'way off' value, so I can't use it. If I try querying sysuptime and hsSysUptime on *nix hosts though, the values are *almost* the same (maybe a couple of minutes difference). I guess this may be the difference in time between the counter starting from a boot and the management subsystem to start on the host.
It's possible with that large of an uptime, that the counter has rolled over. Other than snmp, the other way to retrieve uptime would be wmi, but that is costly.
| Scripts: Monitor processes | RFC1213 MIB | DOCSIS Stats | Dell PowerEdge | Speedfan | APC UPS | DOCSIS CMTS | 3ware | Motorola Canopy |
| Guides: Windows Install | [HOWTO] Debug Windows NTFS permission problems |
| Tools: Windows All-in-one Installer |
Hey guys. I know this is an old thread, but perhaps someone has a template for this. I checked the forum, but found only one using WMI. Thus my question. Is there a way to get legitimate (I am also seeing issues described by tman - sysuptime OID giving incorrect results) uptime of Windows devices via SNMP? If so, can you please point me to the right template?BSOD2600 wrote:It's possible with that large of an uptime, that the counter has rolled over. Other than snmp, the other way to retrieve uptime would be wmi, but that is costly.
Thanks,
AL
My original comments about this issue and the snmp uptime counter still apply. Thats probably why users have gone with the WMI method instead.
| Scripts: Monitor processes | RFC1213 MIB | DOCSIS Stats | Dell PowerEdge | Speedfan | APC UPS | DOCSIS CMTS | 3ware | Motorola Canopy |
| Guides: Windows Install | [HOWTO] Debug Windows NTFS permission problems |
| Tools: Windows All-in-one Installer |
Could you please post link to the one you are refering to? I want to make sure to use one that works as I have seen many other scripts on the forum.mcutting wrote:Search the Scripts and Templates forum for "Generic Uptime". If you can't find it, let me know, as I am actively using this.
Thanks a lot.
-
- Cacti Guru User
- Posts: 1884
- Joined: Mon Oct 16, 2006 5:57 am
- Location: United Kingdom
- Contact:
have a look at http://forums.cacti.net/viewtopic.php?p ... ime#151908aleu wrote:Could you please post link to the one you are refering to? I want to make sure to use one that works as I have seen many other scripts on the forum.mcutting wrote:Search the Scripts and Templates forum for "Generic Uptime". If you can't find it, let me know, as I am actively using this.
Thanks a lot.
Cacti Version 0.8.8b
Cacti OS Ubuntu LTS
RRDTool Version RRDTool 1.4.7
Poller Information
Type SPINE 0.8.8b
I have just checked this template and saw that it is polling the SNMPv2-MIB::sysUpTime.0 OID (1.3.6.1.2.1.1.3), which is actually the time the SNMP stack has been running. This is not accurate information as one may restart the SNMP service at any time.mcutting wrote:have a look at http://forums.cacti.net/viewtopic.php?p ... ime#151908
What I was trying to query in the past was the "HOST-RESOURCES-MIB::hrSystemUptime.0" or ".1.3.6.1.2.1.25.1.1.0" OID. The issue I am having with the hrSystemUptime is as described here:
It simply works "too fast". I would like to avoid using WMI. Any idea why this OID produces the incorrect data?
aleu wrote:Anyone?
BSOD2600 wrote:I believe hrSystemUptime is the better way to go. Reading through the RFC for it, "The amount of time since this host was last initialized. Note that this is different from sysUpTime in MIB-II [3] because sysUpTime is the uptime of the network management portion of the system." This is represented in TimeTicks. A TimeTicks is,Being the case its only 32bits, after X days, the counter will wrap and become invalid, FYI.The TimeTicks type represents a non-negative integer which represents the time, modulo 2^32 (4294967296 decimal), in hundredths of a second between two epochs. When objects are defined which use this ASN.1 type, the description of the object identifies both of the reference epochs.
For example, [3] defines the TimeStamp textual convention which is based on the TimeTicks type. With a TimeStamp, the first reference epoch is defined as the time when sysUpTime [5] was zero, and the second reference epoch is defined as the current value of sysUpTime.
The TimeTicks type may not be sub-type
| Scripts: Monitor processes | RFC1213 MIB | DOCSIS Stats | Dell PowerEdge | Speedfan | APC UPS | DOCSIS CMTS | 3ware | Motorola Canopy |
| Guides: Windows Install | [HOWTO] Debug Windows NTFS permission problems |
| Tools: Windows All-in-one Installer |
Nevermind, I figured it out. M$ reports the MIB uptime in centiseconds, not miliseconds as other vendors. Attached graph template addresses this issue. Thanks.BSOD2600 wrote:I believe hrSystemUptime is the better way to go. Reading through the RFC for it, "The amount of time since this host was last initialized. Note that this is different from sysUpTime in MIB-II [3] because sysUpTime is the uptime of the network management portion of the system." This is represented in TimeTicks.
- Attachments
-
- cacti_graph_template_uptime_-_windows_system.xml
- (12.67 KiB) Downloaded 969 times
That's what I said...
Anyways, glad you got it working how you wanted.
Anyways, glad you got it working how you wanted.
| Scripts: Monitor processes | RFC1213 MIB | DOCSIS Stats | Dell PowerEdge | Speedfan | APC UPS | DOCSIS CMTS | 3ware | Motorola Canopy |
| Guides: Windows Install | [HOWTO] Debug Windows NTFS permission problems |
| Tools: Windows All-in-one Installer |
Who is online
Users browsing this forum: No registered users and 0 guests