Module: check_mk
Branch: master
Commit: 537e4779b88c36767b0f755ee0ef03f307be950c
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=537e4779b88c36…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Dec 19 20:27:20 2016 +0100
Print info about top10 page sizes
Change-Id: I0ee7015598399018475e0566830a11322f3a3623
---
tests/crawl-stats | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/tests/crawl-stats b/tests/crawl-stats
index 1067144..dcb7824 100755
--- a/tests/crawl-stats
+++ b/tests/crawl-stats
@@ -11,11 +11,20 @@ def print_url(title, entry):
print "Duration: %0.2f sec (Avg. %0.2f sec of %d tries)" % \
(entry["last_duration"], entry["avg_duration"],
entry["num_visited"])
+ print "Size: %0.2f KBytes (Avg. %0.2f KBytes of %d tries)" % \
+ (entry["last_content_size"]/1024.0,
+ entry["avg_content_size"]/1024.0,
+ entry["num_visited"])
print "Total:", stats["_TOTAL_"]
-slowest = None
+print ""
+print
"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
+print "+ SLOWEST PAGES
+"
+print
"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
+print ""
+
for num, (key, val) in enumerate(sorted(stats.items(),
key=lambda x: "avg_duration" in x[1] \
and x[1]["avg_duration"]
@@ -24,3 +33,18 @@ for num, (key, val) in enumerate(sorted(stats.items(),
continue
print_url("%02d Slowest" % num, val)
+
+print ""
+print
"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
+print "+ LARGEST PAGES
+"
+print
"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
+print ""
+
+for num, (key, val) in enumerate(sorted(stats.items(),
+ key=lambda x: "avg_content_size" in x[1] \
+ and x[1]["avg_content_size"]
+ or 0, reverse=True)[:10]):
+ if key == "_TOTAL_":
+ continue
+
+ print_url("%02d Largest" % num, val)