getScripts method
This commit is contained in:
@@ -37,6 +37,21 @@ export interface ZabbixRequestResponse {
|
|||||||
data?: JSONRPCResponse<any>;
|
data?: JSONRPCResponse<any>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ZabbixAPIResponse<T> = T;
|
export type ZabbixAPIResponse<T> = Promise<T>;
|
||||||
|
|
||||||
export type APILoginResponse = string;
|
export type APILoginResponse = string;
|
||||||
|
|
||||||
|
export interface ZBXScript {
|
||||||
|
scriptid: string;
|
||||||
|
name?: string;
|
||||||
|
command?: string;
|
||||||
|
host_access?: string;
|
||||||
|
usrgrpid?: string;
|
||||||
|
groupid?: string;
|
||||||
|
description?: string;
|
||||||
|
confirmation?: string;
|
||||||
|
type?: string;
|
||||||
|
execute_on?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type APIScriptGetResponse = ZabbixAPIResponse<ZBXScript[]>;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ 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, MIN_SLA_INTERVAL } from '../../../constants';
|
import { ZBX_ACK_ACTION_NONE, ZBX_ACK_ACTION_ACK, ZBX_ACK_ACTION_ADD_MESSAGE, MIN_SLA_INTERVAL } from '../../../constants';
|
||||||
import { ShowProblemTypes, ZBXProblem } from '../../../types';
|
import { ShowProblemTypes, ZBXProblem } from '../../../types';
|
||||||
import { JSONRPCRequestParams } from './types';
|
import { JSONRPCRequestParams, APIScriptGetResponse } from './types';
|
||||||
|
|
||||||
const DEFAULT_ZABBIX_VERSION = '3.0.0';
|
const DEFAULT_ZABBIX_VERSION = '3.0.0';
|
||||||
|
|
||||||
@@ -664,6 +664,15 @@ export class ZabbixAPIConnector {
|
|||||||
|
|
||||||
return this.request('proxy.get', params);
|
return this.request('proxy.get', params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getScripts(hostids: string[], options?: any): APIScriptGetResponse {
|
||||||
|
const params: any = {
|
||||||
|
output: 'extend',
|
||||||
|
hostids,
|
||||||
|
};
|
||||||
|
|
||||||
|
return this.request('script.get', params);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function filterTriggersByAcknowledge(triggers, acknowledged) {
|
function filterTriggersByAcknowledge(triggers, acknowledged) {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ interface AppsResponse extends Array<any> {
|
|||||||
const REQUESTS_TO_PROXYFY = [
|
const REQUESTS_TO_PROXYFY = [
|
||||||
'getHistory', 'getTrend', 'getGroups', 'getHosts', 'getApps', 'getItems', 'getMacros', 'getItemsByIDs',
|
'getHistory', 'getTrend', 'getGroups', 'getHosts', 'getApps', 'getItems', 'getMacros', 'getItemsByIDs',
|
||||||
'getEvents', 'getAlerts', 'getHostAlerts', 'getAcknowledges', 'getITService', 'getSLA', 'getVersion', 'getProxies',
|
'getEvents', 'getAlerts', 'getHostAlerts', 'getAcknowledges', 'getITService', 'getSLA', 'getVersion', 'getProxies',
|
||||||
'getEventAlerts', 'getExtendedEventData', 'getProblems', 'getEventsHistory', 'getTriggersByIds'
|
'getEventAlerts', 'getExtendedEventData', 'getProblems', 'getEventsHistory', 'getTriggersByIds', 'getScripts'
|
||||||
];
|
];
|
||||||
|
|
||||||
const REQUESTS_TO_CACHE = [
|
const REQUESTS_TO_CACHE = [
|
||||||
@@ -30,7 +30,7 @@ const REQUESTS_TO_CACHE = [
|
|||||||
const REQUESTS_TO_BIND = [
|
const REQUESTS_TO_BIND = [
|
||||||
'getHistory', 'getTrend', 'getMacros', 'getItemsByIDs', 'getEvents', 'getAlerts', 'getHostAlerts',
|
'getHistory', 'getTrend', 'getMacros', 'getItemsByIDs', 'getEvents', 'getAlerts', 'getHostAlerts',
|
||||||
'getAcknowledges', 'getITService', 'getVersion', 'login', 'acknowledgeEvent', 'getProxies', 'getEventAlerts',
|
'getAcknowledges', 'getITService', 'getVersion', 'login', 'acknowledgeEvent', 'getProxies', 'getEventAlerts',
|
||||||
'getExtendedEventData'
|
'getExtendedEventData', 'getScripts'
|
||||||
];
|
];
|
||||||
|
|
||||||
export class Zabbix implements ZabbixConnector {
|
export class Zabbix implements ZabbixConnector {
|
||||||
|
|||||||
Reference in New Issue
Block a user