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,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'
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<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>
|
||||
Oracle Backup {{severity}} - {{node}}
|
||||
{{status}}
|
||||
|
||||
<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}}
|
||||
CRITICAL ISSUES:
|
||||
{{#each errors}}
|
||||
- {{this}}
|
||||
{{/each}}
|
||||
{{/if}}
|
||||
|
||||
{{#if errors}}
|
||||
<div class="error">
|
||||
<h4>Errors:</h4>
|
||||
<ul>
|
||||
{{#each errors}}
|
||||
<li>{{this}}</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{#if warnings}}
|
||||
WARNINGS:
|
||||
{{#each warnings}}
|
||||
- {{this}}
|
||||
{{/each}}
|
||||
{{/if}}
|
||||
|
||||
{{#if warnings}}
|
||||
<div class="warning">
|
||||
<h4>Warnings:</h4>
|
||||
<ul>
|
||||
{{#each warnings}}
|
||||
<li>{{this}}</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
========================================
|
||||
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}}%
|
||||
|
||||
<div class="section">
|
||||
<h3>Backup Metrics</h3>
|
||||
<div>
|
||||
<div class="metric">
|
||||
<div class="metric-label">Total Backups</div>
|
||||
<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>
|
||||
{{#if backup_list}}
|
||||
LATEST BACKUPS (last 5):
|
||||
{{#each backup_list}}
|
||||
- {{this}}
|
||||
{{/each}}
|
||||
{{/if}}
|
||||
|
||||
<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}}
|
||||
<div class="section">
|
||||
<h3>Recent Backups</h3>
|
||||
<pre style="background-color: #f8f9fa; padding: 10px; overflow-x: auto;">{{#each backup_list}}{{this}}
|
||||
{{/each}}</pre>
|
||||
</div>
|
||||
{{/if}}
|
||||
</body>
|
||||
</html>
|
||||
========================================
|
||||
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 <<JSON
|
||||
{
|
||||
"severity": "$severity",
|
||||
"hostname": "$(hostname)",
|
||||
"node": "$(hostname)",
|
||||
"date": "$(date +'%Y-%m-%d %H:%M:%S')",
|
||||
"status": "$status",
|
||||
@@ -338,11 +269,11 @@ check_backups() {
|
||||
"warnings": $warnings_json,
|
||||
"total_backups": $total_backups,
|
||||
"total_size_gb": "${total_size%G}",
|
||||
"full_backup_age": "$full_age_hours",
|
||||
"cumulative_backup_age": "$cumulative_age_hours",
|
||||
"disk_usage": "$disk_usage",
|
||||
"full_backup_ok": $full_backup_ok,
|
||||
"cumulative_backup_ok": $cumulative_backup_ok,
|
||||
"full_backup_age": "${full_age_hours}",
|
||||
"cumulative_backup_age": "${cumulative_age_hours}",
|
||||
"disk_usage": "${disk_usage}",
|
||||
"full_backup_ok": $([ "$full_backup_ok" = "true" ] && echo "true" || echo "false"),
|
||||
"cumulative_backup_ok": $([ "$cumulative_backup_ok" = "true" ] && echo "true" || echo "false"),
|
||||
"is_error": $([ "$status" = "ERROR" ] && echo "true" || echo "false"),
|
||||
"is_warning": $([ "$status" = "WARNING" ] && echo "true" || echo "false"),
|
||||
"backup_list": $backup_list_json
|
||||
|
||||
Reference in New Issue
Block a user