-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_number_of_clients_in_groups.pl
More file actions
38 lines (38 loc) · 1.27 KB
/
check_number_of_clients_in_groups.pl
File metadata and controls
38 lines (38 loc) · 1.27 KB
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
37
38
#!/usr/bin/perl -w verage Assessment
unshift (@INC,"/home/scriptid/scripts/BACKUPS/SUBROUTINES");
require build_output_record;
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);
# Client name is mixed case so lower case the names
foreach $val (@return) {
chomp $val;
$val =~ s/\;//;
next if $val =~ /^\s*$/;
if ($val =~ /name:/) {
$val =~ s/\s*name: //;
my $name = lc($val);
} elsif ($val =~ /group/) {
$val =~ s/\s*group: //;
(@chkgrp) = split (/,/,$val);
foreach $ggg (@chkgrp) {
$ggg =~ s/^\s*//;
if (defined $gcount{$ggg} ) {
$gcount{$ggg} += 1;
} else {
$gcount{$ggg} = 1;
}
}
}
}
$return = build_output_record(-47,$output,'GROUP',25,0,-1,-1 ,'',1,25);
$return = build_output_record(0,$output,'Number of Clients',17,0,0,0 ,'',30,47);
#print "$return\n";
foreach $val (sort (keys %gcount)) {
$return = build_output_record(-47,$output,$val,20,0,-1,-1 ,'',1,25);
$return = build_output_record(0,$output,$gcount{$val},10,0,0,0 ,'',30,47);
print "$return\n";
}