Changeset 276 for trunk/klask
- Timestamp:
- Sep 23, 2017, 10:26:52 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/klask
r275 r276 1835 1835 } 1836 1836 1837 my $search = $OID_NUMBER{'NApoeState'} . ".$switch_port"; # Only NEXANS Switch and low port number1837 my $search = $OID_NUMBER{'NApoeState'} . ".$switch_port"; # Only NEXANS switch and low port number 1838 1838 1839 1839 my $sw = $SWITCH_DB{$sw_name}; … … 1873 1873 } 1874 1874 1875 my $search = $OID_NUMBER{'NApoeState'} . ".$switch_port"; # Only NEXANS Switch and low port number1875 my $search = $OID_NUMBER{'NApoeState'} . ".$switch_port"; # Only NEXANS switch and low port number 1876 1876 1877 1877 my $sw = $SWITCH_DB{$sw_name}; … … 1911 1911 } 1912 1912 1913 my $search = $OID_NUMBER{'NApoeState'} . ".$switch_port"; # Only NEXANS Switch and low port number1913 my $search = $OID_NUMBER{'NApoeState'} . ".$switch_port"; # Only NEXANS switch and low port number 1914 1914 1915 1915 my $sw = $SWITCH_DB{$sw_name}; … … 1922 1922 1923 1923 if (defined $result and $result->{$search} ne 'noSuchInstance') { 1924 my $poe = $result->{$search} || 'empty';1925 $poe =~ s/8/enable/;1926 $poe =~ s/2/disable/;1927 printf "%s %s poe %s\n", $sw_name, $switch_port, $poe ;1924 my $poe_status = $result->{$search} || 'empty'; 1925 $poe_status =~ s/8/enable/; 1926 $poe_status =~ s/2/disable/; 1927 printf "%s %s poe %s\n", $sw_name, $switch_port, $poe_status; 1928 1928 } 1929 1929 else { 1930 print "Klask do not find PoE Status on switch $sw_name on port $switch_port\n";1930 print "Klask do not find PoE status on switch $sw_name on port $switch_port\n"; 1931 1931 } 1932 1932 … … 2315 2315 2316 2316 my $switch_name = shift @ARGV || q{}; 2317 my $port 2318 2319 if ($switch_name eq q{} or $port eq q{}) {2317 my $port_hr = shift @ARGV || q{}; 2318 2319 if ($switch_name eq q{} or $port_hr eq q{}) { 2320 2320 die "Usage: klask disable SWITCH_NAME PORT\n"; 2321 2321 } … … 2330 2330 2331 2331 # Retrieve numeric port value 2332 my $port_id = snmp_get_switchport_hr2id($session, normalize_port_human_readable($port ), $verbose ? 'yes' : '');2333 die "Error : Port $port does not exist on switch $switch_name\n" if not $port_id =~ m/^\d+$/;2332 my $port_id = snmp_get_switchport_hr2id($session, normalize_port_human_readable($port_hr), $verbose ? 'yes' : ''); 2333 die "Error : Port $port_hr does not exist on switch $switch_name\n" if not $port_id =~ m/^\d+$/; 2334 2334 2335 2335 my $search_portstatus = $OID_NUMBER{'portUpDown'} .'.'. $port_id; 2336 print "Info: switch $switch_name port $port SNMP OID $search_portstatus\n" if $verbose;2336 print "Info: switch $switch_name port $port_hr SNMP OID $search_portstatus\n" if $verbose; 2337 2337 2338 2338 my $result = $session->set_request( … … 2360 2360 2361 2361 my $switch_name = shift @ARGV || q{}; 2362 my $port 2363 2364 if ($switch_name eq q{} or $port eq q{}) {2362 my $port_hr = shift @ARGV || q{}; 2363 2364 if ($switch_name eq q{} or $port_hr eq q{}) { 2365 2365 die "Usage: klask disable SWITCH_NAME PORT\n"; 2366 2366 } … … 2375 2375 2376 2376 # Retrieve numeric port value 2377 my $port_id = snmp_get_switchport_hr2id($session, normalize_port_human_readable($port ), $verbose ? 'yes' : '');2378 die "Error : Port $port does not exist on switch $switch_name\n" if not $port_id =~ m/^\d+$/;2377 my $port_id = snmp_get_switchport_hr2id($session, normalize_port_human_readable($port_hr), $verbose ? 'yes' : ''); 2378 die "Error : Port $port_hr does not exist on switch $switch_name\n" if not $port_id =~ m/^\d+$/; 2379 2379 2380 2380 my $search_portstatus = $OID_NUMBER{'portUpDown'} .'.'. $port_id; 2381 print "Info: switch $switch_name port $port SNMP OID $search_portstatus\n" if $verbose;2381 print "Info: switch $switch_name port $port_hr SNMP OID $search_portstatus\n" if $verbose; 2382 2382 2383 2383 my $result = $session->set_request( … … 2403 2403 2404 2404 my $switch_name = shift @ARGV || q{}; 2405 my $port 2406 2407 if ($switch_name eq q{} or $port eq q{}) {2405 my $port_hr = shift @ARGV || q{}; 2406 2407 if ($switch_name eq q{} or $port_hr eq q{}) { 2408 2408 die "Usage: klask status SWITCH_NAME PORT\n"; 2409 2409 } … … 2418 2418 2419 2419 # Retrieve numeric port value 2420 my $port_id = snmp_get_switchport_hr2id($session, normalize_port_human_readable($port ), $verbose ? 'yes' : '');2421 die "Error : Port $port does not exist on switch $switch_name\n" if not $port_id =~ m/^\d+$/;2420 my $port_id = snmp_get_switchport_hr2id($session, normalize_port_human_readable($port_hr), $verbose ? 'yes' : ''); 2421 die "Error : Port $port_hr does not exist on switch $switch_name\n" if not $port_id =~ m/^\d+$/; 2422 2422 2423 2423 my $search_portstatus = $OID_NUMBER{'portUpDown'} .'.'. $port_id; 2424 print "Info: switch $switch_name port $port ($port_id) SNMP OID $search_portstatus\n" if $verbose;2424 print "Info: switch $switch_name port $port_hr ($port_id) SNMP OID $search_portstatus\n" if $verbose; 2425 2425 2426 2426 my $result = $session->get_request(
Note: See TracChangeset
for help on using the changeset viewer.