using pysnmp I am querying a variable which gives the IP address. I want to check that address.

I do the following

...........
............
.............
errorIndication, errorStatus, errorIndex, varBinds = cmdgen.CommandGenerator().getCmd( cmdgen.CommunityData('xxx', 'yyy', 1), cmdgen.UdpTransportTarget((addr,161)), ((1,3,6,1,4,1,18489,1,2,2,2,9,30,0)))
print"Error on GET for ccmSDIDULinkUtilEastRemoteIP -%s,%s%(errorIndication,errorStatus)
print varBinds
print varBinds[0][1]

i get the following:

Error on GET for ccmSDIDULinkUtilEastRemoteIP -None,0
[(ObjectName('1.3.6.1.4.1.18489.1.2.2.2.9.30.0'), IpAddress('0.0.0.0'))]

varBinds[0][1] is giving me some wierd value.. some unrecognizable characters..which i can't even copy, paste.. It's driving me nuts :'(

Pls.. help........

Recommended Answers

All 4 Replies

Try to print the repr() of the weird string, then post it here.

Grib....

repr() of the value gives me:

IpAddress('0.0.0.0')

:)

Grib....

repr() of the value gives me:

IpAddress('0.0.0.0')

:)

Ok, so it's not at all weird, only it's not a very useful address... Were you expecting something else ?

ok... thanks Grib...
before using repr(), I was getting some unrecognizable string.. something like four squares!!

U guided me in the right direction... Thanks a lot :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.