do not include iso nodes in wsbroadcast status

This commit is contained in:
chris meyers 2020-04-14 16:54:00 -04:00
parent daa312d7ee
commit 9cabf3ef4d

View File

@ -7,6 +7,7 @@ import re
from datetime import datetime as dt
from django.core.management.base import BaseCommand
from django.db.models import Q
from awx.main.analytics.broadcast_websocket import (
BroadcastWebsocketStatsManager,
@ -67,7 +68,7 @@ class Command(BaseCommand):
connection_started = data.get(f'{prefix}_connection_start', 'Error')
if connection_started != 'Error':
connection_started = datetime.datetime.fromtimestamp(connection_started)
connection_duration = (dt.now() - connection_started).total_seconds()
connection_duration = int((dt.now() - connection_started).total_seconds())
connection_state = f'\033[{connection_color}m{connection_state}\033[0m'
@ -81,8 +82,8 @@ class Command(BaseCommand):
for h in hostnames:
h = safe_name(h)
prefix = f'awx_{h}'
messages_total = data.get(f'{prefix}_messages_received', 'N/A')
messages_per_minute = data.get(f'{prefix}_messages_received_per_minute', 'N/A')
messages_total = data.get(f'{prefix}_messages_received', '0')
messages_per_minute = data.get(f'{prefix}_messages_received_per_minute', '0')
host_stats.append((h, str(int(messages_total)), str(int(messages_per_minute))))
@ -101,7 +102,7 @@ class Command(BaseCommand):
else:
data[family.name] = family.samples[0].value
me = Instance.objects.me()
hostnames = [i.hostname for i in Instance.objects.exclude(hostname=me.hostname)]
hostnames = [i.hostname for i in Instance.objects.exclude(Q(hostname=me.hostname) | Q(rampart_groups__controller__isnull=False))]
host_stats = Command.get_connection_status(me, hostnames, data)
lines = Command._format_lines(host_stats)