{% extends "base.html" %} {% block title %}Status systemu - Admin{% endblock %} {% block extra_css %} {% endblock %} {% block content %} ← Powrót do panelu bezpieczeństwa

📊 Status systemu

Monitoring wydajności i zdrowia portalu NordaBiznes

Ostatnia aktualizacja
{{ generated_at|local_time('%H:%M:%S') }}
{{ generated_at|local_time('%d.%m.%Y') }}
Auto-refresh: 5:00
🖥️
System
{{ system_metrics.hostname }}
{% if system_metrics.cpu_percent is not none %}
{{ system_metrics.cpu_percent }}%
CPU
{% endif %} {% if system_metrics.ram_percent is not none %}
RAM {{ system_metrics.ram_used_gb }} GB / {{ system_metrics.ram_total_gb }} GB ({{ system_metrics.ram_percent }}%)
{% endif %} {% if system_metrics.disk_percent is not none %}
Dysk {{ system_metrics.disk_used }} / {{ system_metrics.disk_total }} ({{ system_metrics.disk_percent }}%)
{% endif %}
System operacyjny {{ system_metrics.os }}
Python {{ system_metrics.python }}
{% if system_metrics.uptime %}
Uptime {{ system_metrics.uptime }}
{% endif %} {% if system_metrics.load_1 is defined %}
Load Average {{ system_metrics.load_1 }} / {{ system_metrics.load_5 }} / {{ system_metrics.load_15 }}
{% endif %}
🗄️
Baza danych
PostgreSQL
{{ '✓ OK' if db_metrics.status == 'ok' else '✗ Błąd' }}
{% if db_metrics.status == 'ok' %}
{{ db_metrics.size_mb }} MB
Rozmiar bazy
{{ db_metrics.active_connections }}/{{ db_metrics.total_connections }}
Połączenia aktywne
{{ db_metrics.companies }}
Firm
{{ db_metrics.users }}
Użytkowników
{% if db_metrics.chat_messages is defined %}
Wiadomości chat {{ db_metrics.chat_messages }}
Sesje chat {{ db_metrics.chat_sessions }}
Profile Social Media {{ db_metrics.social_media }}
Audyty SEO {{ db_metrics.seo_audits }}
{% endif %} {% if db_metrics.cache_hit_ratio is defined %}
Cache Hit Ratio {{ db_metrics.cache_hit_ratio }}%
{% if db_metrics.slow_queries is defined %}
Slow Queries (>1s) {{ db_metrics.slow_queries }}
{% endif %} {% if db_metrics.deadlocks is defined %}
Deadlocks {{ db_metrics.deadlocks }}
{% endif %}
{% endif %} {% else %}

⚠️ Błąd połączenia z bazą danych

{{ db_metrics.error }}

{% endif %}
🌐
Aplikacja
NordaBiznes Portal
{% if app_metrics.endpoints_ok is not none %}
{{ app_metrics.endpoints_percent|int }}%
Endpointy OK
{% endif %}
{{ app_metrics.logins_24h }}
Logowań (24h)
{{ app_metrics.alerts_24h }}
Alertów (24h)
{{ app_metrics.admins }}
Administratorów
{{ app_metrics.users_with_2fa }}
Z 2FA
Frontend
Database
API
Auth
⚙️
Procesy
Serwer aplikacji
{{ 'Gunicorn ✓' if process_metrics.gunicorn_status == 'running' else 'Dev mode' }}
{% if process_metrics.gunicorn_status == 'running' %}
{{ process_metrics.gunicorn_workers }}
Gunicorn Workers
{% else %}

{% if process_metrics.gunicorn_status == 'not found' %} Gunicorn nie wykryty - tryb deweloperski {% else %} Status Gunicorn nieznany {% endif %}

{% endif %}
{% if ssl_metrics is defined %}
🔒
Certyfikat SSL
{{ ssl_metrics.domain if ssl_metrics.domain else 'nordabiznes.pl' }}
{% if ssl_metrics.status == 'ok' %}✓ Ważny {% elif ssl_metrics.status == 'warning' %}⚠️ Wkrótce wygasa {% else %}✗ Problem{% endif %}
{% if ssl_metrics.days_left is defined %}
{{ ssl_metrics.days_left }}
Dni do wygaśnięcia
{{ ssl_metrics.expires }}
Data wygaśnięcia
{{ ssl_metrics.issuer }}
Wystawca
{% else %}

⚠️ Nie można sprawdzić certyfikatu

{% if ssl_metrics.error %}

{{ ssl_metrics.error }}

{% endif %}
{% endif %}
{% endif %} {% if deploy_metrics is defined %}
🚀
Deploy
Git / Wersja
{% if deploy_metrics.commit %}
{{ deploy_metrics.commit }}
Aktualny commit
Branch {{ deploy_metrics.branch }}
Data commitu {{ deploy_metrics.commit_date }}
Opis {{ deploy_metrics.commit_message }}
{% else %}

Brak danych Git

{% endif %}
{% endif %} {% if security_metrics is defined %}
🛡️
Bezpieczeństwo
Ostatnie 24h
{{ security_metrics.failed_logins_24h }}
Nieudane logowania
{{ security_metrics.geoip_blocked_24h }}
Blokady GeoIP
{{ security_metrics.rate_limit_24h }}
Rate limit hits
{{ security_metrics.locked_accounts }}
Zablokowane konta
Unikalne IP zablokowane {{ security_metrics.unique_ips_blocked }}
{% endif %} {% if external_apis is defined %}
🔌
External APIs
Status połączeń
{% for api in external_apis %}
{{ api.name }} {% if api.latency %} {{ api.latency }}ms {% else %} offline {% endif %}
{% endfor %}
{% endif %}
{% if servers_status is defined %}
🖥️
Status serwerów
Ping w sieci INPI
{% for server in servers_status %}
{{ server.name }}
{{ server.ip }}
{% if server.status == 'online' %}
Online
{{ server.latency }}ms
{% else %}
Offline
{% endif %}
{% endfor %}
{% endif %}

🛠️ Stos technologiczny

💻 Programowanie

{% for tech in technology_stack.programming %}
{{ tech.icon }} {{ tech.name }} {{ tech.version }}
{% endfor %}

🗄️ Bazy danych

{% for tech in technology_stack.databases %}
{{ tech.icon }} {{ tech.name }} {{ tech.category }} {{ tech.version }}
{% endfor %}

🤖 Sztuczna inteligencja

{% for tech in technology_stack.ai %}
{{ tech.icon }} {{ tech.name }} {{ tech.category }} {{ tech.version }}
{% endfor %}

🖥️ Infrastruktura

{% for tech in technology_stack.infrastructure %}
{{ tech.icon }} {{ tech.name }} {{ tech.category }} {{ tech.version }}
{% endfor %}

🌐 Sieć

{% for tech in technology_stack.network %}
{{ tech.icon }} {{ tech.name }} {{ tech.category }} {% if tech.version %} {{ tech.version }} {% else %} nieznana {% endif %}
{% endfor %}

🛡️ Bezpieczeństwo

{% for tech in technology_stack.security %}
{{ tech.icon }} {{ tech.name }} {{ tech.category }} {{ tech.version }}
{% endfor %}

⚙️ DevOps

{% for tech in technology_stack.devops %}
{{ tech.icon }} {{ tech.name }} {{ tech.category }} {{ tech.version }}
{% endfor %}

🖥️ Serwery

{% for server in technology_stack.servers %}
{{ server.icon }} {{ server.name }} {{ server.ip }}
{{ server.role }}
{% endfor %}
{% endblock %} {% block extra_js %} // Auto-refresh every 5 minutes const REFRESH_INTERVAL = 5 * 60 * 1000; // 5 minutes in ms let countdownSeconds = 300; function updateCountdown() { const minutes = Math.floor(countdownSeconds / 60); const seconds = countdownSeconds % 60; document.getElementById('countdown').textContent = `${minutes}:${seconds.toString().padStart(2, '0')}`; if (countdownSeconds <= 0) { refreshData(); countdownSeconds = 300; } else { countdownSeconds--; } } async function refreshData() { try { const response = await fetch('/api/admin/status'); if (response.ok) { const data = await response.json(); // Update timestamp const timestamp = new Date(data.timestamp); document.getElementById('last-update').textContent = timestamp.toLocaleTimeString('pl-PL'); // Update CPU if available if (data.system && data.system.cpu_percent !== null) { const cpuEl = document.getElementById('cpu-value'); if (cpuEl) cpuEl.textContent = data.system.cpu_percent + '%'; } // Update RAM if available if (data.system && data.system.ram_percent !== null) { const ramBar = document.getElementById('ram-bar'); if (ramBar) { ramBar.style.width = data.system.ram_percent + '%'; ramBar.className = 'progress-bar-fill ' + (data.system.ram_percent < 50 ? 'low' : data.system.ram_percent < 80 ? 'medium' : 'high'); } } // Update disk if available if (data.system && data.system.disk_percent !== null) { const diskBar = document.getElementById('disk-bar'); if (diskBar) { diskBar.style.width = data.system.disk_percent + '%'; diskBar.className = 'progress-bar-fill ' + (data.system.disk_percent < 50 ? 'low' : data.system.disk_percent < 80 ? 'medium' : 'high'); } } // Update DB connections if (data.database && data.database.active_connections !== undefined) { const connEl = document.getElementById('db-connections'); if (connEl) connEl.textContent = data.database.active_connections + '/...'; } // Update alerts count if (data.app && data.app.alerts_24h !== undefined) { const alertsEl = document.getElementById('alerts-24h'); if (alertsEl) alertsEl.textContent = data.app.alerts_24h; } } } catch (error) { console.error('Failed to refresh status data:', error); } } // Start countdown setInterval(updateCountdown, 1000); // Also refresh when page becomes visible again document.addEventListener('visibilitychange', function() { if (!document.hidden) { refreshData(); countdownSeconds = 300; } }); {% endblock %}