Changeset 304 for trunk


Ignore:
Timestamp:
Oct 11, 2017, 9:39:15 PM (7 years ago)
Author:
g7moreau
Message:
  • Better switch description and error in init proc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/klask

    r303 r304  
    362362
    363363#---------------------------------------------------------------
    364 # va rechercher le nom des switchs pour savoir qui est qui
     364# Get switch name and switch model
    365365sub init_switch_names {
    366366   my ($verbose, $verb_description, $check_hostname, $check_location) = @_;
     
    394394      $sw->{'description'} = $result->{$OID_NUMBER{'sysName'}} || $sw->{'hostname'};
    395395      $sw->{model} = get_switch_model($result->{$OID_NUMBER{'sysDescription'}});
     396      printf "%-26s 0--------->>>> %-25s %s\n", $sw->{'hostname'}, $sw->{'description'}, $sw->{model} if $verbose;
     397
    396398      if ($verb_description) {
    397399         my $desc = $result->{$OID_NUMBER{'sysDescription'}};
    398400         $desc =~ s/[\n\r]/ /g;
    399          print "   description: $desc\n"
     401         print " +> $sw->{'hostname'} - description: $desc\n"
    400402         }
    401403      if ($check_hostname) {
    402404         my ($hostname) = split /\./, $sw->{'hostname'}, 2;
    403          print " $hostname - error internal hostname: $sw->{'hostname'}\n" if $result->{$OID_NUMBER{'sysName'}} ne $hostname;
     405         print " +> $hostname - error internal hostname: $sw->{'hostname'}\n" if $result->{$OID_NUMBER{'sysName'}} ne $hostname;
    404406         }
    405407      if ($check_location) {
    406408         my $location = $result->{$OID_NUMBER{'sysLocation'}};
    407409         $location =~ s/^"(.+)"$/$1/;
    408          print " $sw->{'hostname'} - error location: '$location' -> '$sw->{'location'}'\n" if $location ne $sw->{'location'};
    409          }
    410       #$sw->{'location'} = $result->{"1.3.6.1.2.1.1.6.0"} || $sw->{'hostname'};
    411       #$sw->{contact} = $result->{"1.3.6.1.2.1.1.4.0"} || $sw->{'hostname'};
     410         print " +> $sw->{'hostname'} - error location: '$location' -> '$sw->{'location'}'\n" if $location ne $sw->{'location'};
     411         }
     412
    412413      $session->close;
    413 
    414       # Ligne à virer car on récupère maintenant le modèle du switch
    415       #my ($desc, $type) = split m/ : /xms, $sw->{'description'}, 2;
    416       printf "%-26s 0--------->>>> %-25s %s\n", $sw->{'hostname'}, $sw->{'description'}, $sw->{model} if $verbose;
    417414      }
    418415
Note: See TracChangeset for help on using the changeset viewer.