Windows Script Monitor

Windows Script Monitor works with .NET Agent Extension Manager to report a metric by executing provided batch script.

This extension provides a simple template for writing windows batch files (.cmd / .bat) to retrieve any metrics from windows machine.


Windows Script Monitor require following files to be placed in a new folder under [ExtensionManager Root Directory]/Extensions
  • extension.xml
  • my-script.cmd


  • .NET Agent Extension Manager, can be downloaded from here
  • The AppDynamics .NET Agent
  • .NET 4.0 or later


  • Download and extract it to any location.
  • Create a new directory under [ExtensionManager Root Directory]/Extensions. We can name the directory as WindowsScriptMonitor, this will be the name of extension.
  • Copy extension.xml and my-script.cmd files to [ExtensionManager Root Directory]/Extensions/WindowsScriptMonitor

Getting Started

  1. Open extension.xml file copied under [ExtensionManager Root Directory]/Extensions/WindowsScriptMonitor in any editor and make following changes.
    • Change the name of extension, if required. (It will take the folder name if we leave it blank or remove the attribute.)
      <extension type="Metric" name="WindowsScriptMonitor" enabled="true" >
    • Change the path (name) of execution script, if needed.
      <execution mode="Periodic" type="Script" path="my-script.cmd" />
    • We can add any metric here, the name of metric needs to be present in script output.
         <metric name="metric1" description="Description of metric1" />
         <metric name="metric2" description="Description of metric2" />
    • Specify any instances to be monitored. Instance name needs to be present in the script output.
          <instance name="instance1" />
          <instance name="instance2" />
  1. Open my-script.cmd file copied under [ExtensionManager Root Directory]/Extensions/ScriptMonitor in any editor and make necessary changes to print out the metrics using echo.
    • Each line of script output will be parsed to check for metric value. Default format for providing values is as follows-
      #MetricName# | #InstanceName#, value = #Value#
    • We can use echo to printout metric name, instance name and their value. For example,
      Echo "metric1 | instance1 , value = 32350"
      In above line the value of metric1 for instance1 is 32350. metric name and instance name should be present in extension.xml
  1. Save the files and launch Extension Manager UI. We should be able to see WindowsScriptMonitor extension listed under "List of extensions loaded"
  1. Stop and Start Extension Service
    • it will modify .NET agent's configuration file (config.xml) to include new metrics. By default config.xml is located at %ProgramData%\AppDynamics\DotNetAgent\Config.
  1. Stop and Start AppDynamics.Agent.Coordinator Service for the metrics to be reported to controller.
    • We can click on Apply Changes or do it manually. After few minutes we should start getting metric values in metric browser under Application Infrastructure Performance|TierName|Custom Metrics|Performance Monitor|WindowsScriptMonitor
    • We can create custom dashboard from these metrics or create a health rule with alert, if needed.


If you're not seeing metrics, please verify following,

  • - Make sure that the AppDynamics.Agent.Coordinator service is restarted.
  • - Check the log file extensionLog.txt under Logs folder if the values are captured correctly or if there are any errors.


  1. Upgrade to latest version of extension manager
  2. Copy new extension.xml with DLL and make appropriate changes
  3. Start Extension Service to use latest version.