Context
The custom scripts feature allows you to use one of the 5 types of scripts to perform actions on an agent or node that you have previously selected.
To access it, click on the "Action" section of the main menu.
SQL Query
By choosing this type of script, you can retrieve the result of an SQL query (up to 5 columns or rows).
Settings
The settings are divided into 3 sections: General, Execution Parameters, and Customization.
- General
You will find fields to name, add a description, define a target by choosing operating system criteria and/or agent type, and you can set an execution frequency.
The execution frequency will determine how many sliding results you can keep. The maximum number of sliding results saved is 1440.
Frequency example:
If I chose a frequency of 5 minutes, the retention of my data has a maximum duration of 5 days (5 minutes x 1440). After 5 days, the first result of my script is deleted.
- Execution Parameters
Query:
Define the SQL query you want to execute in this field.
DSN:
Add the DSN (Data Source Name) to connect to the data source associated with the query.
Consider Column As Row:
This option allows you to choose the format of the results.
- If unchecked: collects the first 5 fields of the first row.
- If checked: collects the first fields of the first 5 rows.
- Customization
Here you can define the names of the values returned in the script results for better understanding when reading the results. This also allows you to choose the type and format of the response (text or curves).
Executing the Script
Before permanently deploying your script on the agent or agents of the selected node, you can add one or more Alerts and Test your script on a specifically chosen agent.
Once the script meets your expectations, press "Create" to execute the script.