Skip to content

Instantly share code, notes, and snippets.

@killerbees19
Last active November 8, 2020 06:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save killerbees19/c5606e79ea7961a182e1909447c0c2c8 to your computer and use it in GitHub Desktop.
Save killerbees19/c5606e79ea7961a182e1909447c0c2c8 to your computer and use it in GitHub Desktop.
Munin plugin to monitor Nginx TLS versions
/var/log/nginx/misc/ssl.log {
daily
missingok
rotate 0
notifempty
create 0640 www-data adm
sharedscripts
prerotate
if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
run-parts /etc/logrotate.d/httpd-prerotate; \
fi \
endscript
postrotate
invoke-rc.d nginx rotate >/dev/null 2>&1
endscript
}
log_format ssl '$ssl_protocol';
access_log /var/log/nginx/misc/ssl.log ssl;
#!/bin/bash
if [[ "$1" == "autoconf" ]]
then
echo "no"
exit 1
elif [[ "$1" != "config" ]]
then
sort /var/log/nginx/misc/ssl.log | uniq -c | sort -k 2 | \
awk '{ k=gensub(/[^a-z0-9_]/, "_", "g", tolower($2)); print k".value "$1; }'
exit $?
fi
cat << EOF
graph_title Nginx TLS Versions
graph_vlabel Requests per \${graph_period}
graph_args --base 1000 --lower-limit 0
graph_category nginx
graph_total Total
_.label Unencrypted
_.colour COLOUR7
_.draw AREA
_.type DERIVE
_.min 0
tlsv1.label TLSv1.0
tlsv1.colour COLOUR2
tlsv1.draw STACK
tlsv1.type DERIVE
tlsv1.min 0
tlsv1_1.label TLSv1.1
tlsv1_1.colour COLOUR3
tlsv1_1.draw STACK
tlsv1_1.type DERIVE
tlsv1_1.min 0
tlsv1_2.label TLSv1.2
tlsv1_2.colour COLOUR1
tlsv1_2.draw STACK
tlsv1_2.type DERIVE
tlsv1_2.min 0
tlsv1_3.label TLSv1.3
tlsv1_3.colour COLOUR0
tlsv1_3.draw STACK
tlsv1_3.type DERIVE
tlsv1_3.min 0
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment