version 1.5, 2007/01/22 17:55:04 |
version 1.6, 2007/10/03 16:16:42 |
|
|
#!/usr/bin/perl |
#!/usr/bin/perl |
# $RedRiver: make_wireless_client_config,v 1.4 2007/01/22 16:40:52 andrew Exp $ |
# $RedRiver: make_wireless_client_config,v 1.5 2007/01/22 17:55:04 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. |
|
|
|
|
#print Dumper $AP, \@clients; |
#print Dumper $AP, \@clients; |
|
|
foreach my $id (@clients) { |
foreach my $id (sort @clients) { |
my $host; |
my $host; |
my $name; |
my $name; |
my $template; |
my $template; |
|
|
if ($hosts->{$AP}->{'Host'}->{'Type'} =~ /Trango$/) { |
if ($hosts->{$AP}->{'Host'}->{'Type'} =~ /Trango$/) { |
$host = $hosts->{$AP}->{'Info'}->{'suRemarks'}->{$id}; |
$host = $hosts->{$AP}->{'Info'}->{'suRemarks'}->{$id}; |
$name = $hosts->{$host}->{'Host'}->{'name'}; |
$name = $hosts->{$host}->{'Host'}->{'name'}; |
$nagios_host = "${AP}-${id}"; |
$nagios_host = $AP . '-' . $id; |
$template = $Trango_Template; |
$template = $Trango_Template; |
} elsif ($hosts->{$AP}->{'Host'}->{'Type'} =~ /TurboCell$/) { |
} elsif ($hosts->{$AP}->{'Host'}->{'Type'} =~ /TurboCell$/) { |
$host = $hosts->{$AP}->{'Info'}->{'Wireless_Host_Name'}->{$id}; |
$host = $hosts->{$AP}->{'Info'}->{'Wireless_Host_Name'}->{$id}; |
$name = $hosts->{$host}->{'Host'}->{'name'}; |
$name = $hosts->{$host}->{'Host'}->{'name'}; |
$nagios_host = "${AP}-${host}"; |
$nagios_host = $AP . '-' . $host; |
$template = $TurboCell_Template; |
$template = $TurboCell_Template; |
} else { |
} else { |
next; |
next; |
} |
} |
|
|
next unless $host; |
next if ! $host; |
next if $host =~ /^rr\w{6}\d{4}$/i; |
next if $host =~ /^rr\w{6}\d{4}$/i; |
|
|
|
next if ! $name; |
|
#next if ! $name =~ / \A \d{1,3}\. \d{1,3}\. \d{1,3}\. \d{1,3} \z /xms |
|
|
next if exists $nagios_hosts{$nagios_host}; |
next if exists $nagios_hosts{$nagios_host}; |
$nagios_hosts{$nagios_host}++; |
$nagios_hosts{$nagios_host}++; |