You can run custom scripts in physical servers and collect custom data which can then be consumed as a metric.

Prerequisites

  • All the scripts that you run using the custom script must output a single integer value.
  • 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. Ensure that the user can run the custom script.

Procedure

  1. Update the Telegraf configuration in the target physical server after running the sample script. Add the following in the http.conf file.
    Note: Update the information in "<>" accurately.
    [[inputs.exec]]
    
    name_prefix = "executescript."
    name_override = "output"
    commands = ["<prefix> <script path which should be run> <argument>"]
    data_format = "value"
    data_type = "integer"
    timeout = "300s"
    
    [inputs.exec.tags]
    file_path = "script path which should be run"
    script_name = "<custom_script_name> on <hostname>"
    Examples
    • For example, in the case of a Windows Server, add powershell -File as a prefix in front of the script. script path which should be run is the custom script that you want to run in the physical server. WIN-3VI8MSB5B5D is the hostname property value that is mentioned in the http.conf file. Memory.ps1 on WIN-3VI8MSB5B5D is the metric name that will be collected under the Custom Script object. Here is the example:
      [[inputs.exec]]
      
      name_prefix = "executescript."
      name_override = "output"
      commands = ["powershell -File C:\\\\opt\\\\Scripts\\\\Memory.ps1"]
      data_format = "value"
      data_type = "integer"
      timeout = "300s"
      
      [inputs.exec.tags]
      file_path = "C:\\opt\\Scripts\\Memory.ps1"
      script_name = "Memory.ps1 on WIN-3VI8MSB5B5D"
    • For example, in the case of a Linux Server, you can add either python2.7, /bin/bash, or perl, etc as possible prefixes to the script. script path which should be run is the custom script that you want to run in the physical server. OEL7-OpenSourceTelegraf is the hostname property value that is mentioned in the http.conf file. argument.py on OEL7-OpenSourceTelegraf is the metric name that will be collected under the Custom Script object. Here is the example:
      [[inputs.exec]]
      
      name_prefix = "executescript."
      commands = ["python2.7 /opt/scripts/python/argument.py 100"]
      data_format = "value"
      data_type = "integer"
      timeout = "300s"
      
      [inputs.exec.tags]
      file_path = "/opt/scripts/python/argument.py"
      script_name = "argument.py on OEL7-OpenSourceTelegraf"
    Note: Do not change any other Telegraf configurations as it can lead to undesirable behavior.
  2. Restart Telegraf and wait for 10 minutes to get the data.

What to do next

You can view metrics by selecting the relevant object from the Metrics tab from the VMware Aria Operations user interface:
  1. From the left panel, navigate to Environment > Custom Groups.
  2. Click on the Operating System World object in the right pane.
  3. Navigate to the Metrics tab and select the corresponding OS object.
  4. Under OS object you will find Custom Script object.