Changeset 59
- Timestamp:
- Jul 24, 2009, 2:23:15 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/klask
r58 r59 184 184 $ret{timestamp} = $timestamp if $timestamp; 185 185 186 my $nowtimestamp = time ();186 my $nowtimestamp = time; 187 187 188 188 if ( $type eq 'fast' and ( not defined $timestamp or $timestamp < ( $nowtimestamp - 3 * 3600 ) ) ) { … … 220 220 my @paquets = (); 221 221 foreach ( split m/ : /xms, $ret{mac_address} ) { 222 my @chars = split m//xms, uc ("00$_");222 my @chars = split m//xms, uc "00$_"; 223 223 push @paquets, "$chars[-2]$chars[-1]"; 224 224 } … … 294 294 sub hex_to_dec { 295 295 #00:0F:1F:43:E4:2B 296 my $car = '00' . uc (shift);296 my $car = '00' . uc shift; 297 297 298 298 return '00' if $car eq '00UNKNOW'; … … 351 351 -varbindlist => [$research] 352 352 ); 353 if (not defined ($result)or $result->{$research} eq 'noSuchInstance') {353 if (not defined $result or $result->{$research} eq 'noSuchInstance') { 354 354 $session->close; 355 355 next LOOP_ON_SWITCH; … … 408 408 ); 409 409 410 if(defined ($result)and $result->{$research} ne 'noSuchInstance'){410 if(defined $result and $result->{$research} ne 'noSuchInstance'){ 411 411 my $swport = $result->{$research}; 412 412 … … 484 484 485 485 my $reste = (($sw_port - 1) % 8) + 1; 486 my $major = int ( ($sw_port - 1) / 8);486 my $major = int (($sw_port - 1) / 8); 487 487 488 488 return "$INTERNAL_PORT_MAP{$major}$reste"; … … 495 495 return $sw_port if not $sw_model eq 'HP8000'; 496 496 497 my $letter = substr ($sw_port, 0, 1);497 my $letter = substr $sw_port, 0, 1; 498 498 499 499 # return $port if $letter =~ m/\d/; 500 500 501 my $reste = substr ($sw_port, 1);501 my $reste = substr $sw_port, 1; 502 502 503 503 return $INTERNAL_PORT_MAP_REV{$letter} * 8 + $reste; … … 569 569 next LOOP_ON_COMPUTER unless exists $computerdb->{$ip}; 570 570 571 my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime ($computerdb->{$ip}{timestamp});571 my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime $computerdb->{$ip}{timestamp}; 572 572 $year += 1900; 573 573 $mon++; … … 619 619 if ( exists $db_switch_chained_port{$sw->{hostname}} ) { 620 620 chop $db_switch_chained_port{$sw->{hostname}}; 621 push @{$sw->{portignore}}, split (m/ : /xms, $db_switch_chained_port{$sw->{hostname}});621 push @{$sw->{portignore}}, split m/ : /xms, $db_switch_chained_port{$sw->{hostname}}; 622 622 } 623 623 # print "$sw->{hostname} ++ @{$sw->{portignore}}\n"; … … 645 645 $i++; 646 646 647 my $total_percent = int (($i*100)/$number_of_computer);647 my $total_percent = int (($i*100)/$number_of_computer); 648 648 649 649 my $localtime = time - $timestamp; 650 my ($sec,$min) = localtime ($localtime);650 my ($sec,$min) = localtime $localtime; 651 651 652 652 my $time_elapse = 0; 653 653 $time_elapse = $localtime * ( 100 - $total_percent) / $total_percent if $total_percent != 0; 654 my ($sec_elapse,$min_elapse) = localtime ($time_elapse);654 my ($sec_elapse,$min_elapse) = localtime $time_elapse; 655 655 656 656 printf "\rComputer scanned: %4i/%i (%2i%%)", $i, $number_of_computer, $total_percent; … … 820 820 # next if $computerdb->{$ip}{hostname_fq} eq 'unknow'; 821 821 822 my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime ($computerdb->{$ip}{timestamp});822 my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime $computerdb->{$ip}{timestamp}; 823 823 $year += 1900; 824 824 $mon++; … … 890 890 next LOOP_ON_IP_ADDRESS if $computerdb->{$ip}{hostname_fq} eq ($computerdb->{$ip}{switch_hostname} || $computerdb->{$ip}{switch_description}); # switch on himself ! 891 891 892 my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime ($computerdb->{$ip}{timestamp});892 my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime $computerdb->{$ip}{timestamp}; 893 893 $year += 1900; 894 894 $mon++; … … 903 903 my $switch_hostname_sort = sprintf '%s %3s' ,$switch_hostname, $computerdb->{$ip}{switch_port}; 904 904 905 my $ip_sort = sprintf '%03i%03i%03i%03i', split ( m/ \. /xms, $ip);905 my $ip_sort = sprintf '%03i%03i%03i%03i', split m/ \. /xms, $ip; 906 906 907 907 my $mac_sort = sprintf '%04i-%s', 9999 - $mac_count{$computerdb->{$ip}{mac_address}}, $computerdb->{$ip}{mac_address}; … … 947 947 my $date = sprintf '%04i-%02i-%02i %02i:%02i', $year, $mon, $mday, $hour, $min; 948 948 949 my $ip_sort = sprintf '%03i%03i%03i%03i', split ( m/ \. /xms, $ipv4_address);949 my $ip_sort = sprintf '%03i%03i%03i%03i', split m/ \. /xms, $ipv4_address; 950 950 951 951 my $mac_sort = sprintf '%04i-%s', 9999, $mac_address; … … 995 995 my $date = sprintf '%04i-%02i-%02i %02i:%02i', $year,$mon,$mday,$hour,$min; 996 996 997 my $ip_sort = sprintf '%03i%03i%03i%03i', split ( m/ \. /xms, $ipv4_address);997 my $ip_sort = sprintf '%03i%03i%03i%03i', split m/ \. /xms, $ipv4_address; 998 998 999 999 my $mac_sort = sprintf '%04i-%s', 9999, $mac_address; … … 1122 1122 ); 1123 1123 1124 if (not defined ($result)or $result->{$research} eq 'noSuchInstance') {1124 if (not defined $result or $result->{$research} eq 'noSuchInstance') { 1125 1125 print "Klask do not find MAC $mac_address on switch $switch_name\n"; 1126 1126 $session->close;
Note: See TracChangeset
for help on using the changeset viewer.