From 2ff689ae91a9b7bb7c25b0b5f0c8f3541f110126 Mon Sep 17 00:00:00 2001 From: Kameron Kenny Date: Mon, 30 Dec 2024 12:26:16 -0500 Subject: [PATCH] fix check ssl --- Dockerfile | 2 ++ overlay/opt/nagios/libexec/check_ssl_certificate | 11 ++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index c4c8980..a910f16 100644 --- a/Dockerfile +++ b/Dockerfile @@ -252,6 +252,8 @@ RUN cd /opt/nagios/etc/objects && \ RUN sed -i 's,/bin/mail,/usr/bin/mail,' ${NAGIOS_HOME}/etc/objects/000-commands.cfg && \ sed -i 's,/usr/usr,/usr,' ${NAGIOS_HOME}/etc/objects/000-commands.cfg +RUN cp /opt/nagios/libexec/utils.pm /usr/lib/aarch64-linux-gnu/perl-base/ + #VOLUME "${NAGIOS_HOME}/var" "${NAGIOS_HOME}/etc" "/var/log/apache2" "/opt/Custom-Nagios-Plugins" "/opt/nagiosgraph/var" "/opt/nagiosgraph/etc" CMD [ "/usr/local/bin/start_nagios" ] diff --git a/overlay/opt/nagios/libexec/check_ssl_certificate b/overlay/opt/nagios/libexec/check_ssl_certificate index cf3385c..8dac2e4 100755 --- a/overlay/opt/nagios/libexec/check_ssl_certificate +++ b/overlay/opt/nagios/libexec/check_ssl_certificate @@ -130,7 +130,6 @@ close(OPENSSL); $date =~ s/ +/ /g; my ($month, $day, $hour, $min, $sec, $year, $tz) = split(/[\s+|:]/, $date); -print "m=$month, d=$day, h=$hour, m=$min, s=$sec, y=$year, z=$tz\n"; my $daysLeft = int((timegm($sec, $min, $hour, $day, $months{$month}, $year - 1900) - time()) / 86400); @@ -153,17 +152,19 @@ if ($verbose) { } if ($daysLeft < 0) { - print "$PROGNAME: CRITICAL - $cn expired " . abs($daysLeft) . " day(s) ago.\n"; + print "$PROGNAME: CRITICAL - $cn expired " . abs($daysLeft) . " day(s) ago. m=$month, d=$day, h=$hour, m=$min, s=$sec, y=$year, z=$tz\n"; } elsif ($daysLeft <= $critical) { - print "$PROGNAME: CRITICAL - only $daysLeft day(s) left for $cn.\n"; + print "$PROGNAME: CRITICAL - only $daysLeft day(s) left for $cn. m=$month, d=$day, h=$hour, m=$min, s=$sec, y=$year, z=$tz\n"; exit $ERRORS{'CRITICAL'}; } elsif ($daysLeft <= $warning) { - print "$PROGNAME: WARNING - only $daysLeft day(s) left for $cn.\n"; + print "$PROGNAME: WARNING - only $daysLeft day(s) left for $cn. m=$month, d=$day, h=$hour, m=$min, s=$sec, y=$year, z=$tz\n"; exit $ERRORS{'WARNING'}; } elsif ($verbose) { - print "$PROGNAME: $daysLeft day(s) left for $cn.\n"; + print "$PROGNAME: $daysLeft day(s) left for $cn. m=$month, d=$day, h=$hour, m=$min, s=$sec, y=$year, z=$tz\n"; } +print "m=$month, d=$day, h=$hour, m=$min, s=$sec, y=$year, z=$tz\n"; + exit $ERRORS{'OK'}; sub print_help {