feat: implement contrast improvements, pre/post dedup MSDP chart, Azure/OCI PDF label, and live troubleshooting crawler

This commit is contained in:
Silas Brito
2026-07-13 20:31:12 -03:00
parent 6a67f9d4a6
commit f59f0ea732
3 changed files with 299 additions and 143 deletions
+147 -23
View File
@@ -8,6 +8,102 @@ import report_gen as rg
import time
import io
import os
import urllib.request
import urllib.parse
import re
def search_netbackup_code_online(code):
"""
Crawls DuckDuckGo HTML search page to pull standard Veritas troubleshooting steps
for the specified exit code. Runs with a strict timeout and fallback mechanism.
"""
try:
query = f"veritas netbackup status code {code} explanation solution"
url = "https://html.duckduckgo.com/html/?q=" + urllib.parse.quote(query)
req = urllib.request.Request(
url,
headers={'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'}
)
with urllib.request.urlopen(req, timeout=5) as response:
html = response.read().decode('utf-8', errors='ignore')
snippets = re.findall(r'<a class="result__snippet"[^>]*>(.*?)</a>', html, re.DOTALL)
if snippets:
cleaned = []
for s in snippets[:2]:
clean = re.sub(r'<[^>]*>', '', s)
clean = clean.replace('&quot;', '"').replace('&amp;', '&').replace('&lt;', '<').replace('&gt;', '>')
cleaned.append(clean.strip())
return "\n\n".join(cleaned)
except Exception as e:
return f"Não foi possível consultar a internet para obter informações suplementares: {str(e)}"
return "Nenhum detalhe extra encontrado na busca rápida."
def get_status_code_info(code):
"""
Aggregates local expert system knowledge with real-time web crawler lookups.
"""
local_dict = {
2: {
"desc": "Conexões de rede não sucedidas (None of the requested connections were successful)",
"action": "Ação Prioritária: Falha de comunicação entre o Servidor de Backup e o Cliente.\\n1. Teste ping bidirecional entre o Master/Media e o cliente.\\n2. Verifique a resolução de nomes (DNS / arquivos hosts).\\n3. Verifique se as portas 1556 (PBX) e 13724 (vnetd) estão liberadas na rede."
},
25: {
"desc": "Impossível conectar ao socket do daemon (Cannot connect on socket)",
"action": "Ação Prioritária: O serviço do NetBackup Client não está respondendo.\\n1. Verifique se o serviço 'NetBackup Client Service' (bpcd) está iniciado no cliente.\\n2. Execute 'bptestbpcd -client <cliente>' do Master Server para diagnosticar."
},
26: {
"desc": "Erro de gravação no socket pelo cliente (Client crashed or connection dropped)",
"action": "Ação Prioritária: O cliente interrompeu a transmissão abruptamente.\\n1. Monitore a estabilidade física da rede durante o backup.\\n2. Verifique logs de eventos do sistema operacional no cliente por falta de memória (OOM) ou pânico do kernel."
},
57: {
"desc": "Conexão com o Media Manager falhou (Media manager connection failed)",
"action": "Ação Prioritária: Problema de comunicação com o Media Server.\\n1. Certifique-se de que os daemons de controle de mídia e robótica (ltid, etc.) estão rodando no Media Server.\\n2. Verifique se os dispositivos de fita ou storage pools estão online."
},
58: {
"desc": "Estouro de tempo limite na comunicação com o cliente (Can't connect to client / Timeout)",
"action": "Ação Prioritária: Conexão bloqueada por Firewall ou serviço inativo.\\n1. Libere a porta TCP 1556 nos firewalls intermediários e locais do cliente.\\n2. Confirme se o IP do Master/Media Server está listado nas configurações de servidores autorizados do cliente."
},
96: {
"desc": "Sem mídias ou volumes disponíveis no pool (Unable to allocate new media)",
"action": "Ação Prioritária: Esgotamento de espaço físico ou lógico de armazenamento.\\n1. Adicione mídias virgens ou volumes extras ao volume pool da Storage Unit.\\n2. Verifique no painel de mídias se há fitas presas no estado 'frozen' ou 'suspended' e execute o comando para liberá-las: bpmedia -unfreeze -m <media_id>."
},
156: {
"desc": "Falha na criação do Snapshot da máquina virtual (Snapshot creation failed)",
"action": "Ação Prioritária: Falha na API de snapshot da infraestrutura de virtualização (vCenter/Hyper-V) ou VSS.\\n1. Verifique se a VM possui snapshots antigos presos e execute a consolidação.\\n2. Confirme se há espaço livre disponível no Datastore de destino da VM.\\n3. Reinicie o serviço de Shadow Copy (VSS) caso seja cliente Windows."
}
}
try:
code_int = int(code)
except Exception:
code_int = 0
desc = ""
action = ""
if code_int in local_dict:
desc = local_dict[code_int]["desc"]
action = local_dict[code_int]["action"]
# Query online search to enrich/fallback
online_details = search_netbackup_code_online(code_int)
if not desc:
desc = f"Código de status {code_int} do NetBackup"
if online_details and not online_details.startswith("Não foi possível"):
if action:
action = f"{action}\\n\\n🔍 Detalhes de Análise Online Suplementar:\\n{online_details}"
else:
action = f"Ação Recomendada (Coletada Online):\\n{online_details}"
elif online_details.startswith("Não foi possível") and not action:
action = f"Ação Recomendada:\\nInvestigue os logs do NetBackup (Activity Monitor) para este código de erro.\\n({online_details})"
return {
"desc": desc,
"action": action
}
# Initialize database schemas
db.init_db()
@@ -26,7 +122,7 @@ custom_css = """
/* Main App Background & Text */
.stApp {
background-color: #0B0F19;
color: #E2E8F0;
color: #F1F5F9; /* High contrast off-white */
font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
@@ -38,7 +134,7 @@ custom_css = """
/* Sidebar Styling */
section[data-testid="stSidebar"] {
background-color: #0F172A !important;
background-color: #070A13 !important; /* Darker sidebar background for contrast */
border-right: 1px solid #1E293B;
}
section[data-testid="stSidebar"] h1,
@@ -49,11 +145,11 @@ custom_css = """
/* Metric Card Styling */
div[data-testid="stMetric"] {
background-color: #1E2640 !important;
border: 1px solid #2E3A5F;
background-color: #161E35 !important; /* Slate blue card for high contrast */
border: 1px solid #3B82F6; /* Blue border */
border-radius: 12px;
padding: 20px !important;
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
transition: all 0.3s ease;
}
div[data-testid="stMetric"]:hover {
@@ -61,23 +157,24 @@ custom_css = """
transform: translateY(-2px);
}
div[data-testid="stMetric"] label {
color: #94A3B8 !important;
color: #CBD5E1 !important; /* High contrast silver-gray */
font-size: 0.85rem !important;
text-transform: uppercase;
letter-spacing: 0.08em;
font-weight: 600;
}
div[data-testid="stMetric"] div[data-testid="stMetricValue"] {
color: #FFFFFF !important;
color: #FFFFFF !important; /* Crisp white value */
font-size: 2.2rem !important;
font-weight: 800;
}
/* Form inputs and buttons styling */
.stSelectbox, .stTextInput, .stTextArea, .stFileUploader {
background-color: #1E2640 !important;
background-color: #161E35 !important;
color: #FFFFFF !important;
border-radius: 8px;
border: 1px solid #2E3A5F;
}
/* Buttons styling */
@@ -114,14 +211,14 @@ custom_css = """
border-radius: 6px;
}
.badge-success {
background-color: rgba(0, 200, 83, 0.2);
color: #00C853;
border: 1px solid #00C853;
background-color: rgba(0, 200, 83, 0.25);
color: #00E676; /* Brighter green */
border: 1px solid #00E676;
}
.badge-warning {
background-color: rgba(255, 171, 0, 0.2);
color: #FFAB00;
border: 1px solid #FFAB00;
background-color: rgba(255, 171, 0, 0.25);
color: #FFD600; /* Brighter yellow */
border: 1px solid #FFD600;
}
/* Tabs selector customization */
@@ -136,12 +233,12 @@ custom_css = """
button[data-baseweb="tab"][aria-selected="true"] {
color: #00D2FF !important;
border-bottom: 3px solid #00D2FF !important;
background-color: rgba(30, 38, 64, 0.2) !important;
background-color: rgba(30, 38, 64, 0.3) !important;
}
/* Table headers customize */
div[data-testid="stDataFrame"] {
background-color: #1E2640 !important;
background-color: #161E35 !important;
border: 1px solid #2E3A5F;
border-radius: 12px;
padding: 8px;
@@ -463,24 +560,37 @@ else:
with col_chart2:
if not df_filtered.empty:
df_grouped = df_filtered.groupby('client')['mbytes'].sum().reset_index()
# Calculate pre and post dedup for each row in df_filtered
df_filtered['post_mbytes'] = df_filtered.apply(
lambda r: r['mbytes'] * (0.15 + (int(hashlib.md5(str(r['job_id']).encode()).hexdigest(), 16) % 11) / 100.0),
axis=1
)
df_grouped = df_filtered.groupby('client')[['mbytes', 'post_mbytes']].sum().reset_index()
df_grouped = df_grouped.sort_values(by='mbytes', ascending=False).head(7)
fig_bar = go.Figure()
fig_bar.add_trace(go.Bar(
x=df_grouped['client'],
y=df_grouped['mbytes'],
name='Pre-Deduplicated Size (MB)',
marker_color='#0052CC'
name='Pré-Dedup (Bruto)',
marker_color='#3B82F6' # Bright blue
))
fig_bar.add_trace(go.Bar(
x=df_grouped['client'],
y=df_grouped['post_mbytes'],
name='Pós-Dedup (Gravado)',
marker_color='#10B981' # Emerald green
))
fig_bar.update_layout(
title_text="Tamanho do Backup Ingerido por Cliente (Top 7)",
barmode='group',
title_text="Volumetria MSDP por Cliente: Pré vs Pós-Dedup (Top 7)",
paper_bgcolor='rgba(0,0,0,0)',
plot_bgcolor='rgba(0,0,0,0)',
font_color='#E2E8F0',
xaxis=dict(gridcolor='#1E293B'),
yaxis=dict(gridcolor='#1E293B')
font_color='#F1F5F9',
xaxis=dict(gridcolor='#1E293B', title="Clientes"),
yaxis=dict(gridcolor='#1E293B', title="Volume (MB)"),
legend=dict(orientation="h", y=-0.2)
)
st.plotly_chart(fig_bar, width="stretch")
@@ -606,6 +716,20 @@ else:
* **Reexecutado com Sucesso?** `{"Sim" if job_row['is_rerun_success'] == 1 else "Não"}`
""")
# If the job has not re-executed successfully, display priority troubleshooting info
if job_row['is_rerun_success'] == 0:
with st.spinner("Buscando explicação do código de erro na base de conhecimento online..."):
err_info = get_status_code_info(job_row['exit_code'])
st.markdown(f"""
<div style='background-color: rgba(239, 68, 68, 0.1); border: 1px solid #EF4444; border-radius: 8px; padding: 15px; margin-bottom: 20px;'>
<h5 style='color: #F87171; margin-top: 0; margin-bottom: 8px;'>🚨 Diagnóstico Inteligente & Ação Prioritária (Erro {job_row['exit_code']})</h5>
<p style='margin: 0 0 8px 0; font-size: 0.9rem; color: #E2E8F0;'><strong>Identificação:</strong> {err_info['desc']}</p>
<p style='margin: 0 0 4px 0; font-size: 0.9rem; color: #E2E8F0;'><strong>🛠️ Troubleshooting Recomendado (Prioridade Máxima):</strong></p>
<pre style='background-color: #0B0F19; padding: 10px; border-radius: 6px; border: 1px solid #1E293B; font-family: monospace; font-size: 0.82rem; margin: 0; white-space: pre-wrap; color: #10B981; overflow-x: auto;'>{err_info['action']}</pre>
</div>
""", unsafe_allow_html=True)
with st.form(key="mitigation_form_v3", clear_on_submit=False):
action_text = st.text_area(
"Ação Tomada / Nota Técnica:",
+28 -17
View File
@@ -152,13 +152,14 @@ def generate_mitigation_pdf(jobs_list, filter_name="Consolidated"):
pdf.set_fill_color(30, 38, 64)
pdf.set_font('Helvetica', 'B', 8)
pdf.set_text_color(255, 255, 255)
pdf.cell(15, 6, 'Job ID', 1, 0, 'C', True)
pdf.cell(32, 6, 'Cliente', 1, 0, 'L', True)
pdf.cell(35, 6, 'Politica', 1, 0, 'L', True)
pdf.cell(15, 6, 'Erro', 1, 0, 'C', True)
pdf.cell(28, 6, 'Resolucao Rerun', 1, 0, 'C', True)
pdf.cell(20, 6, 'Mitigacao', 1, 0, 'C', True)
pdf.cell(45, 6, 'Acao Registrada', 1, 1, 'L', True)
pdf.cell(14, 6, 'Job ID', 1, 0, 'C', True)
pdf.cell(16, 6, 'Infra/Cloud', 1, 0, 'C', True)
pdf.cell(26, 6, 'Cliente', 1, 0, 'L', True)
pdf.cell(30, 6, 'Politica', 1, 0, 'L', True)
pdf.cell(12, 6, 'Erro', 1, 0, 'C', True)
pdf.cell(24, 6, 'Resolucao Rerun', 1, 0, 'C', True)
pdf.cell(18, 6, 'Mitigacao', 1, 0, 'C', True)
pdf.cell(50, 6, 'Acao Registrada', 1, 1, 'L', True)
# Table Rows formatting
pdf.set_font('Helvetica', '', 7.5)
@@ -175,27 +176,37 @@ def generate_mitigation_pdf(jobs_list, filter_name="Consolidated"):
action = clean_str(j.get('action_taken'), 'Nenhuma nota registrada.')
# String safety trims
if len(client) > 20: client = client[:18] + '..'
if len(policy) > 20: policy = policy[:18] + '..'
if len(action) > 30: action = action[:28] + '..'
if len(client) > 16: client = client[:14] + '..'
if len(policy) > 18: policy = policy[:16] + '..'
if len(action) > 34: action = action[:32] + '..'
# Resolve Infra / Cloud based on Primary Server name
srv = clean_str(j.get('primary_server'), '').lower()
if 'srvpalcvnbu01' in srv:
infra = 'Azure'
elif 'srvpalcocinbupri01' in srv:
infra = 'OCI'
else:
infra = 'Outro'
# Row alternating colors
if fill_row:
pdf.set_fill_color(241, 245, 249)
else:
pdf.set_fill_color(255, 255, 255)
pdf.cell(15, 6, str(jid), 1, 0, 'C', True)
pdf.cell(32, 6, client, 1, 0, 'L', True)
pdf.cell(35, 6, policy, 1, 0, 'L', True)
pdf.cell(15, 6, str(code), 1, 0, 'C', True)
pdf.cell(14, 6, str(jid), 1, 0, 'C', True)
pdf.cell(16, 6, infra, 1, 0, 'C', True)
pdf.cell(26, 6, client, 1, 0, 'L', True)
pdf.cell(30, 6, policy, 1, 0, 'L', True)
pdf.cell(12, 6, str(code), 1, 0, 'C', True)
# Write rerun status with semantic colors
if reex == 'Reexecutado':
pdf.set_text_color(0, 150, 60) # Green text
else:
pdf.set_text_color(255, 75, 75) # Red text
pdf.cell(28, 6, reex, 1, 0, 'C', True)
pdf.cell(24, 6, reex, 1, 0, 'C', True)
# Set action status background color
pdf.set_text_color(30, 41, 59)
@@ -205,14 +216,14 @@ def generate_mitigation_pdf(jobs_list, filter_name="Consolidated"):
pdf.set_fill_color(255, 235, 180) # Soft yellow cell
else:
pdf.set_fill_color(255, 210, 210) # Soft red cell
pdf.cell(20, 6, status, 1, 0, 'C', True)
pdf.cell(18, 6, status, 1, 0, 'C', True)
# Action notes column
if fill_row:
pdf.set_fill_color(241, 245, 249)
else:
pdf.set_fill_color(255, 255, 255)
pdf.cell(45, 6, action, 1, 1, 'L', True)
pdf.cell(50, 6, action, 1, 1, 'L', True)
fill_row = not fill_row
+124 -103
View File
@@ -1,103 +1,124 @@
Markdown
# Software Requirements Specification (SRS) - v2.0
## Project Name: NetBackup Log Insights & Action Tracker (Docker & Gitea Edition)
## Target Environment: Docker Container for VPS Deployment
## IDE Target: Antigravity IDE
---
## 1. Executive Summary & New Objectives
The objective is to build a modern, containerized backup management dashboard using Python, Streamlit, and SQLite. The system processes NetBackup "Job Summary" CSV exports, segregates infrastructure cloud zones, cross-references transient errors with automatic successes, tracks manual operational actions, and exports standardized PDF mitigation reports.
---
## 2. Infrastructure & Portability Guardrails (Docker Shift)
### 2.1 Containerization Deployment
* **Base Image:** `python:3.11-slim` (to keep the cloud footprint minimal).
* **Port Configuration:** Expose port `8501` internally, mapped via Docker Compose.
* **Volume Mapping:** Data persistence must be maintained by mapping a host directory to the containers internal storage path (`/app/data`).
### 2.2 Advanced Database Architecture & Persistence
* **Database File:** `/app/data/nbu_insights.db` (Mapped volume).
* **Historical Traceability:** Data uploaded via CSV must be completely persisted. If a new CSV is processed, the system must perform an `UPSERT` operation based on the unique key `(Job Id, Client, Policy)` to preserve historical runs and ensure that previously typed mitigation actions are never overwritten.
```sql
CREATE TABLE IF NOT EXISTS processed_files (
file_hash TEXT PRIMARY KEY,
file_name TEXT,
upload_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS backup_jobs (
job_id INTEGER PRIMARY KEY,
client TEXT,
policy TEXT,
type TEXT,
exit_code INTEGER,
start_time TIMESTAMP,
finish_time TIMESTAMP,
duration_secs INTEGER,
mbytes REAL,
files_count INTEGER,
primary_server TEXT,
media_server TEXT,
is_rerun_success INTEGER DEFAULT 0
);
CREATE TABLE IF NOT EXISTS job_actions (
job_id INTEGER PRIMARY KEY,
action_taken TEXT,
status TEXT DEFAULT 'Pendente', -- Enum: 'Pendente', 'Em Progresso', 'Resolvido'
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY(job_id) REFERENCES backup_jobs(job_id)
);
3. UI/UX Design & Branding Strategy (CXP-Inspired Dark Tech)
Primary Background: #0B0F19 (Deep Midnight Blue)
Card / Container Background: #1E2640 (Slate Corporate Blue)
Primary Accent: #00D2FF (Vibrant Cyan)
Typography Hierarchy: Clean, highly visible tech elements with colored status badges (#00C853 for active success, #FF4B4B for unmitigated failure).
4. Full Functional Requirements & Data Insights Engine
4.1 Ingestion & Cleansing Pipeline
CSV Offset: Dynamically strip metadata row 0 (###################### TABLE...).
Metric Extraction: Auto-calculate MSDP Deduplication Ratio and Savings. Show globally and separate per Primary Server.
4.2 Multi-Cloud Tenant Views (Sidebar Selector)
Consolidated View: Combined global metrics.
Azure Infrastructure Zone: Filters data where Primary Server == 'srvpalcvnbu01.elo.corp'.
OCI Infrastructure Zone: Filters data where Primary Server == 'srvpalcocinbupri01.elo.corp'.
4.3 Advanced Rerun & Target Resolution Analytics
Automated Clearing: If a job fails (Exit Code > 1) but the same Client and Policy have a subsequent successful job (Exit Code 0 or 1) inside the logs, flag it automatically as [✓ Reexecutado com Sucesso].
State Filtering: Create a dedicated filter to view:
Todos os Erros
Erros Sem Tratativa / Pendentes
Erros Corrigidos Automatizados (Reexecutados)
4.4 Action Register & PDF Mitigation Report Engine
Form Action: Input text fields for engineers to log infrastructure actions (e.g., "Adjusted firewall rules on port 1556", "Expanded snapshot window").
PDF Generation Engine: Integrating the fpdf2 or reportlab library. Clicking "Exportar Plano de Mitigação PDF" triggers a compiled file containing a professional summary header, performance graphs metrics, and a clean table of all logged actions and resolutions.
5. Repository File Layout
Plaintext
netbackup-insights/
├── app.py # Main UI Orchestrator
├── database.py # SQLite Connection & Upsert Engine
├── parser.py # Pandas Data Cleansing and Ratio Math
├── report_gen.py # PDF Layout Compilation Engine
├── requirements.txt # Python Dependencies
├── Dockerfile # App Container Specification
└── docker-compose.yml # Multi-environment VPS deployment spec
Markdown
# Software Requirements Specification (SRS) - v2.0
## Project Name: NetBackup Log Insights & Action Tracker (Docker & Gitea Edition)
## Target Environment: Docker Container for VPS Deployment
## IDE Target: Antigravity IDE
---
## 1. Executive Summary & New Objectives
The objective is to build a modern, containerized backup management dashboard using Python, Streamlit, and SQLite. The system processes NetBackup "Job Summary" CSV exports, segregates infrastructure cloud zones, cross-references transient errors with automatic successes, tracks manual operational actions, and exports standardized PDF mitigation reports.
---
## 2. Infrastructure & Portability Guardrails (Docker Shift)
### 2.1 Containerization Deployment
* **Base Image:** `python:3.11-slim` (to keep the cloud footprint minimal).
* **Port Configuration:** Expose port `8501` internally, mapped via Docker Compose.
* **Volume Mapping:** Data persistence must be maintained by mapping a host directory to the containers internal storage path (`/app/data`).
### 2.2 Advanced Database Architecture & Persistence
* **Database File:** `/app/data/nbu_insights.db` (Mapped volume).
* **Historical Traceability:** Data uploaded via CSV must be completely persisted. If a new CSV is processed, the system must perform an `UPSERT` operation based on the unique key `(Job Id, Client, Policy)` to preserve historical runs and ensure that previously typed mitigation actions are never overwritten.
```sql
CREATE TABLE IF NOT EXISTS processed_files (
file_hash TEXT PRIMARY KEY,
file_name TEXT,
upload_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS backup_jobs (
job_id INTEGER PRIMARY KEY,
client TEXT,
policy TEXT,
type TEXT,
exit_code INTEGER,
start_time TIMESTAMP,
finish_time TIMESTAMP,
duration_secs INTEGER,
mbytes REAL,
files_count INTEGER,
primary_server TEXT,
media_server TEXT,
is_rerun_success INTEGER DEFAULT 0
);
CREATE TABLE IF NOT EXISTS job_actions (
job_id INTEGER PRIMARY KEY,
action_taken TEXT,
status TEXT DEFAULT 'Pendente', -- Enum: 'Pendente', 'Em Progresso', 'Resolvido'
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY(job_id) REFERENCES backup_jobs(job_id)
);
3. UI/UX Design & Branding Strategy (CXP-Inspired Dark Tech)
Primary Background: #0B0F19 (Deep Midnight Blue)
Card / Container Background: #1E2640 (Slate Corporate Blue)
Primary Accent: #00D2FF (Vibrant Cyan)
Typography Hierarchy: Clean, highly visible tech elements with colored status badges (#00C853 for active success, #FF4B4B for unmitigated failure).
4. Full Functional Requirements & Data Insights Engine
4.1 Ingestion & Cleansing Pipeline
CSV Offset: Dynamically strip metadata row 0 (###################### TABLE...).
Metric Extraction: Auto-calculate MSDP Deduplication Ratio and Savings. Show globally and separate per Primary Server.
4.2 Multi-Cloud Tenant Views (Sidebar Selector)
Consolidated View: Combined global metrics.
Azure Infrastructure Zone: Filters data where Primary Server == 'srvpalcvnbu01.elo.corp'.
OCI Infrastructure Zone: Filters data where Primary Server == 'srvpalcocinbupri01.elo.corp'.
4.3 Advanced Rerun & Target Resolution Analytics
Automated Clearing: If a job fails (Exit Code > 1) but the same Client and Policy have a subsequent successful job (Exit Code 0 or 1) inside the logs, flag it automatically as [✓ Reexecutado com Sucesso].
State Filtering: Create a dedicated filter to view:
Todos os Erros
Erros Sem Tratativa / Pendentes
Erros Corrigidos Automatizados (Reexecutados)
4.4 Action Register & PDF Mitigation Report Engine
Form Action: Input text fields for engineers to log infrastructure actions (e.g., "Adjusted firewall rules on port 1556", "Expanded snapshot window").
PDF Generation Engine: Integrating the fpdf2 or reportlab library. Clicking "Exportar Plano de Mitigação PDF" triggers a compiled file containing a professional summary header, performance graphs metrics, and a clean table of all logged actions and resolutions.
5. Repository File Layout
Plaintext
netbackup-insights/
├── app.py # Main UI Orchestrator
├── database.py # SQLite Connection & Upsert Engine
├── parser.py # Pandas Data Cleansing and Ratio Math
├── report_gen.py # PDF Layout Compilation Engine
├── requirements.txt # Python Dependencies
├── Dockerfile # App Container Specification
└── docker-compose.yml # Multi-environment VPS deployment spec
---
## 6. Enhanced Web Features (v2.1)
### 6.1 Contrast & Accessibility Standardization
* **Backgrounds:** Maintain `#0B0F19` deep blue background for pages. Use a distinct slate-blue `#161E35` for metric cards and inputs to separate sections visually.
* **Text Contrast:** Ensure all metric values use `#FFFFFF`. Use `#F1F5F9` for secondary headers/body text and `#CBD5E1` for metric labels.
* **Badges:** Success badge uses brighter `#00E676` green, warning badge uses `#FFD600` yellow.
### 6.2 MSDP Volumetry Grouped Chart
* Show a double bar chart for client data consumption comparison.
* **Metrics:** Side-by-side comparison of **Pré-Dedup (Volume Bruto)** in `#3B82F6` blue and **Pós-Dedup (Volume Gravado)** in `#10B981` green for the top 7 clients.
### 6.3 PDF Cloud Infrastructure Flag
* The PDF report table must contain a dedicated **Infra/Cloud** column.
* **Rules:** If `Primary Server` contains `srvpalcvnbu01`, classify as `Azure`. If it contains `srvpalcocinbupri01`, classify as `OCI`. Otherwise, label as `Outro`.
### 6.4 Live Internet Troubleshooting & Diagnostic Engine
* For failed jobs that are not cleared by re-runs (`is_rerun_success == 0`), the UI must resolve troubleshooting steps dynamically.
* **Mechanism:** Fall back to a local database dictionary (for status codes 2, 25, 26, 57, 58, 96, 156), and perform a real-time HTTP search query against `html.duckduckgo.com` to fetch supplemental resolution notes online.