problems: limit events in timeline

This commit is contained in:
Alexander Zobnin
2018-12-29 19:19:13 +03:00
parent 7734bcd6c0
commit 268de33d96
2 changed files with 10 additions and 3 deletions

View File

@@ -368,7 +368,7 @@ export class ZabbixAPIConnector {
return this.request('trigger.get', params);
}
getEvents(objectids, timeFrom, timeTo, showEvents) {
getEvents(objectids, timeFrom, timeTo, showEvents, limit) {
var params = {
output: 'extend',
time_from: timeFrom,
@@ -376,9 +376,15 @@ export class ZabbixAPIConnector {
objectids: objectids,
select_acknowledges: 'extend',
selectHosts: 'extend',
value: showEvents
value: showEvents,
};
if (limit) {
params.limit = limit;
params.sortfield = 'clock';
params.sortorder = 'DESC';
}
return this.request('event.get', params);
}

View File

@@ -12,6 +12,7 @@ import {migratePanelSchema, CURRENT_SCHEMA_VERSION} from './migrations';
import { ProblemList } from './components/Problems';
const ZABBIX_DS_ID = 'alexanderzobnin-zabbix-datasource';
const PROBLEM_EVENTS_LIMIT = 100;
export const DEFAULT_TARGET = {
group: {filter: ""},
@@ -470,7 +471,7 @@ export class TriggerPanelCtrl extends PanelCtrl {
const timeTo = Math.ceil(dateMath.parse(this.range.to) / 1000);
return this.datasourceSrv.get(trigger.datasource)
.then(datasource => {
return datasource.zabbix.getEvents(triggerids, timeFrom, timeTo, [0, 1]);
return datasource.zabbix.getEvents(triggerids, timeFrom, timeTo, [0, 1], PROBLEM_EVENTS_LIMIT);
});
}