mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-21 18:41:03 +00:00
ssl-certificate-expiry: fix handling domains starting with digits
resolves #1224
This commit is contained in:
parent
e794a441e4
commit
09974133b3
1 changed files with 7 additions and 2 deletions
|
@ -165,6 +165,11 @@ print_expire_days() {
|
|||
fi
|
||||
}
|
||||
|
||||
my_clean_fieldname() {
|
||||
# if a domain starts with a digit, or its an IP address, prepend '_'
|
||||
clean_fieldname "$(echo "$@" | sed -E 's/^([0-9])/_\1/')"
|
||||
}
|
||||
|
||||
main() {
|
||||
for service in $services; do
|
||||
if echo "$service" | grep -q "_"; then
|
||||
|
@ -176,7 +181,7 @@ main() {
|
|||
port=443
|
||||
starttls=""
|
||||
fi
|
||||
fieldname="$(clean_fieldname "$service")"
|
||||
fieldname="$(my_clean_fieldname "$service")"
|
||||
valid_days=$(print_expire_days "$host" "$port" "$starttls")
|
||||
extinfo=""
|
||||
[ -z "$valid_days" ] && valid_days="U"
|
||||
|
@ -197,7 +202,7 @@ case ${1:-} in
|
|||
echo 'graph_category security'
|
||||
echo "graph_info This graph shows the numbers of days before certificate expiry"
|
||||
for service in $services; do
|
||||
fieldname=$(clean_fieldname "$service")
|
||||
fieldname=$(my_clean_fieldname "$service")
|
||||
echo "${fieldname}.label $(echo "${service}" | sed 's/_/:/')"
|
||||
print_thresholds "${fieldname}" warning critical
|
||||
done
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue