Changeset 39
- Timestamp:
- Feb 13, 2008, 3:09:48 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/klask
r38 r39 836 836 837 837 if ($switch_name eq '' or $mac_address eq '') { 838 print "Usage: klask search-mac-on-switch SWITCH_NAME MAC_ADDRESS\n"; 839 exit 1; 840 } 841 838 die "Usage: klask search-mac-on-switch SWITCH_NAME MAC_ADDRESS\n"; 839 } 840 841 if (not defined $SWITCH_DB{$switch_name}) { 842 die "Switch $switch_name must be defined in klask configuration file\n"; 843 } 844 845 my $sw = $SWITCH_DB{$switch_name}; 846 my %session = ( -hostname => $sw->{hostname} ); 847 $session{-version} = $sw->{version} || 1; 848 $session{-port} = $sw->{snmpport} || $DEFAULT{snmpport} || 161; 849 if (exists $sw->{version} and $sw->{version} eq 3) { 850 $session{-username} = $sw->{username} || 'snmpadmin'; 851 } 852 else { 853 $session{-community} = $sw->{community} || $DEFAULT{community} || 'public'; 854 } 855 842 856 my $research = "1.3.6.1.2.1.17.4.3.1.2".arp_hex_to_dec($mac_address); 843 857 print "Klask search OID $research on switch $switch_name\n"; 844 858 845 my ($session, $error) = Net::SNMP->session( -hostname => $switch_name);859 my ($session, $error) = Net::SNMP->session( %session ); 846 860 print "$error \n" if $error; 847 861
Note: See TracChangeset
for help on using the changeset viewer.