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(PRINTCAP, "printcap") || die "Cannot open printcap file for input.\n";
51 if ($_[5]) { $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{$_[7]}++;
70 if ($_[7] != 3) { $classtotal++; $CLASS{$_[9]}++; }
71 if ($_[7] == 1) { $CLASSA{$_[9]}++; }
72 if ($_[7] == 1 || $_[7] == 6) { $pototal++; $POTYPE{$_[25]}++; }
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)",
100 "Half Enrolled (7)" );
103 printf("%5d Users by status:\n", $total);
104 grep(push(@values, sprintf(" %5d %-29s %2d%%\n", $STATUS{$_}, $STATUS[$_], (100 * $STATUS{$_} + $total/2)/$total)), keys(%STATUS));
105 print reverse sort(@values);
111 printf("%5d Active or enrolled users by pobox type:\n", $pototal);
112 grep(push(@values, sprintf(" %5d %-8s %2d%%\n", $POTYPE{$_}, $_, (100 * $POTYPE{$_} + $pototal/2)/$pototal)), keys(%POTYPE));
113 print reverse sort(@values);
119 open(LISTS, "list") || die "Cannot open list file for input.\n";
126 if ($_[2]) { $active++; }
127 if ($_[3]) { $public++; }
128 if ($_[4]) { $hidden++; }
129 if ($_[5]) { $maillist++; }
130 if ($_[6]) { $group++; }
134 printf("%5d Lists (non-exclusive attributes):\n", $total);
135 printf(" %5d %-9s %2d%%\n",$active, "active", (100 * $active + $total/2)/$total);
136 printf(" %5d %-9s %2d%%\n",$public, "public", (100 * $public + $total/2)/$total);
137 printf(" %5d %-9s %2d%%\n",$hidden, "hidden", (100 * $hidden + $total/2)/$total);
138 printf(" %5d %-9s %2d%%\n",$maillist, "maillist", (100 * $maillist + $total/2)/$total);
139 printf(" %5d %-9s %2d%%\n",$group, "group", (100 * $group + $total/2)/$total);
143 open(FILSYS, "filesys") || die "Cannot open filesys file for input.\n";
159 printf("%5d Filesystems by protocol type:\n", $total);
160 grep(push(@values, sprintf(" %5d %-8s %2d%%\n", $FSTYPE{$_}, $_, (100 * $FSTYPE{$_} + $total/2)/$total)), keys(%FSTYPE));
161 print reverse sort(@values);
166 printf("%5d Filesystems by locker type:\n", $total);
167 grep(push(@values, sprintf(" %5d %-8s %2d%%\n", $LTYPE{$_}, $_, (100 * $LTYPE{$_} + $total/2)/$total)), keys(%LTYPE));
168 print reverse sort(@values);
173 open(QUOTA, "quota") || die "Cannot open quota file for input.\n";
180 # $QVALUE{$_[4]/100}++;
186 printf("%5d Quotas by type:\n", $total);
187 grep(push(@values, sprintf(" %5d %-8s %2d%%\n", $QTYPE{$_}, $_, (100 * $QTYPE{$_} + $total/2)/$total)), keys(%QTYPE));
188 print reverse sort(@values);
193 #printf("%5d Quotas by value:\n", $total);
194 #printf(" Quota Occurances\n");
195 #foreach $value (sort {$a<=>$b} keys(%QVALUE)) {
196 # $total += $QVALUE{$value};
199 #grep(push(@values, sprintf(" %5d %6d\n", $_, $QVALUE{$_})), sort {$a <=> $b} keys(%QVALUE));
200 #print sort(@values);