Ad Widget

Collapse

Problems Triggering incorrectly

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bilal.habib
    Junior Member
    • Apr 2020
    • 22

    #1

    Problems Triggering incorrectly

    Hi All,

    I have the following template which I made myself

    and then a script which I found on this forum

    HTML Code:
    #!/bin/bash
    
    #Prepared by Marcin 'szremo' Szremski'
    
    SSL_DATE=$(echo | openssl s_client -servername $1 -connect $1:443 2>/dev/null | openssl x509 -noout -dates | grep notAfter | awk -F = '{ print $2 }' | awk 'BEGIN {OFS = "-"} {print $1,$2,$4}')
    
    EXPTIME=$(date -d$SSL_DATE +%s)
    
    TODAY=$(date +"%b-%d-%Y")
    
    CURRENT=$(date -d$TODAY +%s)
    
    NUM=$(($EXPTIME - $CURRENT))
    
    RESULT=$(($NUM/86400))
    
    echo $RESULT
    Script and items work great but problems trigger when they should not.

    For example the certificate expires in 394 days but the trigger for 7 days goes off.

    I believe this is due to the expression, anyone know what I am doing?

    Example of an expression I'm using which should not be triggering
    HTML Code:
    nodata(/Template MADE SSL Monitoring/ssl_valid.sh[{$HOSTNAME1}],1d)<={$THRESHOLD3}
    Thanks
    Attached Files
    Last edited by bilal.habib; 05-08-2021, 16:58.
Working...