fix event ack for Zabbix 4.x, #629
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
|
// Data point
|
||||||
|
export const DATAPOINT_VALUE = 0;
|
||||||
|
export const DATAPOINT_TS = 1;
|
||||||
|
|
||||||
// Editor modes
|
// Editor modes
|
||||||
export const MODE_METRICS = 0;
|
export const MODE_METRICS = 0;
|
||||||
export const MODE_ITSERVICE = 1;
|
export const MODE_ITSERVICE = 1;
|
||||||
@@ -17,9 +21,10 @@ export const SHOW_ALL_TRIGGERS = [0, 1];
|
|||||||
export const SHOW_ALL_EVENTS = [0, 1];
|
export const SHOW_ALL_EVENTS = [0, 1];
|
||||||
export const SHOW_OK_EVENTS = 1;
|
export const SHOW_OK_EVENTS = 1;
|
||||||
|
|
||||||
// Data point
|
// Acknowledge
|
||||||
export const DATAPOINT_VALUE = 0;
|
export const ZBX_ACK_ACTION_NONE = 0;
|
||||||
export const DATAPOINT_TS = 1;
|
export const ZBX_ACK_ACTION_ACK = 2;
|
||||||
|
export const ZBX_ACK_ACTION_ADD_MESSAGE = 4;
|
||||||
|
|
||||||
export const TRIGGER_SEVERITY = [
|
export const TRIGGER_SEVERITY = [
|
||||||
{val: 0, text: 'Not classified'},
|
{val: 0, text: 'Not classified'},
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import * as utils from '../../../utils';
|
import * as utils from '../../../utils';
|
||||||
import { ZabbixAPICore } from './zabbixAPICore';
|
import { ZabbixAPICore } from './zabbixAPICore';
|
||||||
|
import { ZBX_ACK_ACTION_NONE, ZBX_ACK_ACTION_ACK, ZBX_ACK_ACTION_ADD_MESSAGE } from '../../../constants';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Zabbix API Wrapper.
|
* Zabbix API Wrapper.
|
||||||
@@ -8,11 +9,12 @@ import { ZabbixAPICore } from './zabbixAPICore';
|
|||||||
* Wraps API calls and provides high-level methods.
|
* Wraps API calls and provides high-level methods.
|
||||||
*/
|
*/
|
||||||
export class ZabbixAPIConnector {
|
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.url = api_url;
|
||||||
this.username = username;
|
this.username = username;
|
||||||
this.password = password;
|
this.password = password;
|
||||||
this.auth = "";
|
this.auth = '';
|
||||||
|
this.version = version;
|
||||||
|
|
||||||
this.requestOptions = {
|
this.requestOptions = {
|
||||||
basicAuth: basicAuth,
|
basicAuth: basicAuth,
|
||||||
@@ -90,10 +92,11 @@ export class ZabbixAPIConnector {
|
|||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|
||||||
acknowledgeEvent(eventid, message) {
|
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,
|
eventids: eventid,
|
||||||
message: message,
|
message: message,
|
||||||
action: 6
|
action: action
|
||||||
};
|
};
|
||||||
|
|
||||||
return this.request('event.acknowledge', params);
|
return this.request('event.acknowledge', params);
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ export class Zabbix {
|
|||||||
password,
|
password,
|
||||||
basicAuth,
|
basicAuth,
|
||||||
withCredentials,
|
withCredentials,
|
||||||
|
zabbixVersion,
|
||||||
cacheTTL,
|
cacheTTL,
|
||||||
enableDirectDBConnection,
|
enableDirectDBConnection,
|
||||||
dbConnectionDatasourceId,
|
dbConnectionDatasourceId,
|
||||||
@@ -43,7 +44,7 @@ export class Zabbix {
|
|||||||
};
|
};
|
||||||
this.cachingProxy = new CachingProxy(cacheOptions);
|
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) {
|
if (enableDirectDBConnection) {
|
||||||
let dbConnectorOptions = {
|
let dbConnectorOptions = {
|
||||||
|
|||||||
Reference in New Issue
Block a user