[PATCH 2/5] Simplify and improve Dovecot connection table format
Richard Hansen <rhansen-A08e6c8yq/[email protected]>
| Newsgroups | gmane.comp.log.logwatch.devel |
|---|---|
| Message-ID | <[email protected]> |
* Move the counts to the left side of the host name so that long host
names do not disrupt the alignment
* Remove the vertical lines to reduce visual clutter
* Use narrower columns for the counts
* Reduce the number of lines of code used to format the table
---
scripts/services/dovecot | 26 +++++---------------------
1 files changed, 5 insertions(+), 21 deletions(-)
diff --git a/scripts/services/dovecot b/scripts/services/dovecot
index 8b62a0e..3e76ab4 100755
--- a/scripts/services/dovecot
+++ b/scripts/services/dovecot
@@ -267,8 +267,8 @@ if ( ( $Detail >=5 ) and $Restarts ) {
if ( ( $Detail >= 5 ) and (keys %Connection)) {
print "\n[Dovecot IMAP and POP3] Connections:".
"\n====================================".
- "\n Host | POP3 | IMAP | Total ".
- "\n-------------------------------------- | --------- |--------- | ---------";
+ "\nPOP3 IMAP Total Host".
+ "\n" . "-" x 72;
$TLSInitFail = 0;
foreach $Host (sort keys %Connection) {
@@ -285,29 +285,13 @@ if ( ( $Detail >= 5 ) and (keys %Connection)) {
}
# Cleanly display IPv4 addresses
$Host=~ s/::ffff://;
- $HostLength = length($Host);
- $HostSpaceLength = 38 - $HostLength;
- $CountLength = length("$Conns");
- $CountSpaceLength = 10 - $CountLength;
- $IMAPLength = length("$IMAP");
- $IMAPSpaceLength = 9 - $IMAPLength;
- $TotalLength = length("$Total");
- $TotalSpaceLength = 10 - $TotalLength;
- print "\n" ." " x $HostSpaceLength . $Host . " |" . " " x $CountSpaceLength . $Conns .
- " |" . " " x $IMAPSpaceLength . $IMAP . " |" . " " x $TotalSpaceLength . $Total;
+ printf "\n%4s %4s %5s %s", $Conns, $IMAP, $Total, $Host;
$POP3Count += $Conns;
$IMAPCount += $IMAP;
$TotalCount += $Total;
}
- $POP3Length = length("$POP3Count");
- $POP3SpaceLength = 50 - $POP3Length;
- $IMAPLength = length("$IMAPCount");
- $IMAPSpaceLength = 9 - $IMAPLength;
- $TotalLength = length("$TotalCount");
- $totalSpaceLength = 10 - $TotalLength;
- print "\n" . "-" x 73;
- print "\n" . " " x $POP3SpaceLength . $POP3Count . " |" . " " x $IMAPSpaceLength . $IMAPCount .
- " |" . " " x $totalSpaceLength . $TotalCount . "\n";
+ print "\n" . "-" x 72;
+ printf "\n%4s %4s %5s %s", $POP3Count, $IMAPCount, $TotalCount, "Total";
}
if ( ( $Detail >= 5 ) and (keys %Deliver)) {
--
1.7.4.1
------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev