6 ($sec, $min, $hour, $mday, $month) = localtime($^T);
7 @MONTHS = ( "Jan", "Feb", "Mar", "Apr", "May", "Jun",
8 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" );
9 printf("\t\t\tMOIRA SUMMARY for %s %d\n\n", $MONTHS[$month], $mday);
11 open(MACHINES, "machine") || die "Cannot open machine file for input.\n";
22 delete $TYPES{"NONE"};
24 printf("%5d Machines by type (both workstations & servers):\n", $total);
25 grep(push(@values, sprintf(" %5d %-8s %2d%%\n", $TYPES{$_}, $_, (100 * $TYPES{$_} + $total/2)/$total)), keys(%TYPES));
26 print reverse sort(@values);
31 open(CLUSTERS, "clusters") || die "Cannot open clusters file for input.\n";
40 delete $TYPES{"NONE"};
42 printf("%5d Clusters\n\n", $total);
45 open(PRINTERS, "printers") || die "Cannot open printers file for input.\n";
51 if ($_[9]) { $auth++; }
57 printf("%5d Printers, %d with authentication (%d%%).\n\n", $total, $auth,
58 (100 * $auth + $total/2)/$total);
62 open(USERS, "users") || die "Cannot open users file for input.\n";
67 s/\|/\e/g; s/\\\e/\|/g;
69 $total++; $STATUS{$_[8]}++;
70 if ($_[8] != 3) { $classtotal++; $CLASS{$_[10]}++; }
71 if ($_[8] == 1) { $CLASSA{$_[10]}++; }
72 if ($_[8] == 1 || $_[8] == 6) { $pototal++; $POTYPE{$_[26]}++; }
76 delete $STATUS{"NONE"};
79 sub bytotal { substr($b, 12, 5) <=> substr($a, 12, 5); }
81 printf("%5d Non-deactivated users by class:\n", $classtotal);
82 printf(" class total %%total active %%active\n");
83 printf(" in DB accounts in class\n");
84 grep(push(@values, sprintf(" %-8s %5d %2d %5d %3d\n",
85 $_, $CLASS{$_}, (100 * $CLASS{$_} + $classtotal/2)/$classtotal,
86 $CLASSA{$_}, (100 * $CLASSA{$_} + $CLASS{$_}/2)/$CLASS{$_})),
88 print sort bytotal @values;
89 printf(" Totals %5d 100 %5d\n", $classtotal, $STATUS{'1'});
93 @STATUS = ("Registerable (0)",
95 "Half Registered (2)",
97 "Not registerable (4)",
98 "Enrolled/Registerable (5)",
99 "Enrolled/Not Registerable (6)",
101 "Registerable, krb only (8)",
102 "Active, Kerberos only (9)" );
105 printf("%5d Users by status:\n", $total);
106 grep(push(@values, sprintf(" %5d %-29s %2d%%\n", $STATUS{$_}, $STATUS[$_], (100 * $STATUS{$_} + $total/2)/$total)), keys(%STATUS));
107 print reverse sort(@values);
113 printf("%5d Active or enrolled users by pobox type:\n", $pototal);
114 grep(push(@values, sprintf(" %5d %-8s %2d%%\n", $POTYPE{$_}, $_, (100 * $POTYPE{$_} + $pototal/2)/$pototal)), keys(%POTYPE));
115 print reverse sort(@values);
121 open(LISTS, "list") || die "Cannot open list file for input.\n";
128 if ($_[2]) { $active++; }
129 if ($_[3]) { $public++; }
130 if ($_[4]) { $hidden++; }
131 if ($_[5]) { $maillist++; }
132 if ($_[6]) { $group++; }
136 printf("%5d Lists (non-exclusive attributes):\n", $total);
137 printf(" %5d %-9s %2d%%\n",$active, "active", (100 * $active + $total/2)/$total);
138 printf(" %5d %-9s %2d%%\n",$public, "public", (100 * $public + $total/2)/$total);
139 printf(" %5d %-9s %2d%%\n",$hidden, "hidden", (100 * $hidden + $total/2)/$total);
140 printf(" %5d %-9s %2d%%\n",$maillist, "maillist", (100 * $maillist + $total/2)/$total);
141 printf(" %5d %-9s %2d%%\n",$group, "group", (100 * $group + $total/2)/$total);
145 open(FILSYS, "filesys") || die "Cannot open filesys file for input.\n";
161 printf("%5d Filesystems by protocol type:\n", $total);
162 grep(push(@values, sprintf(" %5d %-8s %2d%%\n", $FSTYPE{$_}, $_, (100 * $FSTYPE{$_} + $total/2)/$total)), keys(%FSTYPE));
163 print reverse sort(@values);
168 printf("%5d Filesystems by locker type:\n", $total);
169 grep(push(@values, sprintf(" %5d %-8s %2d%%\n", $LTYPE{$_}, $_, (100 * $LTYPE{$_} + $total/2)/$total)), keys(%LTYPE));
170 print reverse sort(@values);
175 open(QUOTA, "quota") || die "Cannot open quota file for input.\n";
182 # $QVALUE{$_[4]/100}++;
188 printf("%5d Quotas by type:\n", $total);
189 grep(push(@values, sprintf(" %5d %-8s %2d%%\n", $QTYPE{$_}, $_, (100 * $QTYPE{$_} + $total/2)/$total)), keys(%QTYPE));
190 print reverse sort(@values);
195 #printf("%5d Quotas by value:\n", $total);
196 #printf(" Quota Occurances\n");
197 #foreach $value (sort {$a<=>$b} keys(%QVALUE)) {
198 # $total += $QVALUE{$value};
201 #grep(push(@values, sprintf(" %5d %6d\n", $_, $QVALUE{$_})), sort {$a <=> $b} keys(%QVALUE));
202 #print sort(@values);