Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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 test-SNMP-Basic.pl 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.


In reply to Re: Need help to parse the text by NetWallah
in thread Need help to parse the text by GS

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2024-04-26 07:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found