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>
This commit is contained in:
@@ -51,15 +51,12 @@ EOF
|
|||||||
|
|
||||||
# Text body template
|
# Text body template
|
||||||
cat > "$TEMPLATE_DIR/oracle-backup-body.txt.hbs" <<'EOF'
|
cat > "$TEMPLATE_DIR/oracle-backup-body.txt.hbs" <<'EOF'
|
||||||
Oracle Backup Monitoring Alert
|
Oracle Backup {{severity}} - {{node}}
|
||||||
==============================
|
{{status}}
|
||||||
Severity: {{severity}}
|
|
||||||
Hostname: {{node}}
|
|
||||||
Date: {{date}}
|
|
||||||
Status: {{status}}
|
|
||||||
|
|
||||||
|
========================================
|
||||||
{{#if errors}}
|
{{#if errors}}
|
||||||
ERRORS:
|
CRITICAL ISSUES:
|
||||||
{{#each errors}}
|
{{#each errors}}
|
||||||
- {{this}}
|
- {{this}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
@@ -72,123 +69,58 @@ WARNINGS:
|
|||||||
{{/each}}
|
{{/each}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
Backup Details:
|
========================================
|
||||||
- Total Backups: {{total_backups}}
|
BACKUP STATUS:
|
||||||
- Total Size: {{total_size_gb}} GB
|
FULL: {{full_backup_age}}h old {{#if full_backup_ok}}OK{{else}}TOO OLD{{/if}} (limit: 25h)
|
||||||
- FULL Backup Age: {{full_backup_age}} hours
|
CUMULATIVE: {{cumulative_backup_age}}h old {{#if cumulative_backup_ok}}OK{{else}}TOO OLD{{/if}} (limit: 7h)
|
||||||
- CUMULATIVE Backup Age: {{cumulative_backup_age}} hours
|
Total: {{total_backups}} files | Size: {{total_size_gb}}GB | Disk: {{disk_usage}}%
|
||||||
- Disk Usage: {{disk_usage}}%
|
|
||||||
|
|
||||||
{{#if backup_list}}
|
{{#if backup_list}}
|
||||||
Recent Backups:
|
LATEST BACKUPS (last 5):
|
||||||
{{#each backup_list}}
|
{{#each backup_list}}
|
||||||
{{this}}
|
- {{this}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
========================================
|
||||||
|
Next check: {{date}} + 24h | Proxmox Monitoring
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# HTML body template
|
# HTML body template (identical to text for compatibility)
|
||||||
cat > "$TEMPLATE_DIR/oracle-backup-body.html.hbs" <<'EOF'
|
cat > "$TEMPLATE_DIR/oracle-backup-body.html.hbs" <<'EOF'
|
||||||
<!DOCTYPE html>
|
Oracle Backup {{severity}} - {{node}}
|
||||||
<html>
|
{{status}}
|
||||||
<head>
|
|
||||||
<style>
|
|
||||||
body { font-family: Arial, sans-serif; }
|
|
||||||
.header {
|
|
||||||
background-color: {{#if is_error}}#dc3545{{else}}{{#if is_warning}}#ffc107{{else}}#28a745{{/if}}{{/if}};
|
|
||||||
color: white;
|
|
||||||
padding: 10px;
|
|
||||||
border-radius: 5px;
|
|
||||||
}
|
|
||||||
.section { margin: 20px 0; padding: 10px; background-color: #f8f9fa; border-radius: 5px; }
|
|
||||||
.error { color: #dc3545; font-weight: bold; }
|
|
||||||
.warning { color: #ffc107; font-weight: bold; }
|
|
||||||
.success { color: #28a745; }
|
|
||||||
table { width: 100%; border-collapse: collapse; margin: 10px 0; }
|
|
||||||
th, td { padding: 8px; text-align: left; border-bottom: 1px solid #dee2e6; }
|
|
||||||
th { background-color: #e9ecef; }
|
|
||||||
.metric { display: inline-block; margin: 10px 20px 10px 0; }
|
|
||||||
.metric-label { font-size: 0.9em; color: #6c757d; }
|
|
||||||
.metric-value { font-size: 1.5em; font-weight: bold; }
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="header">
|
|
||||||
<h2>Oracle Backup {{severity}}</h2>
|
|
||||||
<p>{{node}} - {{date}}</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="section">
|
|
||||||
<h3>Status: <span class="{{#if is_error}}error{{else}}{{#if is_warning}}warning{{else}}success{{/if}}{{/if}}">{{status}}</span></h3>
|
|
||||||
|
|
||||||
|
========================================
|
||||||
{{#if errors}}
|
{{#if errors}}
|
||||||
<div class="error">
|
CRITICAL ISSUES:
|
||||||
<h4>Errors:</h4>
|
|
||||||
<ul>
|
|
||||||
{{#each errors}}
|
{{#each errors}}
|
||||||
<li>{{this}}</li>
|
- {{this}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if warnings}}
|
{{#if warnings}}
|
||||||
<div class="warning">
|
WARNINGS:
|
||||||
<h4>Warnings:</h4>
|
|
||||||
<ul>
|
|
||||||
{{#each warnings}}
|
{{#each warnings}}
|
||||||
<li>{{this}}</li>
|
- {{this}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="section">
|
========================================
|
||||||
<h3>Backup Metrics</h3>
|
BACKUP STATUS:
|
||||||
<div>
|
FULL: {{full_backup_age}}h old {{#if full_backup_ok}}OK{{else}}TOO OLD{{/if}} (limit: 25h)
|
||||||
<div class="metric">
|
CUMULATIVE: {{cumulative_backup_age}}h old {{#if cumulative_backup_ok}}OK{{else}}TOO OLD{{/if}} (limit: 7h)
|
||||||
<div class="metric-label">Total Backups</div>
|
Total: {{total_backups}} files | Size: {{total_size_gb}}GB | Disk: {{disk_usage}}%
|
||||||
<div class="metric-value">{{total_backups}}</div>
|
|
||||||
</div>
|
|
||||||
<div class="metric">
|
|
||||||
<div class="metric-label">Total Size</div>
|
|
||||||
<div class="metric-value">{{total_size_gb}} GB</div>
|
|
||||||
</div>
|
|
||||||
<div class="metric">
|
|
||||||
<div class="metric-label">Disk Usage</div>
|
|
||||||
<div class="metric-value">{{disk_usage}}%</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<th>Backup Type</th>
|
|
||||||
<th>Age (hours)</th>
|
|
||||||
<th>Status</th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>FULL</td>
|
|
||||||
<td>{{full_backup_age}}</td>
|
|
||||||
<td>{{#if full_backup_ok}}<span class="success">✓ OK</span>{{else}}<span class="error">✗ Too Old</span>{{/if}}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>CUMULATIVE</td>
|
|
||||||
<td>{{cumulative_backup_age}}</td>
|
|
||||||
<td>{{#if cumulative_backup_ok}}<span class="success">✓ OK</span>{{else}}<span class="warning">⚠ Check</span>{{/if}}</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{#if backup_list}}
|
{{#if backup_list}}
|
||||||
<div class="section">
|
LATEST BACKUPS (last 5):
|
||||||
<h3>Recent Backups</h3>
|
{{#each backup_list}}
|
||||||
<pre style="background-color: #f8f9fa; padding: 10px; overflow-x: auto;">{{#each backup_list}}{{this}}
|
- {{this}}
|
||||||
{{/each}}</pre>
|
{{/each}}
|
||||||
</div>
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</body>
|
|
||||||
</html>
|
========================================
|
||||||
|
Next check: {{date}} + 24h | Proxmox Monitoring
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
echo -e "${GREEN}Templates created successfully in $TEMPLATE_DIR${NC}"
|
echo -e "${GREEN}Templates created successfully in $TEMPLATE_DIR${NC}"
|
||||||
@@ -288,7 +220,7 @@ check_backups() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Check CUMULATIVE backup age
|
# 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_age_hours="N/A"
|
||||||
local cumulative_backup_ok=false
|
local cumulative_backup_ok=false
|
||||||
|
|
||||||
@@ -330,7 +262,6 @@ check_backups() {
|
|||||||
local json_data=$(cat <<JSON
|
local json_data=$(cat <<JSON
|
||||||
{
|
{
|
||||||
"severity": "$severity",
|
"severity": "$severity",
|
||||||
"hostname": "$(hostname)",
|
|
||||||
"node": "$(hostname)",
|
"node": "$(hostname)",
|
||||||
"date": "$(date +'%Y-%m-%d %H:%M:%S')",
|
"date": "$(date +'%Y-%m-%d %H:%M:%S')",
|
||||||
"status": "$status",
|
"status": "$status",
|
||||||
@@ -338,11 +269,11 @@ check_backups() {
|
|||||||
"warnings": $warnings_json,
|
"warnings": $warnings_json,
|
||||||
"total_backups": $total_backups,
|
"total_backups": $total_backups,
|
||||||
"total_size_gb": "${total_size%G}",
|
"total_size_gb": "${total_size%G}",
|
||||||
"full_backup_age": "$full_age_hours",
|
"full_backup_age": "${full_age_hours}",
|
||||||
"cumulative_backup_age": "$cumulative_age_hours",
|
"cumulative_backup_age": "${cumulative_age_hours}",
|
||||||
"disk_usage": "$disk_usage",
|
"disk_usage": "${disk_usage}",
|
||||||
"full_backup_ok": $full_backup_ok,
|
"full_backup_ok": $([ "$full_backup_ok" = "true" ] && echo "true" || echo "false"),
|
||||||
"cumulative_backup_ok": $cumulative_backup_ok,
|
"cumulative_backup_ok": $([ "$cumulative_backup_ok" = "true" ] && echo "true" || echo "false"),
|
||||||
"is_error": $([ "$status" = "ERROR" ] && echo "true" || echo "false"),
|
"is_error": $([ "$status" = "ERROR" ] && echo "true" || echo "false"),
|
||||||
"is_warning": $([ "$status" = "WARNING" ] && echo "true" || echo "false"),
|
"is_warning": $([ "$status" = "WARNING" ] && echo "true" || echo "false"),
|
||||||
"backup_list": $backup_list_json
|
"backup_list": $backup_list_json
|
||||||
|
|||||||
@@ -56,25 +56,26 @@ EOF
|
|||||||
|
|
||||||
# Text body template
|
# Text body template
|
||||||
cat > "$TEMPLATE_DIR/oracle-dr-test-body.txt.hbs" <<'EOF'
|
cat > "$TEMPLATE_DIR/oracle-dr-test-body.txt.hbs" <<'EOF'
|
||||||
Oracle DR Weekly Test Report
|
Oracle DR Test {{severity}} - {{test_result}}
|
||||||
============================
|
{{#if is_success}}TEST PASSED✓{{else}}TEST FAILED✗{{/if}}
|
||||||
Test Result: {{test_result}}
|
|
||||||
Severity: {{severity}}
|
|
||||||
Date: {{date}}
|
|
||||||
Duration: {{total_duration}} minutes
|
|
||||||
|
|
||||||
{{#if is_success}}
|
========================================
|
||||||
✓ TEST PASSED SUCCESSFULLY
|
SUMMARY: Duration {{total_duration}}min | Tables {{tables_restored}} | Backups {{backup_count}}
|
||||||
{{else}}
|
|
||||||
✗ TEST FAILED
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
Test Steps Summary:
|
TEST STEPS:
|
||||||
-------------------
|
|
||||||
{{#each 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}}
|
{{/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}}
|
{{#if errors}}
|
||||||
ERRORS:
|
ERRORS:
|
||||||
{{#each errors}}
|
{{#each errors}}
|
||||||
@@ -82,43 +83,46 @@ ERRORS:
|
|||||||
{{/each}}
|
{{/each}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if warnings}}
|
========================================
|
||||||
WARNINGS:
|
Log: {{log_file}}
|
||||||
{{#each warnings}}
|
Next scheduled test: Next Saturday 06:00
|
||||||
|
Proxmox DR Monitoring System
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# HTML body template (identical to text for compatibility)
|
||||||
|
cat > "$TEMPLATE_DIR/oracle-dr-test-body.html.hbs" <<'EOF'
|
||||||
|
Oracle DR Test {{severity}} - {{test_result}}
|
||||||
|
{{#if is_success}}TEST PASSED✓{{else}}TEST FAILED✗{{/if}}
|
||||||
|
|
||||||
|
========================================
|
||||||
|
SUMMARY: Duration {{total_duration}}min | Tables {{tables_restored}} | Backups {{backup_count}}
|
||||||
|
|
||||||
|
TEST STEPS:
|
||||||
|
{{#each test_steps}}
|
||||||
|
- {{#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}}
|
{{/each}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
Metrics:
|
========================================
|
||||||
--------
|
Log: {{log_file}}
|
||||||
- Backup Count: {{backup_count}}
|
Next scheduled test: Next Saturday 06:00
|
||||||
- Restore Time: {{restore_duration}} minutes
|
Proxmox DR Monitoring System
|
||||||
- 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}}
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# HTML body template
|
|
||||||
cat > "$TEMPLATE_DIR/oracle-dr-test-body.html.hbs" <<'EOF'
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<style>
|
|
||||||
body { font-family: Arial, sans-serif; }
|
|
||||||
.header {
|
|
||||||
background-color: {{#if is_success}}#28a745{{else}}#dc3545{{/if}};
|
|
||||||
color: white;
|
|
||||||
padding: 15px;
|
|
||||||
border-radius: 5px;
|
|
||||||
}
|
|
||||||
.section {
|
.section {
|
||||||
margin: 20px 0;
|
margin: 20px 0;
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
|
|||||||
Reference in New Issue
Block a user