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":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.