Apache-VMonitor
view release on metacpan or search on metacpan
lib/Apache/VMonitor.pm view on Meta::CPAN
<html>
<head>
<title>Apache::VMonitor</title>
<style type="text/css">
body {
color: #000;
background-color: #fff;
border: 0px;
padding: 0px 0px 0px 0px;
margin: 5px 5px 5px 5px;
font-size: 0.8em;
}
p.hdr {
background-color: #ddd;
border: 2px outset;
padding: 3px;
width: 99%;
}
span.item_even {
background-color: #dddddd;
color: #000000;
lib/Apache/VMonitor.pm view on Meta::CPAN
span.warn {
color: #ff99cc;
}
span.alert {
color: #ff0000;
}
</style>
</head>
<body bgcolor="white">
<b><font size=+1 color="#339966">Apache::VMonitor</font></b>
Refresh rate:
[%-
IF rates.size;
FOREACH item = rates;
IF item.1;
"<a href=\"${item.1}\">[ ${item.0} ]</a> ";
ELSE;
"[ ${item.0} ] ";
END;
lib/Apache/VMonitor.pm view on Meta::CPAN
return {
show => \%show,
hide => \%hide,
};
}
sub tmpl_nav_bar {
return \ <<'EOT';
<hr>
<font size=-1>
[% IF show.size %]
Show:
[%- FOREACH item = show -%]
[ <a href="[% item.value %]">[% item.key %]</a> ]
[%- END -%]
<br>
[% END %]
[% IF hide.size %]
Hide:
[%- FOREACH item = hide -%]
[ <a href="[% item.value %]">[% item.key %]</a> ]
[%- END -%]
<br>
[% END %]
</font><hr>
EOT
}
### system ###
sub data_system {
my $self = shift;
lib/Apache/VMonitor.pm view on Meta::CPAN
# Swap
# visual alert on swap usage:
# 1) 5Mb < swap < 10 MB color: light red
# 2) 20% < swap (swapping is bad!) color: red
# 3) 70% < swap (swap almost used!) color: red
format_swap_data = "%5s av, %5s used, %5s free, %5s pagein, %5s pageout";
IF 5000 < swap.used AND swap.used < 10000;
USE format_line_swap = format("<b>Swap: <font color=\"#ff99cc\">$format_swap_data</font></b>\n");
ELSIF swap.usage >= 20;
USE format_line_swap = format("<b>Swap: <font color=\"#ff0000\">$format_swap_data</font></b>\n");
ELSIF swap.usage >= 70;
# swap on fire!
USE format_line_swap = format("<b>Swap: <font color=\"#ff0000\">$format_swap_data</font></b>\n");
ELSE;
USE format_line_swap = format("<b>Swap: $format_swap_data</b>\n");
END;
format_line_swap(swap.ftotal, swap.fused, swap.ffree, swap.fpagein, swap.fpageout);
-%]
</pre>
EOT
lib/Apache/VMonitor.pm view on Meta::CPAN
" Files: Total", "Avail", "Usage");
format_blocks = "%9d %9d %10d %4d%% ";
format_files = " %7d %7d %4d%%";
format_fs = "%-${max_fs_name_len}s ";
FOR item = items;
# visual alert on filesystems of 90% usage!
IF item.blocks.usage >= 90 AND item.files.usage >= 90;
USE format_item = format("<b><font color=\"#ff0000\">$format_fs $format_blocks $format_files</font></b>\n");
ELSIF item.blocks.usage >= 90;
USE format_item = format("<b><font color=\"#ff0000\">$format_fs $format_blocks</font></b> $format_files\n");
ELSIF item.files.usage >= 90;
USE format_item = format("<b><font color=\"#ff0000\">$format_fs</font></b> $format_blocks <b><font color=\"#ff0000\">$format_files</font></b>\n");
ELSE;
USE format_item = format("$format_fs $format_blocks $format_files\n");
END;
format_item(item.path,
item.blocks.total,
item.blocks.used,
item.blocks.user_avail,
item.blocks.usage,
item.files.total,
lib/Apache/VMonitor.pm view on Meta::CPAN
This section completely reproduces the df(1) utility. For each mounted
filesystem it reports the number of total and available blocks (for
both superuser and user), and usage in percents.
In addition it reports about available and used file inodes in numbers
and percents.
This section has a capability of visual alert which is being triggered
when either some filesystem becomes more than 90% full or there are
less than 10% of free file inodes left. When this event happens the
filesystem related report row will be displayed in the bold font and
in the red color.
If you don't want the df(1) section to be displayed set:
$Apache::VMonitor::Config{fs_usage} = 0;
The default is to display this section.
=item abbreviations and hints
( run in 2.179 seconds using v1.01-cache-2.11-cpan-ceb78f64989 )