Changeset 121
- Timestamp:
- Apr 21, 2013, 10:05:56 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/klask
r119 r121 97 97 J4903A => { model => 'HP2824', match => 'J4903A.+?Switch 2824,' }, 98 98 J4110A => { model => 'HP8000M', match => 'HP J4110A ProCurve Switch 8000M' }, 99 JD374A => { model => 'HP5500-24F', match => 'HP Comware.+?A5500-24G-SFP EI' 99 JD374A => { model => 'HP5500-24F', match => 'HP Comware.+?A5500-24G-SFP EI', mibflag => 2 }, 100 100 BS350T => { model => 'BS350T', match => 'BayStack 350T HW' }, 101 101 N3483G => { model => 'NA3483-6G', match => 'GigaSwitch V3 TP SFP-I 48V ES3' }, … … 107 107 sysContact => '1.3.6.1.2.1.1.4.0', 108 108 sysLocation => '1.3.6.1.2.1.1.6.0', 109 searchPort => '1.3.6.1.2.1.17.4.3.1.2', 109 searchPort1 => '1.3.6.1.2.1.17.4.3.1.2', 110 searchPort2 => '1.3.6.1.2.1.17.7.1.2.2.1.2.1', 110 111 ); 111 112 … … 338 339 } 339 340 340 my $research = $OID_NUMBER{searchPort} . mac_address_hex_to_dec($mac_address); 341 my $research1 = $OID_NUMBER{searchPort1} . mac_address_hex_to_dec($mac_address); 342 my $research2 = $OID_NUMBER{searchPort2} . mac_address_hex_to_dec($mac_address); 341 343 342 344 LOOP_ON_SWITCH: … … 346 348 347 349 my $result = $session->get_request( 348 -varbindlist => [$research ]350 -varbindlist => [$research1, $research2] 349 351 ); 350 if (not defined $result or $result->{$research } eq 'noSuchInstance') {352 if (not defined $result or $result->{$research1} eq 'noSuchInstance' or $result->{$research2} eq 'noSuchInstance') { 351 353 $session->close; 352 354 next LOOP_ON_SWITCH; 353 355 } 354 356 355 my $swport = $result->{$research}; 357 my $swport = $result->{$research1}; 358 $swport = $result->{$research2} if $result->{$research1} eq 'noSuchInstance'; 356 359 $session->close; 357 360 … … 398 401 # } 399 402 400 my $research = $OID_NUMBER{searchPort} . mac_address_hex_to_dec($mac_address); 403 my $research1 = $OID_NUMBER{searchPort1} . mac_address_hex_to_dec($mac_address); 404 my $research2 = $OID_NUMBER{searchPort2} . mac_address_hex_to_dec($mac_address); 401 405 LOOP_ON_ALL_SWITCH: 402 406 for my $sw (@SWITCH) { … … 405 409 406 410 my $result = $session->get_request( 407 -varbindlist => [$research ]411 -varbindlist => [$research1, $research2] 408 412 ); 409 413 410 if(defined $result and $result->{$research} ne 'noSuchInstance'){ 411 my $swport = $result->{$research}; 414 if(defined $result and ($result->{$research1} ne 'noSuchInstance' or $result->{$research2} ne 'noSuchInstance')){ 415 my $swport = $result->{$research1}; 416 $swport = $result->{$research2} if $result->{$research1} eq 'noSuchInstance'; 412 417 413 418 $ret->{$sw->{hostname}} = {}; … … 1510 1515 } 1511 1516 1512 my $research = $OID_NUMBER{searchPort} . mac_address_hex_to_dec($mac_address); 1513 print "Klask search OID $research on switch $sw_name\n"; 1517 my $research1 = $OID_NUMBER{searchPort1} . mac_address_hex_to_dec($mac_address); 1518 my $research2 = $OID_NUMBER{searchPort2} . mac_address_hex_to_dec($mac_address); 1519 print "Klask search OID $research1 on switch $sw_name\n"; 1514 1520 1515 1521 my ($session, $error) = Net::SNMP->session( %session ); … … 1517 1523 1518 1524 my $result = $session->get_request( 1519 -varbindlist => [$research ]1525 -varbindlist => [$research1, $research2] 1520 1526 ); 1521 1527 1522 if (not defined $result or $result->{$research } eq 'noSuchInstance') {1528 if (not defined $result or $result->{$research1} eq 'noSuchInstance' or $result->{$research2} eq 'noSuchInstance') { 1523 1529 print "Klask do not find MAC $mac_address on switch $sw_name\n"; 1524 1530 $session->close; 1525 1531 } 1526 1532 1527 my $swport = $result->{$research}; 1533 my $swport = $result->{$research1}; 1534 $swport = $result->{$research2} if $result->{$research1} eq 'noSuchInstance'; 1528 1535 $session->close; 1529 1536
Note: See TracChangeset
for help on using the changeset viewer.