in reply to Need help to parse the text
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:
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')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)
Of course you could use Net::SNMP instead of 'snmpwalk' to query remote snmp-daemons.
|
|---|