- Products
- Learn
- Local User Groups
- Partners
- More
Firewall Uptime, Reimagined
How AIOps Simplifies Operations and Prevents Outages
Introduction to Lakera:
Securing the AI Frontier!
Check Point Named Leader
2025 Gartner® Magic Quadrant™ for Hybrid Mesh Firewall
HTTPS Inspection
Help us to understand your needs better
CheckMates Go:
SharePoint CVEs and More!
You probably need that check_cert_time() function, too:
check_cert_time() {
local cert_host=$1
local cert_time=$2
#echo "--${cert_host}--, --${cert_time}--"
cert_tm=$(date +"%s" -d "${cert_time}" 2>/dev/null)
if (( $? )); then
exitstatus=${STATE_UNKNOWN}
status_msg="Error processing certificate status (cert_host: ${cert_host})"
echo ${status_msg}
exit ${exitstatus}
fi
#echo "date now: ${DATE_NOW}"
cert_days=$(( (${cert_tm} - ${DATE_NOW}) / 86400 ))
#echo "cert_days: ${cert_days}"
#echo "warn: ${WARN_LEV}, crit: ${CRIT_LEV}"
if (( ${cert_days} > ${WARN_LEV} )); then
status_msg=${status_msg:+${status_msg}"<br>"}"${cert_host} is OK"
exitstatus=$(( exitstatus | ${STATE_OK} ))
elif (( ${cert_days} > ${CRIT_LEV} )); then
status_msg=${status_msg:+${status_msg}"<br>"}"${cert_host} is WARNING"
exitstatus=$(( exitstatus | ${STATE_WARNING} ))
elif (( ${cert_days} <= ${CRIT_LEV} )); then ## && ${cert_days} >= 0 )); then
status_msg=${status_msg:+${status_msg}"<br>"}"${cert_host} is CRITICAL"
exitstatus=$(( exitstatus | ${STATE_CRITICAL} ))
else ## Never will reach here, i know
status_msg=${status_msg:+${status_msg}"<br>"}"${cert_host} is UNKNOWN"
exitstatus=$(( exitstatus | 4 ))
fi
perf_msg=${perf_msg:+${perf_msg}"<br>"}"${cert_host}: ${cert_days}"
#echo "${status_msg} | ${perf_msg}"
#echo "status: ${exitstatus}"
}
The status and perfdata message variables are just to feed info back into Nagios. Do with these what you want ...or not.
About CheckMates
Learn Check Point
Advanced Learning
YOU DESERVE THE BEST SECURITY