Skip to content

Commit

Permalink
Fix also select acknowledges key
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanahuckova committed Dec 12, 2024
1 parent cd0eccb commit 53d56d1
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -622,10 +622,10 @@ export class ZabbixAPIConnector {
time_from: timeFrom,
time_till: timeTo,
objectids: objectids,
select_acknowledges: 'extend',
selectHosts: 'extend',
value: showEvents,
};
params[getSelectAcknowledgesKey(this.version)] = 'extend';

if (limit) {
params.limit = limit;
Expand All @@ -649,13 +649,13 @@ export class ZabbixAPIConnector {
evaltype: '0',
sortfield: ['eventid'],
sortorder: 'DESC',
select_acknowledges: 'extend',
selectTags: 'extend',
selectSuppressionData: ['maintenanceid', 'suppress_until'],
groupids,
hostids,
applicationids,
};
params[getSelectAcknowledgesKey(this.version)] = 'extend';

if (limit) {
params.limit = limit;
Expand Down Expand Up @@ -685,12 +685,13 @@ export class ZabbixAPIConnector {
output: 'extend',
eventids: eventids,
preservekeys: true,
select_acknowledges: 'extend',
selectTags: 'extend',
sortfield: 'clock',
sortorder: 'DESC',
};

params[getSelectAcknowledgesKey(this.version)] = 'extend';

return this.request('event.get', params);
}

Expand All @@ -709,10 +710,10 @@ export class ZabbixAPIConnector {
output: 'extend',
eventids: eventids,
preservekeys: true,
select_acknowledges: 'extend',
sortfield: 'clock',
sortorder: 'DESC',
};
params[getSelectAcknowledgesKey(this.version)] = 'extend';

return this.request('event.get', params).then((events) => {
return _.filter(events, (event) => event.acknowledges.length);
Expand Down Expand Up @@ -986,3 +987,7 @@ export class ZabbixAPIError {
return this.name + ' ' + this.data;
}
}

function getSelectAcknowledgesKey(version: string) {
return semver.gte(version, '7.0.0') ? 'selectAcknowledges' : 'select_acknowledges';
}

0 comments on commit 53d56d1

Please sign in to comment.