Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re: Need help to parse the text

by NetWallah (Canon)
on Jun 17, 2004 at 05:54 UTC ( #367541=note: print w/replies, xml ) Need Help??

in reply to Need help to parse the text

To get Interface status, I strongly recommend you use SNMP.

This is a lot more flexible, and powerful, and allows you to monitor externally. Here is some working code:

use Net::SNMP::Interfaces; my @StatusText = qw(Invalid-0 UP DOWN testing INVALID-4 dormant-5 Not- +Present-6); my $InterfacesObject = Net::SNMP::Interfaces->new(Hostname => $ARGV[0] + || 'localhost', Community => $ARGV[1] || + 'public' ) or die "*ERROR* : Could not connect\n"; my @InterfaceDetails = $InterfacesObject->all_interfaces(); print "Name: " . $_->name() . "\tStatus=" . $StatusText[$_->ifOperStatus()] ." \n" for @InterfaceDetails; ---Run and Output ---- >perl IP-Address-of-target Community-name Name: Serial2/0 Status=UP Name: BRI1/2:2 Status=DOWN Name: BRI1/3 Status=DOWN Name: BRI1/3:1 Status=DOWN Name: BRI1/3:2 Status=DOWN Name: FastEthernet2/0 Status=UP Name: FastEthernet2/1 Status=DOWN Name: Hssi3/0 Status=UP Name: Null0 Status=UP Name: Loopback0 Status=UP Name: Hssi3/0.605 Status=UP Name: BRI1/0 Status=dormant-5 Name: Hssi3/0.700 Status=UP Name: BRI1/0-Physical Status=UP Name: BRI1/0-Signaling Status=dormant-5 Name: BRI1/0:1-Bearer Channel Status=DOWN Name: BRI1/0:2-Bearer Channel Status=DOWN Name: BRI1/1-Physical Status=DOWN Name: BRI1/1-Signaling Status=DOWN Name: BRI1/1:1-Bearer Channel Status=DOWN Name: BRI1/1:2-Bearer Channel Status=DOWN Name: BRI1/2-Physical Status=DOWN Name: BRI1/0:1 Status=dormant-5 Name: BRI1/2-Signaling Status=DOWN Name: BRI1/2:1-Bearer Channel Status=DOWN Name: BRI1/2:2-Bearer Channel Status=DOWN Name: BRI1/3-Physical Status=DOWN Name: BRI1/3-Signaling Status=DOWN Name: BRI1/3:1-Bearer Channel Status=DOWN Name: BRI1/3:2-Bearer Channel Status=DOWN Name: Hssi3/0.100 Status=UP Name: Hssi3/0.679 Status=UP Name: Hssi3/0.686 Status=UP Name: BRI1/0:2 Status=dormant-5 Name: Dialer101 Status=dormant-5 Name: Hssi3/0.576 Status=UP Name: BRI1/1 Status=DOWN Name: BRI1/1:1 Status=DOWN Name: BRI1/1:2 Status=DOWN Name: BRI1/2 Status=DOWN Name: BRI1/2:1 Status=DOWN

Offense, like beauty, is in the eye of the beholder, and a fantasy.
By guaranteeing freedom of expression, the First Amendment also guarantees offense.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://367541]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (2)
As of 2022-08-08 00:43 GMT
Find Nodes?
    Voting Booth?

    No recent polls found