2 # Show server or domain information
4 BEGIN { push(@INC, ".."); };
9 if (&get_product_name() eq "usermin") {
15 %text = &load_language($current_theme);
17 foreach $o (split(/\0/, $in{'open'})) {
22 $prehead = defined(&WebminCore::theme_prehead) ?
23 &capture_function_output(\&WebminCore::theme_prehead) : "";
24 &popup_header(undef, $prehead);
28 if (&get_product_name() eq 'webmin') {
29 print "<a href=http://www.webmin.com/ target=_new><img src=images/webmin-blue.png border=0></a><p>\n";
33 # Show general system information
34 print "<table width=70%>\n";
37 print "<tr> <td><b>$text{'right_host'}</b></td>\n";
38 print "<td>",&get_system_hostname(),"</td> </tr>\n";
41 print "<tr> <td><b>$text{'right_os'}</b></td>\n";
42 if ($gconfig{'os_version'} eq '*') {
43 print "<td>$gconfig{'real_os_type'}</td> </tr>\n";
46 print "<td>$gconfig{'real_os_type'} $gconfig{'real_os_version'}</td> </tr>\n";
50 print "<tr> <td><b>$text{'right_webmin'}</b></td>\n";
51 print "<td>",&get_webmin_version(),"</td> </tr>\n";
54 $tm = localtime(time());
55 print "<tr> <td><b>$text{'right_time'}</b></td>\n";
56 if (&foreign_available("time")) {
57 $tm = "<a href=time/>$tm</a>";
59 print "<td>$tm</td> </tr>\n";
61 # Ask status module for more
62 &foreign_require("system-status");
63 $info = &system_status::get_collected_info();
66 if ($info->{'kernel'}) {
67 print "<tr> <td><b>$text{'right_kernel'}</b></td>\n";
68 print "<td>",&text('right_kernelon',
69 $info->{'kernel'}->{'os'},
70 $info->{'kernel'}->{'version'},
71 $info->{'kernel'}->{'arch'}),"</td> </tr>\n";
75 if ($info->{'load'}) {
76 @c = @{$info->{'load'}};
78 print "<tr> <td><b>$text{'right_cpuinfo'}</b></td>\n";
79 print "<td>",&text('right_cputype', @c),"</td> </tr>\n";
84 &foreign_require("proc");
86 my ($d, $h, $m) = &proc::get_system_uptime();
88 $uptime = &text('right_updays', $d, $h, $m);
91 $uptime = &text('right_uphours', $h, $m);
94 $uptime = &text('right_upmins', $m);
97 print "<tr> <td><b>$text{'right_uptime'}</b></td>\n";
98 print "<td>$uptime</td> </tr>\n";
102 if (&foreign_check("proc")) {
103 @procs = &proc::list_processes();
104 $pr = scalar(@procs);
105 print "<tr> <td><b>$text{'right_procs'}</b></td>\n";
106 if (&foreign_available("proc")) {
107 $pr = "<a href=proc/>$pr</a>";
109 print "<td>$pr</td> </tr>\n";
113 if ($info->{'load'}) {
114 @c = @{$info->{'load'}};
116 print "<tr> <td><b>$text{'right_cpu'}</b></td>\n";
117 print "<td>",&text('right_load', @c),"</td> </tr>\n";
122 if ($info->{'cpu'}) {
123 @c = @{$info->{'cpu'}};
124 print "<tr> <td><b>$text{'right_cpuuse'}</b></td>\n";
125 print "<td>",&text('right_cpustats', @c),"</td> </tr>\n";
129 if ($info->{'mem'}) {
130 @m = @{$info->{'mem'}};
132 print "<tr> <td><b>$text{'right_real'}</b></td>\n";
133 print "<td>",&text('right_used',
134 &nice_size($m[0]*1024),
135 &nice_size(($m[0]-$m[1])*1024)),
137 print "<tr> <td></td>\n";
138 print "<td>",&bar_chart($m[0], $m[0]-$m[1], 1),
143 print "<tr> <td><b>$text{'right_virt'}</b></td>\n";
144 print "<td>",&text('right_used',
145 &nice_size($m[2]*1024),
146 &nice_size(($m[2]-$m[3])*1024)),
148 print "<tr> <td></td>\n";
149 print "<td>",&bar_chart($m[2], $m[2]-$m[3], 1),
154 # Disk space on local drives
155 if ($info->{'disk_total'}) {
156 ($total, $free) = ($info->{'disk_total'}, $info->{'disk_free'});
157 print "<tr> <td><b>$text{'right_disk'}</b></td>\n";
158 print "<td>",&text('right_used',
160 &nice_size($total-$free)),"</td> </tr>\n";
161 print "<tr> <td></td>\n";
162 print "<td>",&bar_chart($total, $total-$free, 1),
167 if ($info->{'poss'}) {
168 print "<tr> <td><b>$text{'right_updates'}</b></td>\n";
169 @poss = @{$info->{'poss'}};
170 @secs = grep { $_->{'security'} } @poss;
171 if (@poss && @secs) {
172 $msg = &text('right_upsec', scalar(@poss),
176 $msg = &text('right_upneed', scalar(@poss));
179 $msg = $text{'right_upok'};
181 if (&foreign_available("package-updates")) {
182 $msg = "<a href='package-updates/index.cgi?mode=updates'>$msg</a>";
184 print "<td>$msg</td> </tr>\n";
189 # Check for incorrect OS
190 if (&foreign_check("webmin")) {
191 &foreign_require("webmin", "webmin-lib.pl");
192 &webmin::show_webmin_notifications();
195 elsif ($level == 3) {
196 # Show Usermin user's information
197 print "<h3>$text{'right_header5'}</h3>\n";
198 print "<table width=70%>\n";
200 # Host and login info
201 print "<tr> <td><b>$text{'right_host'}</b></td>\n";
202 print "<td>",&get_system_hostname(),"</td> </tr>\n";
204 print "<tr> <td><b>$text{'right_os'}</b></td>\n";
205 if ($gconfig{'os_version'} eq '*') {
206 print "<td>$gconfig{'real_os_type'}</td> </tr>\n";
209 print "<td>$gconfig{'real_os_type'} $gconfig{'real_os_version'}</td> </tr>\n";
212 print "<tr> <td><b>$text{'right_usermin'}</b></td>\n";
213 print "<td>",&get_webmin_version(),"</td> </tr>\n";
216 $tm = localtime(time());
217 print "<tr> <td><b>$text{'right_time'}</b></td>\n";
218 print "<td>$tm</td> </tr>\n";
221 if (&foreign_installed("quota")) {
222 &foreign_require("quota", "quota-lib.pl");
223 $n = "a::user_filesystems($remote_user);
226 for($i=0; $i<$n; $i++) {
227 if ($quota::filesys{$i,'hblocks'}) {
228 $quota += $quota::filesys{$i,'hblocks'};
229 $usage += $quota::filesys{$i,'ublocks'};
231 elsif ($quota::filesys{$i,'sblocks'}) {
232 $quota += $quota::filesys{$i,'sblocks'};
233 $usage += $quota::filesys{$i,'ublocks'};
237 $bsize = $quota::config{'block_size'};
238 print "<tr> <td><b>$text{'right_uquota'}</b></td>\n";
239 print "<td>",&text('right_out',
240 &nice_size($usage*$bsize),
241 &nice_size($quota*$bsize)),"</td> </tr>\n";
242 print "<tr> <td></td>\n";
243 print "<td>",&bar_chart($quota, $usage, 1),
253 # bar_chart(total, used, blue-rest)
254 # Returns HTML for a bar chart of a single value
257 local ($total, $used, $blue) = @_;
259 $rv .= sprintf "<img src=images/red.gif width=%s height=10>",
260 int($bar_width*$used/$total)+1;
262 $rv .= sprintf "<img src=images/blue.gif width=%s height=10>",
263 $bar_width - int($bar_width*$used/$total)-1;
266 $rv .= sprintf "<img src=images/white.gif width=%s height=10>",
267 $bar_width - int($bar_width*$used/$total)-1;
272 # bar_chart_three(total, used1, used2, used3)
273 # Returns HTML for a bar chart of three values, stacked
276 local ($total, $used1, $used2, $used3) = @_;
278 local $w1 = int($bar_width*$used1/$total)+1;
279 local $w2 = int($bar_width*$used2/$total);
280 local $w3 = int($bar_width*$used3/$total);
281 $rv .= sprintf "<img src=images/red.gif width=%s height=10>", $w1;
282 $rv .= sprintf "<img src=images/purple.gif width=%s height=10>", $w2;
283 $rv .= sprintf "<img src=images/blue.gif width=%s height=10>", $w3;
284 $rv .= sprintf "<img src=images/grey.gif width=%s height=10>",
285 $bar_width - $w1 - $w2 - $w3;
289 # collapsed_header(text, name)
292 local ($text, $name) = @_;
293 print "<br><font style='font-size:16px'>";
294 local $others = join("&", map { "open=$_" } grep { $_ ne $name } @open);
295 $others = "&$others" if ($others);
297 print "<img src=images/open.gif border=0>\n";
298 print "<a href='right.cgi?$others'>$text</a>";
301 print "<img src=images/closed.gif border=0>\n";
302 print "<a href='right.cgi?open=$name$others'>$text</a>";
304 print "</font><br>\n";