Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have the oid to get system time from linux, but is it possible to determine the system timezone via snmp on a redhat/centos box?

share|improve this question
    
What format is the raw time data coming in? Sometimes the time zone is embedded (e.g. date command). –  JeffG Mar 24 '11 at 13:07
add comment

1 Answer

up vote 4 down vote accepted

The hrSystemDate.0 object returns the local timezone:

HOST-RESOURCES-MIB::hrSystemDate.0 = STRING: 2011-3-24,6:20:24.0,-6:0
                                                                 ^^^^

The suffix shows the time offset from GMT.

share|improve this answer
    
That looks good, is that setting it though? Or retrieving the value? I need to retrieve the value from the host. –  Chris Mar 24 '11 at 13:38
    
That was done with snmpget (retrieving it). –  Wes Hardaker Mar 24 '11 at 13:49
    
thanks, looks like the oid for hrSystemDate is 1.3.6.1.2.1.25.6.3.1.5.1? That returns a hex string. When I use snmpwalk with the above text query it doesn't recognize HOST-RESOURCES-MIB::hrSystemDate.0 ... –  Chris Mar 24 '11 at 15:11
    
Then you need to set the MIBS to load properly if that's the case. Try snmpwalk HOST-RESOURCES-MIB::hrSystemDate and it should format it properly. The contents of the string is a series of numbers that represents the above text. See the DateAndTime textual convention in the SNMPv2-TC.txt MIB file that should be on your system. –  Wes Hardaker Mar 24 '11 at 15:57
1  
For those on ubuntu 10.10 x86_64, default install, where ubuntu is the polling host (where you're querying FROM), need the following mibs in /usr/share/mibs/netsnmp/ - IANAifType-MIB, SNMPv2-MIB, SNMPv2-SMI, SNMPv2-TC,HOST-RESOURCES-MIB. These fixed this issue for me at least. –  Chris Mar 24 '11 at 16:16
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.