Hi,

Another approach to solve your problem is using the SNMP (Simple Network Management Protocol). If you are allowed to run snmp-daemons on the servers you want to check, its quite easy and you'll get uniform results regardless of the OS (in theory at least). Using tools like 'snmpwalk' you could get the information you want from a remote host like this:

prompt$ snmpwalk -c mylittlesecret -v 1 remotehost | egrep 'ifDescr|if +AdminStatus' IF-MIB::ifDescr.1 = STRING: sis0 IF-MIB::ifDescr.2 = STRING: vr0 IF-MIB::ifDescr.3 = STRING: lo0 IF-MIB::ifDescr.4 = STRING: faith0 IF-MIB::ifAdminStatus.1 = INTEGER: up(1) IF-MIB::ifAdminStatus.2 = INTEGER: up(1) IF-MIB::ifAdminStatus.3 = INTEGER: up(1) IF-MIB::ifAdminStatus.4 = INTEGER: down(2)
Just be sure you do this on a well protected intranet (I guess so because you use telnet to connect to the remote host), or use SNMP version 3 which has much better security than the standard version 1 (which I used in the example above, by using '-v 1')

Of course you could use Net::SNMP instead of 'snmpwalk' to query remote snmp-daemons.


In reply to Re: Need help to parse the text by eXile
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.