@@ -128,8 +128,10 @@ export function addTriggerHostProxy(triggers, proxies) {
|
||||
triggers.forEach((trigger) => {
|
||||
if (trigger.hosts && trigger.hosts.length) {
|
||||
const host = trigger.hosts[0];
|
||||
if (host.proxy_hostid !== '0') {
|
||||
const hostProxy = proxies[host.proxy_hostid];
|
||||
// Before version 7.0.0 proxy_hostid was used, after - proxyid
|
||||
const proxyId = host.proxyid || host.proxy_hostid;
|
||||
if (proxyId !== '0') {
|
||||
const hostProxy = proxies[proxyId];
|
||||
host.proxy = hostProxy ? hostProxy.host : '';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -530,7 +530,7 @@ export class ZabbixAPIConnector {
|
||||
}
|
||||
|
||||
getTriggersByIds(triggerids: string[]) {
|
||||
const params: any = {
|
||||
const params = {
|
||||
output: 'extend',
|
||||
triggerids: triggerids,
|
||||
expandDescription: true,
|
||||
@@ -540,13 +540,20 @@ export class ZabbixAPIConnector {
|
||||
monitored: true,
|
||||
skipDependent: true,
|
||||
selectGroups: ['name', 'groupid'],
|
||||
selectHosts: ['hostid', 'name', 'host', 'maintenance_status', 'proxy_hostid', 'description'],
|
||||
selectHosts: ['hostid', 'name', 'host', 'maintenance_status', 'description'],
|
||||
selectItems: ['itemid', 'name', 'key_', 'lastvalue'],
|
||||
// selectLastEvent: 'extend',
|
||||
// selectTags: 'extend',
|
||||
preservekeys: '1',
|
||||
};
|
||||
|
||||
// Before version 7.0.0 proxy_hostid was used, after - proxyid
|
||||
if (semver.lte(this.version, '7.0.0')) {
|
||||
params.selectHosts.push('proxy_hostid');
|
||||
} else {
|
||||
params.selectHosts.push('proxyid');
|
||||
}
|
||||
|
||||
return this.request('trigger.get', params).then(utils.mustArray);
|
||||
}
|
||||
|
||||
@@ -568,12 +575,19 @@ export class ZabbixAPIConnector {
|
||||
value: 1,
|
||||
},
|
||||
selectGroups: ['groupid', 'name'],
|
||||
selectHosts: ['hostid', 'name', 'host', 'maintenance_status', 'proxy_hostid'],
|
||||
selectHosts: ['hostid', 'name', 'host', 'maintenance_status'],
|
||||
selectItems: ['itemid', 'name', 'key_', 'lastvalue'],
|
||||
selectLastEvent: 'extend',
|
||||
selectTags: 'extend',
|
||||
};
|
||||
|
||||
// Before version 7.0.0 proxy_hostid was used, after - proxyid
|
||||
if (semver.lte(this.version, '7.0.0')) {
|
||||
params.selectHosts.push('proxy_hostid');
|
||||
} else {
|
||||
params.selectHosts.push('proxyid');
|
||||
}
|
||||
|
||||
if (showTriggers === ShowProblemTypes.Problems) {
|
||||
params.filter.value = 1;
|
||||
} else if (showTriggers === ShowProblemTypes.Recent || showTriggers === ShowProblemTypes.History) {
|
||||
@@ -674,7 +688,7 @@ export class ZabbixAPIConnector {
|
||||
const params = {
|
||||
eventids: eventids,
|
||||
output: ['alertid', 'eventid', 'message', 'clock', 'error'],
|
||||
selectUsers: true,
|
||||
selectUsers: 'extend',
|
||||
};
|
||||
|
||||
return this.request('alert.get', params);
|
||||
@@ -861,8 +875,13 @@ export class ZabbixAPIConnector {
|
||||
|
||||
getProxies() {
|
||||
const params = {
|
||||
output: ['proxyid', 'host'],
|
||||
output: ['proxyid'],
|
||||
};
|
||||
if (semver.lte(this.version, '7.0.0')) {
|
||||
params.output.push('name');
|
||||
} else {
|
||||
params.output.push('host');
|
||||
}
|
||||
|
||||
return this.request('proxy.get', params);
|
||||
}
|
||||
|
||||
@@ -599,7 +599,9 @@ export class Zabbix implements ZabbixConnector {
|
||||
triggers = triggers.filter((trigger) => {
|
||||
for (let i = 0; i < trigger.hosts.length; i++) {
|
||||
const host = trigger.hosts[i];
|
||||
if (proxy_ids.includes(host.proxy_hostid)) {
|
||||
// Before version 7.0.0 proxy_hostid was used, after - proxyid
|
||||
const proxyId = host.proxyid || host.proxy_hostid;
|
||||
if (proxy_ids.includes(proxyId)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user