The content you are looking for has been archived. View related content below.
The AppDynamics Machine Agent supports remediation scripts, which allow you to define automated or manual actions in response to specific alerts or conditions. These scripts can be triggered when a predefined health rule violation occurs, enabling proactive responses to issues in your environment. Below is an overview of how remediation scripts work in the Machine Agent and how to configure and use them:
Remediation scripts are custom scripts (written in languages like Shell, Python, Batch, or PowerShell) that are executed by the Machine Agent when triggered by Health rule violations
These scripts can perform various actions, such as restarting services, freeing up memory, or notifying teams.
The steps to configure a remediation script are documented here → https://docs.appdynamics.com/appd/24.x/25.4/en/splunk-appdynamics-essentials/alert-and-respond/actio....
Use case: enable debug-level or trace-level logs on HR violation for troubleshooting purposes.
1. Setting the health rule.
Docs Resource: https://docs.appdynamics.com/appd/24.x/25.4/en/splunk-appdynamics-essentials/alert-and-respond/confi...
2. Setting the action
Docs Resource: https://docs.appdynamics.com/appd/24.x/25.4/en/splunk-appdynamics-essentials/alert-and-respond/actio...
3. Setting the policies to trigger the action
Docs Resource: https://docs.appdynamics.com/appd/24.x/25.4/en/splunk-appdynamics-essentials/alert-and-respond/polic...
#!/bin/bash # Define the target file TARGET_FILE="matest/conf/logging/log4j.xml" # Backup the original file cp "$TARGET_FILE" "${TARGET_FILE}.backup" # Function to update the logging level update_logging_level() { local level=$1 echo "Updating logging level to '$level'..." # Use sed to change all loggers with level="info" to the desired level sed -i "s/level=\"info\"/level=\"$level\"/g" "$TARGET_FILE" if [ $? -eq 0 ]; then echo "Logging level successfully updated to '$level'." else echo "Failed to update logging level." exit 1 fi } # Set the logging level to 'trace' update_logging_level "trace" # Wait for 10 minutes (600 seconds) echo "Waiting for 10 minutes..." sleep 600 # Revert the logging level back to 'info' update_logging_level "info" echo "Logging level reverted to 'info'." |
When the action is triggered, the script will change the log level from info to debug and revert the change after 10 minutes.