cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Sohail.Shaikh
AppDynamics Team (Retired)

Enabling auto-remediation scripts to run for .NET agents on Windows 

This article outlines the steps you need to follow to enable auto-remediation scripts to run when you have .NET agents configured on Windows.

 

Contents:

 

The built-in machine agents that ship with our .NET agents don’t have the capability to run auto-remediation scripts. For each application, you’ll need to install a standalone Machine Agent without the .NET compatibility enabled that will run the auto-remediation scripts.

 

Assuming you already have a .NET agent installed and a Machine Agent installed gathering server metrics, the following procedure will allow you to configure another machine agent that will run the auto-remediation steps. 

 

You must configure a separate Machine Agent with a unique application_name/unique_host_id pair, where the application_name and unique_host_id match. Each application you want to run auto-remediation scripts for will require its own Machine Agent.

 

Alternate procedure for a 1:1 application:host mapping

If you have ONLY one .NET application running on a single host (i.e., a 1:1 mapping of application:host), you may use your existing Machine Agent with sim enabled and dotnet-compatibility set to true alongside an application name, tier name, and node name. 

 

Unique-host-id is not required in this case.

 

Configuring a Machine Agent

Use the following steps to configure a Machine Agent for each application.

 

Step 1: Extract a new machine agent

  1. Extract/Unzip another machine agent into a new directory (ex. C:\AppDynamics\machineagentX, where X=app_name,1,2,3, etc)
  2. Open the <agent install directory>\conf\controller-info.xml

 

Step 2: Edit the XML file

  1. Edit the following values in the xml file. If you don't see the corresponding tag, add in the starting and ending tag using standard xml format. 

unique-host-id = {application_name}

sim-enabled = false

application-name = {application_name}

node-name = {node_name}

tier-name = {tier_name}

 

NOTE: 

  • unique-host-id and application-name must match identically
  • dotnet-compatibility-mode = false / doesn’t exist in this config file

 

  1. Save the file.

 

Step 3: Start the machine agent

You can configure the machine agent as a service or background task according to your company’s best practices. The steps below show how to start the machine agent in the foreground: 

 

  1. Open command prompt
  2. cd into the machine agent home directory
  3. Run java -jar machineagent.jar

 

Give the agent a minute to come up and you should see “Started AppDynamics Machine Agent Successfully.”

 

Step 4: Verify the new node under your application

Verify that the new node appears under your application.

 

Notice how the app agent status is down and 0% and the machine agent status is up and healthy.  

image8.png

 

Step 5: Create a script

  1. Create a script that you would like to execute as part of the auto-remediation process.
  2. Save this script in the <agent install directory>\local-scripts. For purposes of this document, a script.bat file has been created and placed in the local-scripts folder.

 

Step 6: Configure health rules

  1. Next, configure the health rules under Alert & Respond. Create a new policy for one of the .NET applications if you don’t already have one. 

  2. Once you have created a new policy, edit the policy. Click the Actions tab.

  3. Then, click the "+" under Actions to Execute.

image4.png

 

  1. Click Create.

image5.png

 

  1. On the Create Action dialog, select “Run a script or executable on problematic Nodes”. Then click OK.

image2.png 

 
  1. Enter the name for this script and give the name of the script file to execute. Click Save

image1.png

 

  1. Double-click the newly created script from the list.
  2. Select Execution Action on Specified Node and click the Change button.
    image6.png
 
  1. Select the Node you just named in the steps above. Then click OK.
    image3.png
    Whenever your health rule triggers, this script will execute as part of the actions. 

 

Note: 

  • Make sure you are creating a policy for a .NET application (not server, etc)
  • Make sure your policy is enabled

 

In the <agent install directory>\logs\machineagent.log, you'll be able to see the script is executing. 

image7.png

 

Reference Documents 

Configure Multiple Machine Agents for One Machine

Machine Agent Installation Scenarios 

Machine Agent Configuration Properties

Remediation Actions

Comments
Claudia.Landivar
Community Manager

In the past, you may have read about a "Standalone Machine Agent." Recently, we've discontinued that term in favor of simply "Machine Agent".

 

Claudia Landivar

Community Manager & Editor

AppDynamics

Version history
Last update:
‎05-28-2020 09:47 PM
Updated by: