Notifications Guide · PVE 9 · Web GUI

Cấu hình Email & Thông báo
trên Proxmox VE 9

Nhận cảnh báo backup lỗi, node/OSD down, update, replication qua email. Dùng framework Notifications mới của PVE 9: Target + Matcher. Thao tác toàn bộ trên Web GUI.

4
Bước
SMTP
Target
Matcher
Định tuyến
~15m
Thiết lập

Framework Notifications của PVE 9

Từ Proxmox VE 8.1, việc gửi thông báo được làm lại theo mô hình 2 khối, thay cho cách cũ (chỉ điền email + relay postfix). Hiểu 2 khái niệm này là xong:

graph LR EV["🔔 Sự kiện
backup / update / fencing
replication / Ceph health"] --> M{"Matcher
(luật định tuyến)"} M -->|khớp| T1["Target: SMTP
(Gmail / O365)"] M -->|khớp| T2["Target: Gotify
(push app)"] M -->|khớp| T3["Target: mail-to-root
(sendmail nội bộ)"] T1 --> IN["📧 Hộp thư admin"] style M fill:#ccfbf1,stroke:#0d9488,stroke-width:2px style T1 fill:#d1fae5,stroke:#059669 style IN fill:#bbf7d0,stroke:#16a34a,stroke-width:2px

Notification Target

Nơi gửi thông báo đến: SMTP (mail server), Gotify (push), hoặc Sendmail/mail-to-root (mặc định, dùng MTA nội bộ).

Notification Matcher

Luật quyết định sự kiện nào → target nào (lọc theo severity, loại sự kiện, thời gian). Mặc định có matcher gửi mọi thứ tới mail-to-root.

B-1

Đặt email cho user root

~1 phút

Nhiều thông báo mặc định gửi tới email của root@pam. Đặt địa chỉ nhận trước:

1

Datacenter → Permissions → Users

Chọn root@pamEdit → điền E-Mail nhận cảnh báo → OK.

B-2

Tạo SMTP Target

~5 phút — gửi mail qua Gmail / Office 365 / SMTP nội bộ

1

Datacenter → Notifications → Add → SMTP

Điền các trường theo bảng dưới (ví dụ Gmail):

Trường Giá trị (ví dụ Gmail)
Endpoint Namesmtp-gmail
Serversmtp.gmail.com
Encryption / PortSTARTTLS · 587 (hoặc TLS · 465)
Username[email protected]
PasswordApp Password (16 ký tự) — KHÔNG dùng mật khẩu thường
From Address[email protected]
Recipient(s)email nhận, hoặc chọn user có sẵn email (root)

Gmail / Office 365 cần App Password

Bật 2FA cho tài khoản → tạo App Password riêng cho Proxmox. Dùng mật khẩu thường sẽ bị nhà cung cấp chặn đăng nhập SMTP.

B-3

Test gửi thử

~1 phút — xác nhận trước khi tin tưởng

1

Notifications → chọn target → Test

Bấm Test → kiểm tra hộp thư (cả Spam). Nhận được là target OK.

# Hoặc test bằng CLI proxmox-mail-forward --version # kiểm tra dịch vụ # gửi test qua target tên smtp-gmail: pvesh create /cluster/notifications/endpoints/smtp/smtp-gmail/test
B-4

Tạo Matcher — định tuyến sự kiện

~5 phút — chỉ gửi cái cần, tránh spam hộp thư

1

Notifications → Add → Matcher

  • Target to notify: chọn smtp-gmail
  • Match Rules: ví dụ Severity ≥ warning (chỉ gửi cảnh báo/lỗi), hoặc Field type = vzdump (chỉ báo backup)
  • Match: All / Any nếu có nhiều luật

Mẹo lọc thông minh

  • Backup hằng đêm nhiều VM → chỉ gửi khi severity = error để khỏi ngập mail.
  • Có thể sửa matcher mặc định (mail-to-root) hoặc tắt nếu không dùng MTA nội bộ.
  • Job backup còn có ô "Notification mode" riêng — để "use global settings" cho đồng nhất.

Tùy chọn khác

Gotify (push)

Muốn nhận push realtime lên điện thoại: Add → Gotify → nhập Server URL + App Token. Không cần SMTP.

mail-to-root + relay

Nếu vẫn muốn dùng sendmail nội bộ, cấu hình postfix relay tới smart host trong /etc/postfix/main.cf. SMTP target ở trên đơn giản hơn nên khuyến nghị.

Troubleshooting

Triệu chứng Nguyên nhân & xử lý
Test fail: authenticationSai App Password / chưa bật 2FA → tạo lại App Password
Không nhận được mailKiểm tra Spam; sai From/Recipient; matcher không khớp sự kiện
TLS/SSL handshake errorSai cổng/encryption (587=STARTTLS, 465=TLS)
Nhận quá nhiều mailSiết matcher theo severity=error hoặc theo loại sự kiện
Xem log gửi mailjournalctl -u pvescheduler -e · journalctl -t postfix

Bài liên quan