This post is more than 5 years old
9 Posts
0
1239
December 17th, 2012 02:00
Seeing Hex in ASL --- SNMP Poll
I want to be able to see the hex values of an SNMP poll (ASL code below with my
results). What I get back is what looks to be partial responses or mixed
responses maybe. Seeing \X00\X1Ez\X19\XCA\XA0 or \XF0%r\XDA\X04` does not make
sense to me (yes, I expect the \X00 but not an ascii character in with it.
Ideas on being able to see just ascii or just hex -- what am I missing?
+++++++++++++++++++++++++
Typical Response
------------------------------------------
OID clientAPmac -->\XF0%r\XDA\X04`
no Hex to string ==\X00\X1Ez\X19\XCA\XA0
OID clientAPmac -->\X00\X1Ez\X19\XCA\XA0
no Hex to string ==\X00\X1Ez\X19\XCA\XA0
OID clientAPmac -->\X00\X1Ez\X19\XCA\XA0
no Hex to string ==\X00\X19\XA9\XFFJP
OID clientAPmac -->\X00\X19\XA9\XFFJP
+++++++++++++++++++++++++++++++++++++++++++
Code used
-------------------------------------------
snmp = create( "ACT_SNMP", "ACT_SNMP-my-snmp");
timeout = 30;
retries = 2;
OIDindex = ".0";
wlcMacAddressTable = table();
if (!snmp->started) { snmp->start(timeout, retries); }
system = object( "P_WLC", "ccxxwlc");
agent = system->getSNMPAgent();
startoid = ".1.3.6.1.4.1.14179.2.2.1.1.3";
oid = ".1.3.6.1.4.1.14179.2.2.1.1.3";
getOIDList = list(list("clientAPmac", ".1.3.6.1.4.1.14179.2.1.4.1.4"));
tm = object("ICF-TopologyManager");
START {
.. eol
} do {
foreach getOID (getOIDList)
{
result = list( "", "error", "" );
notDone = TRUE;
startoid = getOID[1];
oid = getOID[1];
print("===================================");
print("================ New OID ==========");
print("oid using-->".oid);
while (notDone)
{
result = tm->snmpActGetNext(snmp, agent, oid)?IGNORE;
curOID = result[0];
if (result[1] == "error") {
print( "Attempt to get ".oid." failed");
}
if (result[2] != -1 )
{
if (!glob(startoid . ".*", result[0]))
{
notDone = FALSE;
print("End of MIB tree");
} else {
print("no Hex to string ==".result[2]);
getResult = hexToString(result[2]);
print("OID ".getOID[0]." -->".result[2]);
oid = curOID;
}
} // End of if (result[0]
} // End of while (notDone)
} // End of foreach getOID
}
PaulORourke
170 Posts
0
December 18th, 2012 07:00
Hi Kili,
Please find script attached.
I have implemented the SNMP request and the processing of results in a slightly different manner.
I have tested against the MAC address table on one of our test routers and it produced the following output(I have removed the IP addresses):
OID .1.3.6.1.2.1.4.22.1.2.1.x.x.x.x -->002304FCCE00
OID .1.3.6.1.2.1.4.22.1.2.1.x.x.x.x -->002304FCCE00
OID .1.3.6.1.2.1.4.22.1.2.1.x.x.x.x -->000943DA2AC0
OID .1.3.6.1.2.1.4.22.1.2.1.x.x.x.x -->0010181CB92D
OID .1.3.6.1.2.1.4.22.1.2.1.x.x.x.x -->00144F7061F0
Is this the type of output you were looking for?
Please find script attached and let me know if this works for you correctly.
Kind Regards,
Paul O'Rourke
1 Attachment
hexOutput.asl
Kili1
9 Posts
0
December 17th, 2012 05:00
Yeah, saw that and fixed it earlier and get the same results.