aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rcynic-ng/show.awk104
-rw-r--r--rcynic-ng/show.xsl25
2 files changed, 70 insertions, 59 deletions
diff --git a/rcynic-ng/show.awk b/rcynic-ng/show.awk
index 2e13dce2..7c69ea12 100644
--- a/rcynic-ng/show.awk
+++ b/rcynic-ng/show.awk
@@ -1,6 +1,6 @@
# $Id$
#
-# Copyright (C) 2010 Internet Systems Consortium, Inc. ("ISC")
+# Copyright (C) 2010-2011 Internet Systems Consortium, Inc. ("ISC")
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
@@ -19,57 +19,71 @@
BEGIN {
FS = "\t";
+ got_labels = 0;
}
-NR == 1 {
- nf = NF;
- for (i = 1; i <= nf; i++) {
- nh = split($i, h, /[ \t]+/);
- for (j = 1; j <= nh; j++) {
- head[i, j] = h[j];
- if (length(h[j]) > width[i])
- width[i] = length(h[j]);
+!NF {
+ got_labels = 1;
+ next;
+}
+
+!got_labels {
+ label[++nlabels] = $1;
+ nh = split($2, h, /[ \t]+/);
+ for (i = 1; i <= nh; i++) {
+ head[$1, i] = h[i];
+ if (length(h[i]) > width[i])
+ width[$1] = length(h[i]);
}
- }
}
-NR > 1 {
- nr = NR - 1;
- for (j = 1; j <= NF; j++) {
- data[nr, j] = $j;
- sum[j] += $j;
- if (length($j) > width[j])
- width[j] = length($j);
- }
+got_labels && $3 ~ /^rsync:\/\/.+/ {
+ hostname = $3;
+ sub(/^rsync:\/\//, "", hostname);
+ sub(/\/.*$/, "", hostname);
+ hostnames[hostname]++;
+ data[hostname, $2]++;
+ total[$2]++;
+ if (length(hostname) > width["hostname"])
+ width["hostname"] = length(hostname);
}
END {
- for (i = 1;; i++) {
- blank = 1;
- for (j = 2; j <= nf; j++)
- if (head[j, i] && sum[j] > 0)
- blank = 0;
- if (blank)
- break;
- for (j = 1; j <= nf; j++)
- if (j == 1)
- printf "%*s", width[j], head[j, i];
- else if (sum[j] > 0)
- printf " %*s", width[j], head[j, i];
- print "";
- }
- for (i = 1; i <= nr; i++) {
- for (j = 1; j <= nf; j++)
- if (j == 1)
- printf "%*s", width[j], data[i, j];
- else if (sum[j] > 0)
- printf " %*s", width[j], data[i, j];
+ for (i = 1;; i++) {
+ #
+ # Figure out whether we have another header line to print
+ #
+ blank = 1;
+ for (j = 2; j <= nlabels; j++)
+ if (head[label[j], i] && total[label[j]] > 0)
+ blank = 0;
+ if (blank)
+ break;
+ for (j = 1; j <= nlabels; j++)
+ if (j == 1)
+ printf "%*s", width[label[j]], head[label[j], i];
+ else if (total[j] > 0)
+ printf " %*s", width[label[j]], head[label[j], i];
+ print "";
+ }
+ #
+ # Next, print the data
+ #
+ for (h in data) {
+ for (j = 1; j <= nlabels; j++)
+ if (j == 1)
+ printf "%*s", width[label[j]], data[h, j];
+ else if (total[j] > 0)
+ printf " %*s", width[label[j]], data[h, j];
+ print "";
+ }
+ #
+ # Finally, print the totals
+ #
+ for (j = 1; j <= nlabels; j++)
+ if (j == 1)
+ printf "%*s", width[label[j]], "Total";
+ else if (total[j] > 0)
+ printf " %*s", width[label[j]], total[label[j]];
print "";
- }
- for (j = 1; j <= nf; j++)
- if (j == 1)
- printf "%*s", width[j], "Total";
- else if (sum[j] > 0)
- printf " %*s", width[j], sum[j];
- print "";
}
diff --git a/rcynic-ng/show.xsl b/rcynic-ng/show.xsl
index c6362f78..91fea74c 100644
--- a/rcynic-ng/show.xsl
+++ b/rcynic-ng/show.xsl
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!--
- - Copyright (C) 2010 Internet Systems Consortium, Inc. ("ISC")
+ - Copyright (C) 2010-2011 Internet Systems Consortium, Inc. ("ISC")
-
- Permission to use, copy, modify, and/or distribute this software for any
- purpose with or without fee is hereby granted, provided that the above
@@ -27,21 +27,18 @@
<xsl:template match="/">
<xsl:for-each select="rcynic-summary/labels/*">
- <xsl:if test="position() != 1">
- <xsl:text>&#9;</xsl:text>
- </xsl:if>
- <xsl:apply-templates/>
+ <xsl:value-of select="name()"/>
+ <xsl:text>&#9;</xsl:text>
+ <xsl:value-of select="."/>
+ <xsl:text>&#10;</xsl:text>
</xsl:for-each>
<xsl:text>&#10;</xsl:text>
- <xsl:for-each select="rcynic-summary/host">
- <xsl:sort order="descending" data-type="number" select="sum(*[not(self::hostname)])"/>
- <xsl:sort order="ascending" data-type="text" select="hostname"/>
- <xsl:for-each select="*">
- <xsl:if test="position() != 1">
- <xsl:text>&#9;</xsl:text>
- </xsl:if>
- <xsl:apply-templates/>
- </xsl:for-each>
+ <xsl:for-each select="rcynic-summary/validation_status">
+ <xsl:value-of select="@timestamp"/>
+ <xsl:text>&#9;</xsl:text>
+ <xsl:value-of select="@status"/>
+ <xsl:text>&#9;</xsl:text>
+ <xsl:value-of select="."/>
<xsl:text>&#10;</xsl:text>
</xsl:for-each>
</xsl:template>