{% extends "_base.html" %} {% set base_url = base_url %} {% block title %}Events Summary — {{ _brand_name }}{% endblock %} {% block content %} {# Define critical aggregator keys mapping #} {% set CRITICAL_KEYS = { "job_failure": "Job Failure", "anomalycpu": "Anomaly CPU", "anomalyerrorrate": "Anomaly Error Rate", "anomalylatency": "Anomaly Latency", "anomalymemory": "Anomaly Memory", "sloavailability": "SLO Availability", "latency": "Latency", "diskrunsoutofspace": "Disk Runs Out Of Space", "diskrunsoutofspacein3days": "Disk Runs Out Of Space In 3 Days", "applicationapifailures": "Application API Failures", "higherrorcriticallogs": "Critical errors detected in Log", "cputhrottlinghigh": "CPU Throttling High Detected", "SLOViolation": "SLO Violation", "Anomaly": "Anomaly", "report_crash_loop": "Crash Loop Detected", "pod_restart": "Pod Restart", "node_not_ready": "Node Not Ready", "deployment_failed": "Deployment Failed", "service_unavailable": "Service Unavailable", "memory_limit_exceeded": "Memory Limit Exceeded", "cpu_limit_exceeded": "CPU Limit Exceeded", "storage_full": "Storage Full", "network_error": "Network Error", "config_error": "Configuration Error", "image_pull_backoff_reporter": "Image Pull BackOff", "pod_oom_killer_enricher": "Pod OOM Killed" } %} {# Create a normalized version of CRITICAL_KEYS where keys are lower-case with spaces removed #} {% set NORMALIZED_CRITICAL_KEYS = {} %} {% for key, label in CRITICAL_KEYS.items() %} {% set norm_key = key|replace(" ", "")|lower %} {% set _ = NORMALIZED_CRITICAL_KEYS.update({norm_key: label}) %} {% endfor %} {#- Compute totals for AI summary -#} {% set ns = namespace(total_events=0, total_high=0, account_count=0) %} {% for account in accounts.data.accounts %} {% set account_event_rows = event_counts.data.event_groupings.rows | selectattr('account_id','equalto',account.id) | list %} {% if account_event_rows|length > 0 %} {% set ns.account_count = ns.account_count + 1 %} {% set ns.total_events = ns.total_events + (account_event_rows | map(attribute='event_count') | sum) %} {% set ns.total_high = ns.total_high + (account_event_rows | map(attribute='count_priority_high') | sum) %} {% endif %} {% endfor %}
I detected {{ ns.total_events }} events across your clusters in the last 24 hours. {% if ns.total_high > 0 %} {{ ns.total_high }} are high priority — here's what I'd investigate first. {% else %} Nothing high priority — here's the overview. {% endif %}
{# Loop over each account (cluster) #} {% for account in accounts.data.accounts %} {% set account_event_rows = event_counts.data.event_groupings.rows | selectattr('account_id','equalto',account.id) | list %} {% if account_event_rows|length > 0 %} {# totals from raw table #} {% set total_events = account_event_rows | map(attribute='event_count') | sum %} {% set total_high = account_event_rows | map(attribute='count_priority_high') | sum %} {% set total_medium = account_event_rows | map(attribute='count_priority_medium') | sum %} {% set total_low = account_event_rows | map(attribute='count_priority_low') | sum %} {# per-aggregation totals (dict) #} {% set agg_tot = {} %} {% for r in account_event_rows %} {% set _ = agg_tot.update({ r.aggregation_key : agg_tot.get(r.aggregation_key,0) + r.event_count }) %} {% endfor %} {# summarised rows for subject breakdown #} {% set account_events_summarised = events_summarised.data.event_groupings.rows | selectattr('account_id','equalto',account.id) | list %} {% if account_events_summarised|length == 0 %} {% set account_events_summarised = account_event_rows %} {% endif %}{{ total_events }} events High: {{ total_high }} Medium: {{ total_medium }} Low: {{ total_low }}
{# Group aggregator events #} {% set grouped_events = account_events_summarised | groupby("aggregation_key") %} {% set critical_groups = [] %} {% set other_groups = [] %} {% for group in grouped_events %} {% set agg_key = group.grouper %} {% set rows_for_key = group.list %} {% set normalized_agg_key = agg_key|replace(" ", "")|lower %} {% if normalized_agg_key in NORMALIZED_CRITICAL_KEYS %} {% set _ = critical_groups.append((agg_key, rows_for_key)) %} {% else %} {% set _ = other_groups.append((agg_key, rows_for_key)) %} {% endif %} {% endfor %} {% set aggregator_count = critical_groups|length + other_groups|length %} {% if aggregator_count > 0 %}{{ NORMALIZED_CRITICAL_KEYS[agg_key|replace(" ", "")|lower] }} {{ total_agg_events }}
{# Consolidate duplicate subjects #} {% set dedup = {} %} {% for row in rows_for_key %} {% set subject = row.get('subject_name', row.aggregation_key) %} {% set time = row.get('max_created_at', row.created_at) %} {% set key = subject ~ '_' ~ time %} {% if dedup[key] is defined %} {% set _ = dedup[key].update({'event_count': dedup[key].event_count + row.event_count}) %} {% else %} {% set _ = dedup.update({ key: { 'subject_name': subject, 'max_created_at': time, 'event_count': row.event_count, 'subject_namespace': row.get('subject_namespace', 'nudgebee'), 'last_seen_formatted': row.get('last_seen_formatted') } }) %} {% endif %} {% endfor %} {% set consolidated_subjects = [] %} {% for key, val in dedup.items() %} {% set _ = consolidated_subjects.append(val) %} {% endfor %} {% set sorted_subjects = consolidated_subjects | sort(attribute='event_count', reverse=True) %} {% for row in sorted_subjects[:3] %}
•
{{ row.subject_name }} ({{ row.event_count }} times)
Investigate →
ns: {{ row.subject_namespace }} | last seen: {{ row.last_seen_formatted or 'N/A' }}
• {% set display_name = NORMALIZED_CRITICAL_KEYS.get(o_key|replace(" ", "")|lower, o_key) %}{{ display_name }} {{ o_count }}
{% endif %} {% endfor %} {% if sorted_others|length > 0 %} {% endif %} {% endif %} {% endif %} {% endif %} {# Divider after every account block (except the last rendered account) #} {% if not loop.last %} {% endif %} {% endif %} {% endfor %}Tip
Set up auto-remediation for recurring events. I can restart pods automatically when crash loops are detected.
Set up →