Skip to content

Commit 23ed45e

Browse files
authored
Merge pull request #44 from lderugeriis/master
Add critical threshold for TLS expiration days in TLS mode
2 parents 4cdf0f1 + 063e443 commit 23ed45e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

check_kubernetes.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ usage() {
3030
- Pvc storage utilization; default is 80%
3131
- API cert expiration days for apicert mode; default is 30
3232
-c CRIT Critical threshold for
33+
- TLS expiration days for TLS mode; default is 0
3334
- Pod restart count (in pods mode); default is 150
3435
- Unbound Persistent Volumes in unboundpvs mode; default is 5
3536
- Job failed count in jobs mode; default is 2
@@ -297,6 +298,7 @@ mode_pvc() {
297298

298299
mode_tls() {
299300
WARN=${WARN:-30}
301+
CRIT=${CRIT:-0}
300302

301303
count_ok=0
302304
count_warn=0
@@ -337,6 +339,10 @@ mode_tls() {
337339
((count_crit++))
338340
EXITCODE=2
339341
OUTPUT="$OUTPUT $ns/$cert is expired."
342+
elif [ "$diff" -le "$((CRIT*24*3600))" ]; then
343+
((count_crit++))
344+
EXITCODE=2
345+
OUTPUT="$OUTPUT $ns/$cert is about to expire in $((diff/3600/24)) days."
340346
elif [ "$diff" -le "$((WARN*24*3600))" ]; then
341347
((count_warn++))
342348
if [ "$EXITCODE" == 0 ]; then

0 commit comments

Comments
 (0)