fix event ack for Zabbix 4.x, #629
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import _ from 'lodash';
|
||||
import * as utils from '../../../utils';
|
||||
import { ZabbixAPICore } from './zabbixAPICore';
|
||||
import { ZBX_ACK_ACTION_NONE, ZBX_ACK_ACTION_ACK, ZBX_ACK_ACTION_ADD_MESSAGE } from '../../../constants';
|
||||
|
||||
/**
|
||||
* Zabbix API Wrapper.
|
||||
@@ -8,11 +9,12 @@ import { ZabbixAPICore } from './zabbixAPICore';
|
||||
* Wraps API calls and provides high-level methods.
|
||||
*/
|
||||
export class ZabbixAPIConnector {
|
||||
constructor(api_url, username, password, basicAuth, withCredentials, backendSrv) {
|
||||
constructor(api_url, username, password, version, basicAuth, withCredentials, backendSrv) {
|
||||
this.url = api_url;
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
this.auth = "";
|
||||
this.auth = '';
|
||||
this.version = version;
|
||||
|
||||
this.requestOptions = {
|
||||
basicAuth: basicAuth,
|
||||
@@ -90,10 +92,11 @@ export class ZabbixAPIConnector {
|
||||
////////////////////////////////
|
||||
|
||||
acknowledgeEvent(eventid, message) {
|
||||
var params = {
|
||||
const action = this.version >= 4 ? ZBX_ACK_ACTION_ACK + ZBX_ACK_ACTION_ADD_MESSAGE : ZBX_ACK_ACTION_NONE;
|
||||
const params = {
|
||||
eventids: eventid,
|
||||
message: message,
|
||||
action: 6
|
||||
action: action
|
||||
};
|
||||
|
||||
return this.request('event.acknowledge', params);
|
||||
|
||||
@@ -28,6 +28,7 @@ export class Zabbix {
|
||||
password,
|
||||
basicAuth,
|
||||
withCredentials,
|
||||
zabbixVersion,
|
||||
cacheTTL,
|
||||
enableDirectDBConnection,
|
||||
dbConnectionDatasourceId,
|
||||
@@ -43,7 +44,7 @@ export class Zabbix {
|
||||
};
|
||||
this.cachingProxy = new CachingProxy(cacheOptions);
|
||||
|
||||
this.zabbixAPI = new ZabbixAPIConnector(url, username, password, basicAuth, withCredentials, backendSrv);
|
||||
this.zabbixAPI = new ZabbixAPIConnector(url, username, password, zabbixVersion, basicAuth, withCredentials, backendSrv);
|
||||
|
||||
if (enableDirectDBConnection) {
|
||||
let dbConnectorOptions = {
|
||||
|
||||
Reference in New Issue
Block a user