From 6f56e61b043137821d9fb50bbdd1bcde774c6856 Mon Sep 17 00:00:00 2001 From: Marius Date: Fri, 10 Oct 2025 17:41:33 +0300 Subject: [PATCH] Oracle DR: Fix Gmail compatibility with plain text email templates - Convert complex HTML/CSS templates to plain text format for Gmail compatibility - Replace decorative characters (box drawing, special symbols) with simple text - Use single-line bullet points instead of complex table layouts - Improve readability across all email clients (Gmail, Outlook, mobile) - Remove HTML templates completely, use only text format - Keep informative structure with clear section separators - Both text and HTML templates now identical for consistency - Critical for Gmail users who only see plain text formatting New format works perfectly in Gmail: Oracle Backup WARNING - pveelite WARNING ======================================== WARNINGS: - FULL backup is 51 hours old (threshold: 25) ======================================== BACKUP STATUS: FULL: 51h old TOO OLD (limit: 25h) CUMULATIVE: 4h old OK (limit: 7h) Total: 12 files | Size: 6.3GB | Disk: 2% ======================================== Next check: 2025-10-10 + 24h | Proxmox Monitoring Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> --- .../oracle-backup-monitor-proxmox.sh | 171 ++++++------------ .../weekly-dr-test-proxmox.sh | 102 ++++++----- 2 files changed, 104 insertions(+), 169 deletions(-) diff --git a/oracle/standby-server-scripts/oracle-backup-monitor-proxmox.sh b/oracle/standby-server-scripts/oracle-backup-monitor-proxmox.sh index d546a9d..61c2f00 100644 --- a/oracle/standby-server-scripts/oracle-backup-monitor-proxmox.sh +++ b/oracle/standby-server-scripts/oracle-backup-monitor-proxmox.sh @@ -51,144 +51,76 @@ EOF # Text body template cat > "$TEMPLATE_DIR/oracle-backup-body.txt.hbs" <<'EOF' -Oracle Backup Monitoring Alert -============================== -Severity: {{severity}} -Hostname: {{node}} -Date: {{date}} -Status: {{status}} +Oracle Backup {{severity}} - {{node}} +{{status}} +======================================== {{#if errors}} -ERRORS: +CRITICAL ISSUES: {{#each errors}} - - {{this}} +- {{this}} {{/each}} {{/if}} {{#if warnings}} WARNINGS: {{#each warnings}} - - {{this}} +- {{this}} {{/each}} {{/if}} -Backup Details: -- Total Backups: {{total_backups}} -- Total Size: {{total_size_gb}} GB -- FULL Backup Age: {{full_backup_age}} hours -- CUMULATIVE Backup Age: {{cumulative_backup_age}} hours -- Disk Usage: {{disk_usage}}% +======================================== +BACKUP STATUS: +FULL: {{full_backup_age}}h old {{#if full_backup_ok}}OK{{else}}TOO OLD{{/if}} (limit: 25h) +CUMULATIVE: {{cumulative_backup_age}}h old {{#if cumulative_backup_ok}}OK{{else}}TOO OLD{{/if}} (limit: 7h) +Total: {{total_backups}} files | Size: {{total_size_gb}}GB | Disk: {{disk_usage}}% {{#if backup_list}} -Recent Backups: +LATEST BACKUPS (last 5): {{#each backup_list}} - {{this}} +- {{this}} {{/each}} {{/if}} + +======================================== +Next check: {{date}} + 24h | Proxmox Monitoring EOF - # HTML body template + # HTML body template (identical to text for compatibility) cat > "$TEMPLATE_DIR/oracle-backup-body.html.hbs" <<'EOF' - - - - - - -
-

Oracle Backup {{severity}}

-

{{node}} - {{date}}

-
+Oracle Backup {{severity}} - {{node}} +{{status}} -
-

Status: {{status}}

+======================================== +{{#if errors}} +CRITICAL ISSUES: +{{#each errors}} +- {{this}} +{{/each}} +{{/if}} - {{#if errors}} -
-

Errors:

-
    - {{#each errors}} -
  • {{this}}
  • - {{/each}} -
-
- {{/if}} +{{#if warnings}} +WARNINGS: +{{#each warnings}} +- {{this}} +{{/each}} +{{/if}} - {{#if warnings}} -
-

Warnings:

-
    - {{#each warnings}} -
  • {{this}}
  • - {{/each}} -
-
- {{/if}} -
+======================================== +BACKUP STATUS: +FULL: {{full_backup_age}}h old {{#if full_backup_ok}}OK{{else}}TOO OLD{{/if}} (limit: 25h) +CUMULATIVE: {{cumulative_backup_age}}h old {{#if cumulative_backup_ok}}OK{{else}}TOO OLD{{/if}} (limit: 7h) +Total: {{total_backups}} files | Size: {{total_size_gb}}GB | Disk: {{disk_usage}}% -
-

Backup Metrics

-
-
-
Total Backups
-
{{total_backups}}
-
-
-
Total Size
-
{{total_size_gb}} GB
-
-
-
Disk Usage
-
{{disk_usage}}%
-
-
+{{#if backup_list}} +LATEST BACKUPS (last 5): +{{#each backup_list}} +- {{this}} +{{/each}} +{{/if}} - - - - - - - - - - - - - - - - -
Backup TypeAge (hours)Status
FULL{{full_backup_age}}{{#if full_backup_ok}}✓ OK{{else}}✗ Too Old{{/if}}
CUMULATIVE{{cumulative_backup_age}}{{#if cumulative_backup_ok}}✓ OK{{else}}⚠ Check{{/if}}
-
- - {{#if backup_list}} -
-

Recent Backups

-
{{#each backup_list}}{{this}}
-{{/each}}
-
- {{/if}} - - +======================================== +Next check: {{date}} + 24h | Proxmox Monitoring EOF echo -e "${GREEN}Templates created successfully in $TEMPLATE_DIR${NC}" @@ -288,7 +220,7 @@ check_backups() { fi # Check CUMULATIVE backup age - local latest_cumulative=$(ls -t "$BACKUP_PATH"/*INCR*.BKP "$BACKUP_PATH"/*CUMULATIVE*.BKP 2>/dev/null | head -1 || echo "") + local latest_cumulative=$(ls -t "$BACKUP_PATH"/*INCR*.BKP "$BACKUP_PATH"/*INCREMENTAL*.BKP "$BACKUP_PATH"/*CUMULATIVE*.BKP 2>/dev/null | head -1 || echo "") local cumulative_age_hours="N/A" local cumulative_backup_ok=false @@ -330,7 +262,6 @@ check_backups() { local json_data=$(cat < "$TEMPLATE_DIR/oracle-dr-test-body.txt.hbs" <<'EOF' -Oracle DR Weekly Test Report -============================ -Test Result: {{test_result}} -Severity: {{severity}} -Date: {{date}} -Duration: {{total_duration}} minutes +Oracle DR Test {{severity}} - {{test_result}} +{{#if is_success}}TEST PASSED✓{{else}}TEST FAILED✗{{/if}} -{{#if is_success}} -✓ TEST PASSED SUCCESSFULLY -{{else}} -✗ TEST FAILED -{{/if}} +======================================== +SUMMARY: Duration {{total_duration}}min | Tables {{tables_restored}} | Backups {{backup_count}} -Test Steps Summary: -------------------- +TEST STEPS: {{#each test_steps}} -{{#if this.passed}}✓{{else}}✗{{/if}} {{this.name}}: {{this.status}} ({{this.duration}}s) +- {{#if this.passed}}PASS{{else}}FAIL{{/if}}: {{this.name}} ({{this.duration}}s) +{{#if this.details}} + Details: {{this.details}} {{/each}} +======================================== +COMPONENT STATUS: +DR VM: ID {{vm_id}} ({{vm_ip}}) - {{vm_status}} +NFS Mount: {{nfs_status}} - {{#if nfs_ok}}OK{{else}}FAILED{{/if}} +Database: {{database_status}} - {{#if database_ok}}OK{{else}}FAILED{{/if}} +Disk Space: {{disk_freed}}GB freed - OK + {{#if errors}} ERRORS: {{#each errors}} - - {{this}} +- {{this}} {{/each}} {{/if}} -{{#if warnings}} -WARNINGS: -{{#each warnings}} - - {{this}} -{{/each}} -{{/if}} - -Metrics: --------- -- Backup Count: {{backup_count}} -- Restore Time: {{restore_duration}} minutes -- Tables Restored: {{tables_restored}} -- Database Status: {{database_status}} -- Disk Space Freed: {{disk_freed}} GB - -VM Details: ------------ -- VM ID: {{vm_id}} -- VM IP: {{vm_ip}} -- NFS Mount: {{nfs_status}} - -Log File: {{log_file}} +======================================== +Log: {{log_file}} +Next scheduled test: Next Saturday 06:00 +Proxmox DR Monitoring System EOF - # HTML body template + # HTML body template (identical to text for compatibility) cat > "$TEMPLATE_DIR/oracle-dr-test-body.html.hbs" <<'EOF' - - - -