feat(notifications): add Zabbix history.push provider (#1419)
* feat(notifications): add Zabbix history.push provider * test(notifications): add Zabbix provider tests
This commit is contained in:
1 parent
8f29216701
commit
7a007bd623
6 files changed
+374
-6
No files matched your search
@@ -40,6 +40,7 @@ import { sendApprise } from './apprise';
|
||||
import { sendPushover } from './pushover';
|
||||
import { sendGenericWebhook } from './generic-webhook';
|
||||
import { sendWorkflows } from './workflows';
|
||||
import { sendZabbix } from './zabbix';
|
||||
|
||||
// Send to every URL in an Apprise channel. Errors are aggregated so a single
|
||||
// bad URL doesn't silently mask a healthy one.
|
||||
@@ -110,6 +111,9 @@ async function sendToAppriseUrl(url: string, payload: NotificationPayload): Prom
|
||||
return await sendGenericWebhook(url, payload);
|
||||
case 'workflows':
|
||||
return await sendWorkflows(url, payload);
|
||||
case 'zabbix':
|
||||
case 'zabbixs':
|
||||
return await sendZabbix(url, payload);
|
||||
default:
|
||||
return { success: false, error: `Unsupported Apprise protocol: ${protocol}` };
|
||||
}
|
||||
@@ -149,7 +153,8 @@ export async function testNotification(setting: NotificationSettingData): Promis
|
||||
const payload: NotificationPayload = {
|
||||
title: 'Dockhand Test Notification',
|
||||
message: 'This is a test notification from Dockhand. If you receive this, your notification settings are configured correctly.',
|
||||
type: 'info'
|
||||
type: 'info',
|
||||
eventType: 'test'
|
||||
};
|
||||
|
||||
if (setting.type === 'smtp') {
|
||||
@@ -214,6 +219,7 @@ export async function sendEnvironmentNotification(
|
||||
|
||||
const enrichedPayload: NotificationPayload = {
|
||||
...payload,
|
||||
eventType,
|
||||
environmentId,
|
||||
environmentName: env.name
|
||||
};
|
||||
@@ -251,7 +257,10 @@ export async function sendEventNotification(
|
||||
payload: NotificationPayload,
|
||||
environmentId?: number
|
||||
): Promise<{ success: boolean; sent: number }> {
|
||||
let enrichedPayload = { ...payload };
|
||||
let enrichedPayload: NotificationPayload = {
|
||||
...payload,
|
||||
eventType
|
||||
};
|
||||
if (environmentId) {
|
||||
const env = await getEnvironment(environmentId);
|
||||
if (env) {
|
||||
|
||||
Reference in new issue
Block a user