Add tags filter to triggers query

This commit is contained in:
Alexander Zobnin
2023-08-01 17:41:25 +02:00
parent 4534679e65
commit 4373ef8667
2 changed files with 19 additions and 1 deletions

View File

@@ -715,7 +715,7 @@ export class ZabbixAPIConnector {
}
async getHostAlerts(hostids, applicationids, options): Promise<ZBXTrigger[]> {
const { minSeverity, acknowledged, count, timeFrom, timeTo } = options;
const { minSeverity, acknowledged, tags, count, timeFrom, timeTo } = options;
const params: any = {
output: 'extend',
hostids: hostids,
@@ -747,6 +747,11 @@ export class ZabbixAPIConnector {
params.lastChangeTill = timeTo;
}
if (tags) {
params.tags = tags;
params.evaltype = 0;
}
let triggers = await this.request('trigger.get', params);
if (!count || acknowledged === 1) {
triggers = filterTriggersByAcknowledge(triggers, acknowledged);