File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -162,6 +162,11 @@ mode_apicert() {
162
162
APICERT=$( echo " $APISERVER " | awk -F " //" ' { print $2 }' | awk -F " :" ' { print $1 }' )
163
163
APIPORT=$( echo " $APISERVER " | awk -F " //" ' { print $2 }' | awk -F " :" ' { print $2 }' )
164
164
APIPORT=${APIPORT:= 443}
165
+ timeout " $TIMEOUT " bash -c " </dev/tcp/$APICERT /$APIPORT " & > /dev/null
166
+ if [ $? -ne 0 ]; then
167
+ echo " APICERT is in UNKNOWN"
168
+ exit 3
169
+ fi
165
170
APICERTDATE=$( echo | openssl s_client -connect " $APICERT " :" $APIPORT " 2> /dev/null | openssl x509 -noout -dates | grep notAfter | sed -e ' s#notAfter=##' )
166
171
a=$( date -d " $APICERTDATE " +%s)
167
172
b=$( date +%s)
@@ -176,9 +181,6 @@ mode_apicert() {
176
181
elif [ " $d " -le " $CRIT " ]; then
177
182
echo " APICERT is in CRIT"
178
183
EXITCODE=2
179
- else
180
- echo " APICERT is in UNKNOWN"
181
- EXITCODE=3
182
184
fi
183
185
}
184
186
You can’t perform that action at this time.
0 commit comments