Hello All.
In Host Resources MIB file has hrSystemDate attribute, that show localtime of server. It possible to get this attribute via SNMP (1.3.6.1.2.1.25.1.2 OID). My problem is: values are in HEX, so, it possible to convert it to string ? or some understandable format ?
Examples of HEX format:
1) 07 D9 0C 02 0D 25 25 00 2B 03 00
2) 07 D9 0C 02 0D 24 2B 00 2D B9 38
It should be like "2009-12-2,9:13:1.0,+3:0".
My Script:
<code>
@Instrumentations = $session->getInstances("HR_SystemDate_Fault");
foreach $Iinstance (@Instrumentations) {
$sysDateObj = $session->object($Iinstance);
$srvTime = $sysDateObj->{HR_SystemDateStr};
if (!$srvTime) { next; }
$octets = $srvTime;
$octets =~ s/ //g;
print " DEBUG :: $octets\n";
## convert each two digit into char code
$octets =~ s/([a-fA-F0-9][a-fA-F0-9])/chr(hex($1))/eg;
</code>
But have no luck :-(
Please help.
In Host Resources MIB file has hrSystemDate attribute, that show localtime of server. It possible to get this attribute via SNMP (1.3.6.1.2.1.25.1.2 OID). My problem is: values are in HEX, so, it possible to convert it to string ? or some understandable format ?
Examples of HEX format:
1) 07 D9 0C 02 0D 25 25 00 2B 03 00
2) 07 D9 0C 02 0D 24 2B 00 2D B9 38
It should be like "2009-12-2,9:13:1.0,+3:0".
My Script:
<code>
@Instrumentations = $session->getInstances("HR_SystemDate_Fault");
foreach $Iinstance (@Instrumentations) {
$sysDateObj = $session->object($Iinstance);
$srvTime = $sysDateObj->{HR_SystemDateStr};
if (!$srvTime) { next; }
$octets = $srvTime;
$octets =~ s/ //g;
print " DEBUG :: $octets\n";
## convert each two digit into char code
$octets =~ s/([a-fA-F0-9][a-fA-F0-9])/chr(hex($1))/eg;
</code>
But have no luck :-(
Please help.