#!/usr/bin/perl # # a "PMWHO" for the ARC # # Created by Marshall Morgan (marshall@netdoor.com) on 03/17/98 # for use with USR/3COM Total Control HiPerARC Terminal Servers (known v4.0.x) # # perl mods by Ben Brown (ben@netdoor.com) # # Based on original work by: # # Created by Carlos.Canau@EUnet.pt with cfgmaker from Tobias Oetiker # as skeleton # # Switches and ping added by David Hamilton (dhamilton@voyager.net) on 1-28/2003 use SNMP_Session; use BER; use Socket; %snmpget::OIDS = ( 'usrCfgNetIfName' => '1.3.6.1.4.1.429.4.1.7.1.2', 'usrNetLogicalId' => '1.3.6.1.4.1.429.4.1.7.1.7', 'usrCfgNetUserName' => '1.3.6.1.4.1.429.4.1.7.1.9', 'usrIpAddress' => '1.3.6.1.4.1.429.4.19.13.1.9.0.0.0.0', ); my($community,$router) = split /\@/, $ARGV[0]; die < int((split(/\|/, $b))[2]); } @blah = sort mysort @info; ## put back, now in order $i = 0; foreach (@blah) { # print "DEBUG: <$blah[$i]>\n"; ($ifname[$i],$username[$i],$netlogicalid[$i]) = split(/\|/, $blah[$i]); $i++; } print <open ($host , $community, 161); for(;;) { if ($session->getnext_request_response(($enoid))) { $response = $session->pdu_buffer; ($bindings) = $session->decode_get_response ($response); ($binding,$bindings) = decode_sequence ($bindings); ($next_oid,$value) = decode_by_template ($binding, "%O%@"); # quit once we are outside the table last unless BER::encoded_oid_prefix_p($orig_oid,$next_oid); $tempo = pretty_print($value); #print "$var: '$tempo'\n"; $tempo=~s/\t/ /g; $tempo=~s/\n/ /g; $tempo=~s/^\s+//; $tempo=~s/\s+$//; push @table, $tempo; } else { die "No answer from $ARGV[0]\n"; } $enoid=$next_oid; } $session->close (); return (@table); }