Changeset 173


Ignore:
Timestamp:
Aug 24, 2016, 2:36:33 PM (8 years ago)
Author:
g7moreau
Message:
  • Add subcommand check location to updatedb command
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/klask

    r172 r173  
    293293# va rechercher le nom des switchs pour savoir qui est qui
    294294sub init_switch_names {
    295    my ($verbose, $verb_description, $check_hostname) = @_;
     295   my ($verbose, $verb_description, $check_hostname, $check_location) = @_;
    296296
    297297   printf "%-26s                %-25s %s\n",'Switch','Description','Type' if $verbose;
     
    334334         print "   error hostname: $sw->{hostname}\n" if $result->{$OID_NUMBER{sysName}} ne $hostname;
    335335         }
     336      if ($check_location) {
     337         my ($hostname) = split /\./, $sw->{hostname}, 2;
     338         print "   error location: $sw->{location} =/= $result->{$OID_NUMBER{sysLocation}}\n"
     339            if $result->{$OID_NUMBER{sysLocation}} ne $sw->{location};
     340         }
    336341      #$sw->{location} = $result->{"1.3.6.1.2.1.1.6.0"} || $sw->{hostname};
    337342      #$sw->{contact} = $result->{"1.3.6.1.2.1.1.4.0"} || $sw->{hostname};
     
    877882   @ARGV = @_;
    878883
    879    my ($verbose, $verb_description, $check_hostname);
     884   my ($verbose, $verb_description, $check_hostname, $check_location);
    880885
    881886   GetOptions(
     
    883888      'verb-description|d' => \$verb_description,
    884889      'chk-hostname|h'     => \$check_hostname,
     890      'chk-location|l'     => \$check_location,
    885891      );
    886892
     
    903909   my $detected_computer = 0;
    904910
    905    init_switch_names('yes', $verb_description, $check_hostname);    #nomme les switchs
     911   init_switch_names('yes', $verb_description, $check_hostname, $check_location);    #nomme les switchs
    906912
    907913   { # Remplis le champs portignore des ports d'inter-connection pour chaque switch
Note: See TracChangeset for help on using the changeset viewer.