Collecting details from router, striping info, map and regex. Example.

J

johngnub

Silly, short, handy, Open View, perl that gets the snmp system
location, ( if set in the device ) from the host ( cisco in this
case ), use map and a regex to get from the word street to the end of
the data, the data is from the nexted back ticks, for the command
snmpget, an open view command in this case. I think @foo can be a
$foo, in this case.

(@foo) = map /street(.*)/, `snmpget myrouter.at.home.org
system.sysLocation.0` ;

PS: Here I have ( many ) of the routers with location as street 123
main. Thus street is
the regex.

2 cents JB
 
J

J. Gleixner

johngnub said:
Silly, short, handy, Open View, perl that gets the snmp system
location, ( if set in the device ) from the host ( cisco in this
case ), use map and a regex to get from the word street to the end of
the data, the data is from the nexted back ticks, for the command
snmpget, an open view command in this case. I think @foo can be a
$foo, in this case.

(@foo) = map /street(.*)/, `snmpget myrouter.at.home.org
system.sysLocation.0` ;

PS: Here I have ( many ) of the routers with location as street 123
main. Thus street is the regex.

What exactly is your question?

There are a few SNMP modules on CPAN that might make things more efficient.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top