You can run custom scripts in the 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 a 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.
|Status||Enable the custom script execution.|
|Display Name||Add a suitable name for the script. The
|Filepath||Enter the path to the script file on the end point VM.|
|Prefix||Enter a prefix if necessary.|
|Args||List the arguments in the script.|
|Timeout||Enter a script execution timeout on the VM.|
After you save the script, it appears in the left pane of the Custom Script dialog box. You can add or delete scripts by clicking the Add or Delete buttons in the left pane. After the scripts have been added and saved, from the column, you see the Custom Script label. Point to the Custom Script label 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 Cloud 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 VM, in the All Metrics tab. The script metrics are created under an object called Custom Script which is a single object per VM. All the metrics from the scripts for the 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.