mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-21 18:41:03 +00:00
[multi-ssl] POSIX shell compatibility
Signed-off-by: Olivier Mehani <shtrom@ssji.net>
This commit is contained in:
parent
91fe427bfc
commit
f31fe9a6c3
1 changed files with 7 additions and 7 deletions
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
# -*- sh -*-
|
# -*- sh -*-
|
||||||
|
|
||||||
: << =cut
|
: << =cut
|
||||||
|
@ -9,7 +9,7 @@ multi_ssl - Plugin to monitor CERTificate expiration on multiple services and po
|
||||||
|
|
||||||
=head1 CONFIGURATION
|
=head1 CONFIGURATION
|
||||||
|
|
||||||
[multi_ssl_*]
|
[multi_ssl]
|
||||||
env.services www.service.tld blah.example.net_PORT
|
env.services www.service.tld blah.example.net_PORT
|
||||||
|
|
||||||
To set warning and critical levels do like this:
|
To set warning and critical levels do like this:
|
||||||
|
@ -46,7 +46,7 @@ case $1 in
|
||||||
echo "graph_info This graph shows the days left for the certificate"
|
echo "graph_info This graph shows the days left for the certificate"
|
||||||
for service in $services; do
|
for service in $services; do
|
||||||
fieldname=$(clean_fieldname "$service")
|
fieldname=$(clean_fieldname "$service")
|
||||||
echo "${fieldname}.label ${service/_/:}"
|
echo "${fieldname}.label $(echo ${service} | sed 's/_/:/')"
|
||||||
print_thresholds "${fieldname}"
|
print_thresholds "${fieldname}"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -54,10 +54,10 @@ case $1 in
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
function get_expire()
|
get_expire()
|
||||||
{
|
{
|
||||||
SITE="${1/_*/}"
|
SITE="$(echo ${1} | sed 's/_.*//')"
|
||||||
PORT="${1##*_}"
|
PORT="$(echo ${1} | sed 's/.*_//')"
|
||||||
VAR="$(clean_fieldname "$1")"
|
VAR="$(clean_fieldname "$1")"
|
||||||
if [ "$PORT" = "$SITE" ]; then
|
if [ "$PORT" = "$SITE" ]; then
|
||||||
PORT=443
|
PORT=443
|
||||||
|
@ -65,7 +65,7 @@ function get_expire()
|
||||||
|
|
||||||
CERT=$(echo "" | openssl s_client -CApath /etc/ssl/certs -servername "${SITE}" -connect "${SITE}:${PORT}" 2>/dev/null);
|
CERT=$(echo "" | openssl s_client -CApath /etc/ssl/certs -servername "${SITE}" -connect "${SITE}:${PORT}" 2>/dev/null);
|
||||||
|
|
||||||
if [[ "${CERT}" = *"-----BEGIN CERTIFICATE-----"* ]]; then
|
if echo "${CERT}" | grep -q -- "-----BEGIN CERTIFICATE-----"; then
|
||||||
echo "${CERT}" \
|
echo "${CERT}" \
|
||||||
| openssl x509 -noout -enddate \
|
| openssl x509 -noout -enddate \
|
||||||
| awk -F= 'BEGIN {
|
| awk -F= 'BEGIN {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue