The Gateway Hooks feature had been available since Geneos version GA3.0.22 (GWX-836). Gateway hooks provide a way for clients to fire custom programs or scripts when certain important gateway events occur. This article talks about the "Validate-Setup" function which can serve this purpose. The user is expected to have scripting knowledge for parsing XML files.
To use Gateway Hooks, users will need to specify the -hooks-dir parameter on gateway startup, which points to a directory that contains customized scripts for their environment.
To use the "Validate-Setup" function, the gateway will look for a script named validate-setup under the -hooks-dir parameter.
The validate-setup script is triggered in several situations including when validation is called by the Gateway Setup Editor. The gateway passes several environment variables to the script, and the most important one being _SETUP which points to the location of a temporary file containing the setup of the gateway.
The user can customize the script to check additional logic on the XML tags as needed. The script results can be returned by printing an XML document to its standard output.
To help users get started, there is an example script with output included at the gateway installation under the ./resources/hooks/examples/ directory. The example was written in Python, but any scripting language can be used that can parse XML file.
The _SETUP file passed from Gateway Hooks is a single XML file after merging the main gateway XML and the include files. Users may find it useful to have an exact copy of the XML file for review.
We have attached an example validate-setup script in Python in this article. When this script is placed under the directory specified in -hooks-dir parameter, the GSE would display the following message during validation.
Users can refer to the Gateway Advanced Features - Technical Reference documentation and look for the Gateway Hooks section.