Skip to content
Snippets Groups Projects
Commit cac41ad9 authored by Dominik Baránek's avatar Dominik Baránek
Browse files

feat: Added metadata_expiration.py script

parent 481ecee6
No related branches found
No related tags found
1 merge request!21feat: Added metadata_expiration.py script
...@@ -14,4 +14,10 @@ All nagios scripts are located under `nagios` directory. ...@@ -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 * Do mysqldump into `/opt/mariadb_backup` and remove all dump file older than 7 days
### separate_oidc_logs.py ### separate_oidc_logs.py
* Script for remove all logs from test accounts from OIDC logs * Script for remove all logs from test accounts from OIDC logs
\ No newline at end of file
### 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
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 + ')')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment