Make retcode the number of failed checks
This commit is contained in:
@@ -8,7 +8,6 @@ Options:
|
|||||||
-t SECONDS --timeout=SECONDS Timeout for SSL Handshake [default: 5]
|
-t SECONDS --timeout=SECONDS Timeout for SSL Handshake [default: 5]
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
from pprint import pprint
|
|
||||||
|
|
||||||
from docopt import docopt
|
from docopt import docopt
|
||||||
|
|
||||||
@@ -30,7 +29,11 @@ if __name__ == "__main__":
|
|||||||
logging.info(f"Getting CERT from {hs}")
|
logging.info(f"Getting CERT from {hs}")
|
||||||
results.append(check_host_certificate_expiration(hs, days_to_expiration))
|
results.append(check_host_certificate_expiration(hs, days_to_expiration))
|
||||||
|
|
||||||
|
failed = list(r for r in results if not r.check_successful)
|
||||||
|
|
||||||
if output_as_json:
|
if output_as_json:
|
||||||
print(json_output(results))
|
print(json_output(results))
|
||||||
else:
|
else:
|
||||||
print(default_output(results))
|
print(default_output(results))
|
||||||
|
|
||||||
|
exit(len(failed))
|
||||||
|
|||||||
Reference in New Issue
Block a user