You can run custom scripts in the end point VM and collect custom data which can then be consumed as a metric.
- All the scripts that you run using the custom script, must output a single integer value. If the output is not a single integer value, an error is displayed in the user interface.
- The custom script uses Telegraf’s exec plugin to run scripts on an end point VM’s operating system. The scripts are run by the user who installed the Telegraf agent on an operating system. In Linux operating systems, a special user called arcuser with specific privileges, is created for installing the Telegraf agent. As a result, the exec plugin runs the scripts using that arcuser user. Ensure that the arcuser can run the scripts that use the custom script (the arcuser must have permissions to run the script). For example, the arcuser created automatically by cloud proxy, does not have privileges to run scripts which are stored under the /root directory.
- The script must be placed in the /opt/vmware folder.
How to Run Custom Scripts
- From the Manage Telegraf Agents tab, filter by .
- Expand the drop-down arrow against the end point VM on which the agent is installed. You see the Custom Monitoring section.
- Against the Custom Script option, click the vertical ellipsis and then click Add.
- From the Manage Custom Service dialog box, you can add and configure the Windows services to be monitored.
|Enable the custom script execution.
|Add a suitable name for the script. The
* is an invalid character and must not be used in the name.
|Enter the path to the script file on the end point VM.
|Enter a prefix if necessary.
|List the arguments in the script.
|Enter a script execution timeout on the end point VM.
After you save the script, it appears under Custom Script. You can edit or delete scripts by clicking the Edit or Delete options from the vertical ellipsis against the custom script you added. After the scripts have been added and saved, click the drop down arrow against Custom Script, to view the list of scripts and their status.
- The custom script must throw all errors in the format ERROR|<Error_message> for the error propagation to work. If the script does not throw an error in the given format, vRealize Operations displays an error message Unable to parse the error message. Please check the endpoint in the user interface. This is by design, until cloud proxy propagates the exact error message.
- The bash script must start with
All Metrics Tab
When data is collected successfully, you can view the script as a metric for the end point VM, in the All Metrics tab. The script metrics are created under an object called Custom Script which is a single object per end point VM. All the metrics from the scripts for the end point VM are placed under that Custom Script object that contains all the custom scripts you have created. You can view the output for the specific metric. The metric name under the Scripts folder is the display name that the user specifies while creating the script configuration. For example, if you set the display name as Python script, then a metric is created with the name Python script if data is collected successfully.