check_scrutiny_disks: fix time comparison
This commit is contained in:
parent
20b7fb2d68
commit
6be2e48fa3
|
@ -3,6 +3,7 @@ import argparse
|
|||
import subprocess
|
||||
import sys
|
||||
from datetime import datetime, timedelta
|
||||
import pytz
|
||||
from typing import List
|
||||
|
||||
import requests
|
||||
|
@ -80,7 +81,7 @@ def main(args):
|
|||
# smart_health['data']['device']['UpdatedAt'] = '2023-04-28T23:00:03.071184465Z'
|
||||
|
||||
last_updated = datetime.strptime(smart_health['data']['device']['UpdatedAt'][:-10] + smart_health['data']['device']['UpdatedAt'][-6:], '%Y-%m-%dT%H:%M:%S.%f%z')
|
||||
if datetime.utcnow() - timedelta(hours=args.time_delta_limit) > last_updated:
|
||||
if datetime.now(pytz.utc) - timedelta(hours=args.time_delta_limit) > last_updated:
|
||||
metrics_out_of_date = True
|
||||
|
||||
if smart_health and len(smart_health['data']['smart_results']):
|
||||
|
|
Loading…
Reference in New Issue