notifications: add low disk space notification
This commit is contained in:
@@ -13,6 +13,7 @@ exports = module.exports = {
|
||||
oomEvent,
|
||||
rebootRequired,
|
||||
boxUpdateError,
|
||||
lowDiskSpace,
|
||||
|
||||
sendTestMail,
|
||||
|
||||
@@ -279,6 +280,22 @@ async function rebootRequired(mailTo) {
|
||||
await sendMail(mailOptions);
|
||||
}
|
||||
|
||||
async function lowDiskSpace(mailTo, message) {
|
||||
assert.strictEqual(typeof mailTo, 'string');
|
||||
assert.strictEqual(typeof message, 'string');
|
||||
|
||||
const mailConfig = await getMailConfig();
|
||||
|
||||
const mailOptions = {
|
||||
from: mailConfig.notificationFrom,
|
||||
to: mailTo,
|
||||
subject: `[${mailConfig.cloudronName}] Server is running low on disk space`,
|
||||
text: render('low_disk_space-text.ejs', { message, notificationsUrl: mailConfig.notificationsUrl })
|
||||
};
|
||||
|
||||
await sendMail(mailOptions);
|
||||
}
|
||||
|
||||
async function boxUpdateError(mailTo, message) {
|
||||
assert.strictEqual(typeof mailTo, 'string');
|
||||
assert.strictEqual(typeof message, 'string');
|
||||
|
||||
Reference in New Issue
Block a user