root / plugins / ssl / letsencrypt_weekly @ 09b88141
Historique | Voir | Annoter | Télécharger (1,56 ko)
| 1 |
#!/bin/sh |
|---|---|
| 2 |
: << =cut |
| 3 |
=head1 NAME |
| 4 |
|
| 5 |
letsencrypt_weekly - monitor the number of CSRs by week for /etc/letsencrypt/csr/ |
| 6 |
|
| 7 |
see https://letsencrypt.org/docs/rate-limits/ |
| 8 |
|
| 9 |
= head1 CONFIGURATION |
| 10 |
|
| 11 |
You can configure the warning and critical limits for this plugin: |
| 12 |
|
| 13 |
[letsencrypt_weekly] |
| 14 |
# warn when more than 40 certificates have been requested in the last week |
| 15 |
env.warning :40 |
| 16 |
# critical when more than 50 certificates have been requested in the last week |
| 17 |
env.critical :50 |
| 18 |
|
| 19 |
=head1 Dependencies |
| 20 |
|
| 21 |
Dependencies: openssl |
| 22 |
|
| 23 |
=head1 AUTHOR |
| 24 |
|
| 25 |
andreas perhab - andreas.perhab@wt-io-it.at (https://www.wt-io-it.at/) |
| 26 |
|
| 27 |
=head1 LICENSE |
| 28 |
|
| 29 |
GPLv2 |
| 30 |
|
| 31 |
=head1 MAGIC MARKERS |
| 32 |
|
| 33 |
#%# family=auto |
| 34 |
#%# capabilities=autoconf |
| 35 |
|
| 36 |
=cut |
| 37 |
|
| 38 |
. "$MUNIN_LIBDIR/plugins/plugin.sh" |
| 39 |
|
| 40 |
warning=${warning:-:40}
|
| 41 |
critical=${critical:-:50} #letsencrypt doesn't allow more than 50 certificates per week
|
| 42 |
# see https://letsencrypt.org/docs/rate-limits/ |
| 43 |
|
| 44 |
if [ "$1" = "autoconf" ] ; then |
| 45 |
test -d /etc/letsencrypt/csr/ && echo "yes" || echo "no (directory /etc/letsencrypt/csr does not exist)" |
| 46 |
elif [ "$1" = "config" ] ; then |
| 47 |
echo "graph_title Letsencrypt certificate requests during last week" |
| 48 |
echo "graph_args --base 1000" |
| 49 |
echo "graph_vlabel Number of certificates" |
| 50 |
echo "graph_category security" |
| 51 |
echo "letsencrypt_weekly.label Letsencrypt certificates last week" |
| 52 |
print_warning "letsencrypt_weekly" |
| 53 |
print_critical "letsencrypt_weekly" |
| 54 |
elif [ "$1" = "" ] ; then |
| 55 |
if existing_certs=$(find /etc/letsencrypt/csr/ -mtime -7 -type f 2>/dev/null); then |
| 56 |
value=$(echo "$existing_certs" | wc -l) |
| 57 |
else |
| 58 |
value="U" |
| 59 |
fi |
| 60 |
echo "letsencrypt_weekly.value $value" |
| 61 |
fi |
