Changeset 198 for trunk/klask


Ignore:
Timestamp:
Jan 25, 2017, 11:04:43 AM (7 years ago)
Author:
g7moreau
Message:
  • Remove training space
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/klask

    r197 r198  
    2222
    2323# apt-get install snmp fping libnet-cidr-lite-perl libnet-netmask-perl libnet-snmp-perl libnetaddr-ip-perl libyaml-perl
    24 # libcrypt-des-perl libcrypt-hcesha-perl libdigest-hmac-perl 
     24# libcrypt-des-perl libcrypt-hcesha-perl libdigest-hmac-perl
    2525# arping net-tools fping bind9-host arpwatch
    2626
     
    651651   if ($sw_model eq 'HP2424M') {
    652652      if ($sw_port > 24) {
    653          
     653
    654654         my $reste = $sw_port - 24;
    655655         return "A$reste";
     
    659659   if ($sw_model eq 'HP1600M') {
    660660      if ($sw_port > 16) {
    661          
     661
    662662         my $reste = $sw_port - 16;
    663663         return "A$reste";
     
    667667   if ($sw_model eq 'HP2810-48G' or $sw_model eq 'HP2810-24G') {
    668668      if ($sw_port > 48) {
    669          
     669
    670670         my $reste = $sw_port - 48;
    671671         return "Trk$reste";
     
    675675   if ($sw_model eq 'HP3500-24G') {
    676676      if ($sw_port > 289) {
    677          
     677
    678678         my $reste = $sw_port - 289;
    679679         return "Trk$reste";
     
    750750sub snmp_get_swithport_hr {
    751751   my ($snmp_session, $swport) = @_;
    752    
     752
    753753   my $research_index = $OID_NUMBER{ifIndex} .'.'. $swport;
    754754   my $result_index = $snmp_session->get_request(
     
    775775
    776776      next LOOP_ON_IP_ADDRESS if exists $computerdb->{$ip}{switch_port_hr} and defined $computerdb->{$ip}{switch_port_hr};
    777      
     777
    778778      $computerdb->{$ip}{switch_port_hr} = $computerdb->{$ip}{switch_port};
    779779      }
     
    912912      for my $ip (keys %{$computerdb}) {
    913913         next LOOP_ON_COMPUTER if $mac ne $computerdb->{$ip}{mac_address};
    914  
     914
    915915         my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime $computerdb->{$ip}{timestamp};
    916916         $year += 1900;
     
    11761176
    11771177      my @ip_list   = shuffle get_list_ip($vlan);
    1178      
     1178
    11791179      LOOP_ON_IP_ADDRESS:
    11801180      for my $ip (@ip_list) {
     
    11821182         next LOOP_ON_IP_ADDRESS if
    11831183            not exists $computerdb->{$ip};
    1184            
     1184
    11851185            #&& $computerdb->{$ip}{timestamp} > $timestamp_barrier;
    11861186         my $ip_timestamp   = $computerdb->{$ip}{timestamp};
     
    11941194            hostname_fq => $ip_hostname_fq,
    11951195            };
    1196          
     1196
    11971197         if (
    11981198            ( $mactimedb{$ip_mac}->{timestamp} - $ip_timestamp > $timestamp_barrier
     
    15781578      $ip_timestamp_mod -= 15 * 24 * 3600 if $ip_hostname_fq =~ m/$RE_FLOAT_HOSTNAME/;
    15791579      $ip_timestamp_ref -= 15 * 24 * 3600 if $swithportdb{$swpt}->{hostname_fq} =~ m/$RE_FLOAT_HOSTNAME/;
    1580      
     1580
    15811581      if ($ip_timestamp_mod > $ip_timestamp_ref) {
    15821582         $swithportdb{$swpt} = {
     
    16021602         next LOOP_ON_IP_ADDRESS if $computerdb->{$ip}{hostname_fq} =~ m/$RE_FLOAT_HOSTNAME/;
    16031603         next LOOP_ON_IP_ADDRESS if $computerdb->{$ip}{timestamp} < $src_timestamp;
    1604          
     1604
    16051605         $src_ip = $ip;
    16061606         $src_timestamp = $computerdb->{$ip}{timestamp};
     
    19011901         if (exists $computerdb->{$ip}) {
    19021902            next LOOP_ON_IP_ADDRESS if $computerdb->{$ip}{timestamp} > $timestamp_barrier;
    1903            
     1903
    19041904            my $mac_address = $computerdb->{$ip}{mac_address};
    19051905            LOOP_ON_DATABASE:
     
    19381938sub cmd_ip_free_txt {
    19391939   my %result_ip = @_;
    1940    
     1940
    19411941   printf "%-15s %-40s %-16s %s\n", qw(IPv4-Address Hostname-FQ Date VLAN);
    19421942   print "-------------------------------------------------------------------------------\n";
     
    21522152
    21532153   ALL_SWITCH:
    2154    for my $one_computer (@list_all_switch) {
    2155       my %resol_arp = resolve_ip_arp_host($one_computer, q{*}, q{low}); # arp resolution
    2156       print "Info: switch loop $one_computer\n" if $verbose;
     2154   for my $one_switch (@list_all_switch) {
     2155      my %resol_arp = resolve_ip_arp_host($one_switch, q{*}, q{low}); # arp resolution
     2156      print "Info: switch loop $one_switch\n" if $verbose;
    21572157      next ALL_SWITCH if $resol_arp{mac_address} eq 'unknow';
    21582158
     
    21642164
    21652165      if ($verbose) {
    2166          print "VERBOSE_3: $one_computer $resol_arp{ipv4_address} $resol_arp{mac_address}\n";
    2167          print "VERBOSE_3: $one_computer --- ",
     2166         print "VERBOSE_3: $one_switch $resol_arp{ipv4_address} $resol_arp{mac_address}\n";
     2167         print "VERBOSE_3: $one_switch --- ",
    21682168            join(' + ', keys %{$where{$resol_arp{ipv4_address}}}),
    21692169            "\n";
     
    21732173      print "VERBOSE_4: db_switch_ip_hostnamefq $resol_arp{ipv4_address} -> $resol_arp{hostname_fq}\n" if $verbose;
    21742174
    2175       $SWITCH_DB{$one_computer}->{ipv4_address} = $resol_arp{ipv4_address};
    2176       $SWITCH_DB{$one_computer}->{mac_address}  = $resol_arp{mac_address};
    2177       $SWITCH_DB{$one_computer}->{timestamp}    = $timestamp;
     2175      $SWITCH_DB{$one_switch}->{ipv4_address} = $resol_arp{ipv4_address};
     2176      $SWITCH_DB{$one_switch}->{mac_address}  = $resol_arp{mac_address};
     2177      $SWITCH_DB{$one_switch}->{timestamp}    = $timestamp;
    21782178      }
    21792179
Note: See TracChangeset for help on using the changeset viewer.