Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Average Puppet Catalog compile time
awk '/Compiled static catalog for/ { x=$(NF-1); sum+=x; total++ }; END { print "Average Compile Time: " sum / total }' /var/log/puppetlabs/puppetserver/puppetserver.log
# USAGE: awk [-v host=(CERTNAME)] [-v ignore=2] -f compile_time.awk /var/log/puppetlabs/puppetserver/puppetserver.log
BEGIN {
min=999
}
/Compiled static catalog for/ && $10 ~ host {
x=$(NF-1)
if (x>ignore) { # Exclude agent only runs?
sum+=x
total++
if (x<min) {min=x; min_host=$10}
if (x>max) {max=x; max_host=$10}
if (x>60) { print $0 }
} else {
excl++
}
}
END {
print "Puppet Catalog Compile Time Stats:"
print "Average: " sum / total " (" total " runs)"
print "Minimum: " min " (" min_host ")"
print "Maximum: " max " (" max_host ")"
if (excl>0) { print "Excluded: " excl " runs (ignored)" }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment