Projet

Général

Profil

Paste
Télécharger au format
Statistiques
| Branche: | Révision:

root / plugins / ssl / letsencrypt_weekly @ bba98f95

Historique | Voir | Annoter | Télécharger (1,55 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
26
https://www.wt-io-it.at/
27

    
28
=head1 LICENSE
29

    
30
GPLv2
31

    
32
=head1 MAGIC MARKERS
33

    
34
 #%# family=auto
35
 #%# capabilities=autoconf
36

    
37
=cut
38

    
39
. "$MUNIN_LIBDIR/plugins/plugin.sh"
40

    
41
warning=${warning:-:40}
42
critical=${critical:-:50} #letsencrypt doesn't allow more than 50 certificates per week
43
# see https://letsencrypt.org/docs/rate-limits/
44

    
45
if [ "$1" = "autoconf" ] ; then
46
	test -d /etc/letsencrypt/csr/ && echo "yes" || echo "no (directory /etc/letsencrypt/csr does not exist)"
47
elif [ "$1" = "config" ] ; then
48
	echo "graph_title Letsencrypt certificate requests during last week"
49
	echo "graph_args --base 1000"
50
	echo "graph_vlabel Number of certificates"
51
	echo "graph_category security"
52
	echo "letsencrypt_weekly.label Letsencrypt certificates last week"
53
	print_warning "letsencrypt_weekly"
54
	print_critical "letsencrypt_weekly"
55
elif [ "$1" = "" ] ; then
56
	if existing_certs=$(find /etc/letsencrypt/csr/ -mtime -7 -type f 2>/dev/null); then
57
		value=$(echo "$existing_certs" | wc -l)
58
	else
59
		value="U"
60
	fi
61
	echo "letsencrypt_weekly.value $value"
62
fi