Ability to execute "Manual event actions" on Zabbix Problems panel (#2024)

This PR resolves the below issues:
#2022 #1465 

Specifically, when executing a script on the problems panel, we do check
if the script scope is event or host.
Based on the script scope, the Zabbix API call is constructed
differently.

---------

Co-authored-by: Zoltán Bedi <zoltan.bedi@gmail.com>
This commit is contained in:
Christos Diamantis
2025-07-09 16:56:14 +03:00
committed by GitHub
parent 04ef3774b0
commit 30c0b0e982
7 changed files with 34 additions and 11 deletions

View File

@@ -44,6 +44,7 @@ export interface ZBXScript {
confirmation?: string;
type?: string;
execute_on?: string;
scope?: string;
}
export interface APIExecuteScriptResponse {

View File

@@ -930,11 +930,14 @@ export class ZabbixAPIConnector {
return this.request('script.get', params).then(utils.mustArray);
}
executeScript(hostid: string, scriptid: string): Promise<APIExecuteScriptResponse> {
const params: any = {
hostid,
scriptid,
};
executeScript(scriptid: string, hostid?: string, eventid?: string): Promise<APIExecuteScriptResponse> {
const params: { scriptid: string; hostid?: string; eventid?: string } = { scriptid };
if (hostid) {
params.hostid = hostid;
}
if (eventid) {
params.eventid = eventid;
}
return this.request('script.execute', params);
}