diff --git a/ci/aws-iam-check-keys/find_stale_keys.py b/ci/aws-iam-check-keys/find_stale_keys.py index f9fec6d..af6747e 100644 --- a/ci/aws-iam-check-keys/find_stale_keys.py +++ b/ci/aws-iam-check-keys/find_stale_keys.py @@ -127,6 +127,8 @@ def send_alerts(cleared, events, db): event.cleared = True if cleared else False event.alert_sent = True event.save() + print(f'stale_key_num{{user="{user_string}", alert_type="{alert_type}", key="{access_key_num}", last_rotated="{access_key_last_rotated}"}} {cleared_int}\n') + # Send alerts to prometheus to update alerts prometheus_url = f'http://{os.getenv("GATEWAY_HOST")}:{os.getenv("GATEWAY_PORT", "9091")}/metrics/job/find_stale_keys' @@ -140,7 +142,6 @@ def send_alerts(cleared, events, db): else: print(f'Warning! Metrics failed to record! See Logs status_code: {res.status_code} reason: {res.reason}') transaction.rollback() - print(f'stale_key_num{{user="{user_string}", alert_type="{alert_type}", key="{access_key_num}", last_rotated="{access_key_last_rotated}"}} {cleared_int}\n') def send_all_alerts(db): try: