[BACK]Return to make_wireless_client_config CVS log [TXT][DIR] Up to [local] / nagios / check_rrd / bin

Diff for /nagios/check_rrd/bin/make_wireless_client_config between version 1.3 and 1.4

version 1.3, 2007/01/13 00:04:51 version 1.4, 2007/01/22 16:40:52
Line 1 
Line 1 
 #!/usr/bin/perl  #!/usr/bin/perl
 # $RedRiver: make_wireless_client_config,v 1.2 2007/01/12 21:55:08 andrew Exp $  # $RedRiver: make_wireless_client_config,v 1.3 2007/01/13 00:04:51 andrew Exp $
 ########################################################################  ########################################################################
 # make_wireless_client_config *** Generate the Nagios config file we  # make_wireless_client_config *** Generate the Nagios config file we
 #                                 need for wireless clients.  #                                 need for wireless clients.
Line 26 
Line 26 
 my $now  = time;  my $now  = time;
 my $when = $now - $Only_Generate_Newer_Than;  my $when = $now - $Only_Generate_Newer_Than;
   
 foreach my $host (sort keys %{ $hosts }) {  my %nagios_hosts;
         next if $when > $hosts->{$host}->{'Checked'};  foreach my $AP (sort keys %{ $hosts }) {
         next if $host =~ /^rr\w{6}\d{4}$/i;          next if $when > $hosts->{$AP}->{'Checked'};
           next unless $AP =~ /^rr\w{6}\d{4}$/i;
   
         my $server;          my @clients;
         my $id;          push @clients, keys %{ $hosts->{$AP}->{'Info'}->{'suRemarks'} };
         my $name;          push @clients, keys %{ $hosts->{$AP}->{'Info'}->{'Wireless_Host_Name'} };
         my $template;  
   
         if ($hosts->{$host}->{'Host'}->{'Type'} =~ /Trango_Client$/) {          #print Dumper $AP, \@clients;
                 $server = $hosts->{$host}->{'Info'}->{'Wireless_Host_Name'}->{'id_0'};  
                 $id     = 'id_' . $hosts->{$host}->{'Host'}->{'ID'};  
                 $name   = $hosts->{$host}->{'Host'}->{'name'};  
                 $template = $Trango_Template;  
         } elsif ($hosts->{$host}->{'Host'}->{'Type'} =~ /TurboCell$/) {  
                 $server = $hosts->{$host}->{'Host'}->{'comment'};  
                 $id     = $host;  
                 $name   = $hosts->{$host}->{'Host'}->{'name'};  
                 $template = $TurboCell_Template;  
         } else {  
                 next;  
         }  
   
         next unless $server && $id;          foreach my $id (@clients) {
                   my $host;
                   my $name;
                   my $template;
                   my $nagios_host;
   
                   if ($hosts->{$AP}->{'Host'}->{'Type'} =~ /Trango$/) {
                           $host   = $hosts->{$AP}->{'Info'}->{'suRemarks'}->{$id};
                           $name   = $hosts->{$host}->{'Host'}->{'name'};
                           $nagios_host = "${AP}-${id}";
                           $template = $Trango_Template;
                   } elsif ($hosts->{$AP}->{'Host'}->{'Type'} =~ /TurboCell$/) {
                           $host   = $hosts->{$AP}->{'Info'}->{'Wireless_Host_Name'}->{$id};
                           $name   = $hosts->{$host}->{'Host'}->{'name'};
                           $nagios_host = "${AP}-${host}";
                           $template = $TurboCell_Template;
                   } else {
                           next;
                   }
   
         my $server_uc = uc($server);                  next unless $host;
   
         #print $host, ": ", $server, "-", $id, ": ",                  next if exists $nagios_hosts{$nagios_host};
         #       (scalar localtime($hosts->{$host}->{'Checked'})), "\n";                  $nagios_hosts{$nagios_host}++;
   
         print <<EOL;                  my $AP_uc = uc($AP);
   
                   #print $host, ": ", $AP, "-", $id, ": ",
                   #       (scalar localtime($hosts->{$host}->{'Checked'})), "\n";
   
                   print <<EOL;
 define host {  define host {
         use        $template          use        $template
         host_name  ${server}-${id}          host_name  $nagios_host;
         alias      $host          alias      $host
         address    $name          address    $name
         parents    $server_uc          parents    $AP_uc
 }  }
 EOL  EOL
   
           }
   
 }  }

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>