-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck_client_groups.pl
36 lines (36 loc) · 1.22 KB
/
check_client_groups.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/perl -w verage Assessment
unshift (@INC,"/home/scriptid/scripts/BACKUPS/SUBROUTINES");
require handle_nsradmin_line_continuations;
$networker = `/usr/bin/hostname`;
chomp $networker;
# Determine the name, group
my $nsrpass = ". type:NSR client'\n'show name\\;group\\;action'\n'print";
(@return) = handle_nsradmin_line_continuations($networker,$nsrpass);
print "After nsradmin on $networker\n";
# Client name is mixed case so lower case the names
print "Determing regular/VADP, Prod/Non Prod, Scheduled/Not scheduled on $networker\n";
foreach $val (@return) {
chomp $val;
$val =~ s/\;//;
next if $val =~ /^\s*$/;
if ($val =~ /name:/) {
$val =~ s/\s*name: //;
$name = lc($val);
} elsif ($val =~ /group/) {
$val =~ s/\s*group: //;
if (defined $group{$name}) {
print "Client: $name: Client defined multiple times $group{$name}, current groups:$val\n";
} else {
$group{$name} = $val;
undef %checkers;
(@chkgrp) = split (/,/,$val);
foreach $ggg (@chkgrp) {
if (defined $checkers{$ggg}) {
print "Group already defined for $ggg\n";
} else {
$checkers{$ggg} = 1;
}
}
}
}
}