{% set expired = certs|selectattr('expired')|list|default([])|length %}
{% set expiring = certs|selectattr('days_remaining','le',30)|rejectattr('expired')|list|default([])|length %}
{% if expired > 0 %}{{ expired }} expired. {% endif %}
{% if expiring > 0 %}{{ expiring }} expiring soon.{% endif %}
{% if expired == 0 and expiring == 0 %}All valid{% endif %}
WireGuard
{{ 'UP' if (wg_status is defined and wg_status.get('state') == 'up') else 'DOWN' }}
Tunnel state
Active Leases
{{ leases|default([])|length }}
DHCP clients connected
Services
{% for svc_name, svc in (services or {}).items() %}
{{ svc_name }}
{{ 'Running' if svc.get('running') else 'Stopped' }}
{% if svc.get('pid') %}PID {{ svc.pid }}{% endif %}
{% if svc.get('since') %} ยท {{ svc.since }}{% endif %}
{% endfor %}
{% if not (services or {}) %}
Firewalld
Running
Dnsmasq
Running
Nginx
Running
wg0
{{ 'Up' if (wg_status is defined and wg_status.get('state') == 'up') else 'Down' }}
{% endif %}
{% set warnings = [] %}
{% if certs is defined %}
{% for cert in certs %}
{% if cert.get('expired') %}
{% set _ = warnings.append("Certificate for " + cert.get('domain', 'unknown') + " has expired") %}
{% elif cert.get('days_remaining') is not none and cert.days_remaining <= 30 %}
{% set _ = warnings.append("Certificate for " + cert.get('domain', 'unknown') + " expires in " + cert.days_remaining|string + " days") %}
{% endif %}
{% endfor %}
{% endif %}
{% if warnings|length > 0 or (services is defined) %}
Warnings & Activity
{% if warnings|length > 0 %}
{% for w in warnings %}
{{ w }}
{% endfor %}
{% endif %}
{% if not warnings and not (services or {}) %}