I'm trying to poll OID: .1.3.6.1.2.1.10.127.1.3.3.1.3 (MIB: docsIfCmtsCmStatusIpAddress). The result should return an IP address format.
When using your basic script in expamples directory I get the result value returned sometimes a string sometimes byte:
host=0.0.0.0 oid=cmIP.21 value='b'0ae4e73e''
host=0.0.0.0 oid=cmIP.23 value='b'0ae28fc8''
host=0.0.0.0 oid=cmIP.32 value='b'0ae28150''
host=0.0.0.0 oid=cmIP.33 value='b'0ae4e6b0''
host=0.0.0.0 oid=cmIP.35 value='
₆'
Bytes can be normaly decoded into an IP address while string is imposible to decode into an IP address. I've tried:
if type(d[3]) is str:
a = d[3]
if len(a) == 3:
b = ''.join(a).encode('utf-8')
else:
b = [ord(x) for x in a]
ip = '{}.{}.{}.{}'.format(*b)
But the length of the string returned is just too small :(
Hi,
First of all great job 👍
I'm trying to poll OID: .1.3.6.1.2.1.10.127.1.3.3.1.3 (MIB: docsIfCmtsCmStatusIpAddress). The result should return an IP address format. When using your basic script in expamples directory I get the result value returned sometimes a string sometimes byte: host=0.0.0.0 oid=cmIP.21 value='b'0ae4e73e'' host=0.0.0.0 oid=cmIP.23 value='b'0ae28fc8'' host=0.0.0.0 oid=cmIP.32 value='b'0ae28150'' host=0.0.0.0 oid=cmIP.33 value='b'0ae4e6b0'' host=0.0.0.0 oid=cmIP.35 value=' ₆'
Bytes can be normaly decoded into an IP address while string is imposible to decode into an IP address. I've tried: if type(d[3]) is str: a = d[3] if len(a) == 3: b = ''.join(a).encode('utf-8') else: b = [ord(x) for x in a] ip = '{}.{}.{}.{}'.format(*b)
But the length of the string returned is just too small :(
Do you have any idea on how to solve this issue?
Thanks in advance and BR, Janko