fixes
This commit is contained in:
parent
ac697f9590
commit
11f0cf031a
|
|
@ -2,7 +2,7 @@
|
|||
import boto3
|
||||
from datetime import datetime
|
||||
|
||||
# WICHTIG: Region korrigiert
|
||||
# Region fest auf us-east-2
|
||||
sqs = boto3.client('sqs', region_name='us-east-2')
|
||||
|
||||
def get_all_queues():
|
||||
|
|
@ -23,15 +23,21 @@ def main():
|
|||
|
||||
queues = get_all_queues()
|
||||
|
||||
if not queues:
|
||||
print("No queues found matching '*-queue'. Check your region or permissions.")
|
||||
return
|
||||
|
||||
# Sortieren für schönere Ausgabe
|
||||
queues.sort(key=lambda x: x[0])
|
||||
|
||||
for name, url in queues:
|
||||
dlq_name = name + '-dlq'
|
||||
domain = name.replace('-queue', '').replace('-', '.') # Grobe Rückumwandlung
|
||||
|
||||
try:
|
||||
# Main Queue Stats
|
||||
# Main Queue Stats - NUR gültige Attribute abfragen
|
||||
attrs = sqs.get_queue_attributes(
|
||||
QueueUrl=url,
|
||||
AttributeNames=['ApproximateNumberOfMessages', 'ApproximateNumberOfMessagesNotVisible', 'ApproximateAgeOfOldestMessage']
|
||||
AttributeNames=['ApproximateNumberOfMessages', 'ApproximateNumberOfMessagesNotVisible']
|
||||
)['Attributes']
|
||||
|
||||
# DLQ Stats (Versuch URL zu finden)
|
||||
|
|
@ -40,22 +46,27 @@ def main():
|
|||
dlq_attrs = sqs.get_queue_attributes(QueueUrl=dlq_url, AttributeNames=['ApproximateNumberOfMessages'])['Attributes']
|
||||
dlq_count = int(dlq_attrs.get('ApproximateNumberOfMessages', 0))
|
||||
except:
|
||||
dlq_count = -1 # Keine DLQ gefunden
|
||||
dlq_count = -1 # Keine DLQ gefunden oder Fehler
|
||||
|
||||
available = int(attrs.get('ApproximateNumberOfMessages', 0))
|
||||
flight = int(attrs.get('ApproximateNumberOfMessagesNotVisible', 0))
|
||||
|
||||
# Status-Icon Bestimmung
|
||||
status = "✅"
|
||||
if dlq_count > 0: status = "⚠️ "
|
||||
if available > 50: status = "🔥"
|
||||
if dlq_count > 0: status = "⚠️ " # DLQ nicht leer
|
||||
if available > 50: status = "🔥" # Stau in der Main Queue
|
||||
|
||||
print(f"{status} Queue: {name}")
|
||||
print(f" Pending: {available:<5} (Waiting for worker)")
|
||||
print(f" Processing: {flight:<5} (Currently in worker)")
|
||||
|
||||
if dlq_count >= 0:
|
||||
print(f" DLQ Errors: {dlq_count:<5} (In {dlq_name})")
|
||||
if dlq_count > 0:
|
||||
print(f" DLQ Errors: \033[91m{dlq_count:<5}\033[0m (In {dlq_name})") # Rot markiert
|
||||
else:
|
||||
print(f" DLQ Errors: {dlq_count:<5} (In {dlq_name})")
|
||||
else:
|
||||
print(f" DLQ: Not found")
|
||||
print(f" DLQ: Not found / No access")
|
||||
print("-" * 30)
|
||||
|
||||
except Exception as e:
|
||||
|
|
|
|||
Loading…
Reference in New Issue