diff --git a/README.md b/README.md index 57d9c1132e22025ff6de98e34c8b7de4376c1d85..4087d0c91f264d9d4012c95e2c61618dc9a93b45 100644 --- a/README.md +++ b/README.md @@ -14,4 +14,10 @@ All nagios scripts are located under `nagios` directory. * Do mysqldump into `/opt/mariadb_backup` and remove all dump file older than 7 days ### separate_oidc_logs.py -* Script for remove all logs from test accounts from OIDC logs \ No newline at end of file +* Script for remove all logs from test accounts from OIDC logs + +### metadata_expiration.py +* This script checks whether there are some metadata close to expiration date + +* Params: + * 1 - url to a page which prints a time when expires the metadata closest to expiration \ No newline at end of file diff --git a/metadata_expiration.py b/metadata_expiration.py new file mode 100644 index 0000000000000000000000000000000000000000..cd1b68dd13755d08dc7b9b042483ffb6828e9e53 --- /dev/null +++ b/metadata_expiration.py @@ -0,0 +1,14 @@ +import sys +from urllib.request import urlopen +from bs4 import BeautifulSoup + +url = sys.argv[1] +html = urlopen(url).read() +closest_expiration = BeautifulSoup(html, "html.parser") + +if float(closest_expiration.text) >= 24: + print('0 metadata_expiration - OK (' + closest_expiration.text + ')') +elif float(closest_expiration.text) >= 12: + print('1 metadata_expiration - WARNING (' + closest_expiration.text + ')') +else: + print('2 metadata_expiration - CRITICAL (' + closest_expiration.text + ')')