Download PDF
Download page Configuration Import and Export API.
Configuration Import and Export API
This page describes the AppDynamics API methods you can use to import and export various types of configuration settings in the Controller.
About the Configuration Import/Export APIs
The Configuration Import/Export APIs enable you to migrate configuration settings across Controller accounts, business applications, or Controller instances. You can also use it to add configuration artifacts like transaction detection rules, health rules, or custom dashboards to an existing configuration programmatically.
An exported configuration is an XML or JSON representation of the configuration artifact. After exporting the file, you can upload it to another account or application, optionally modifying the configuration.
Export Actions from an Application
Use this to export all actions in the specified application to a JSON file.
Format
GET /controller/actions/application_id
Input parameters
Parameter Name | Parameter Type | Value | Mandatory |
---|---|---|---|
| URI | The application name or application ID. | Yes |
Example
curl --user user1@customer1:your_password http://demo.appdynamics.com/controller/actions/7 [ { actionType: "EmailAction", name: "6DA8942B-DF4A-417A-E1NF-59F14231D670", priority: 1, description: null, toAddress: "user1@example.com", subject: "", timeZone: null }, { actionType: "DiagnosticSessionAction", name: "MyDiagnotic", priority: 0, description: null, businessTransactionTemplates: [ ], numberOfSnapshotsPerMinute: 5, durationInMinutes: 10, adjudicate: false, adjudicatorEmail: null } ]
Import Actions into an Application
After you have exported actions, you can import them to a different application passing the JSON file created by the export operation as the payload to a POST request.
This call takes data as multipart/form-data content. Use UTF-8 URL encoding of the URI before posting; for example, do not replace a space (" ") with "%20" in the URI.
Format
POST /controller/actions/application_id
Input parameters
Parameter Name | Parameter Type | Value | Mandatory |
---|---|---|---|
| URI | The application name or application ID. | Yes |
Example
curl -X POST --user user1@customer1:your_password http://demo.appdynamics.com/controller/actions/38 -F file=@ExportActions.json {"success":true,"errors":[],"warnings":[]}
If there are actions in the file with the same name as ones in the configuration, those actions are not imported, and the response indicates the success of the request as false.
For example:
{"success":false,"errors":["Not importing Action with name: DuplicateExportedDiagnosticAction, since it already exists."],"warnings":["Imported 1 out of 2 actions"]}
Export Email Action Templates from an Account
This API exports all the email action templates in the current account in JSON format.
Format
GET /controller/actiontemplate/email
Example
curl --user user1@customer1:your_password http://demo.appdynamics.com/controller/actiontemplate/email [ { "actionPlanType" : "email", "name" : "MyCustomEmailTemplate", "oneEmailPerEvent" : true, "eventClampLimit" : 100, "defaultCustomProperties" : [ { "id" : 0, "version" : 0, "name" : "env", "value" : "%OS" } ], "allowCustomRecipients" : true, "toRecipients" : [ ], "ccRecipients" : [ ], "bccRecipients" : [ ], "headers" : [ ], "subject" : "We've got a situation...", "includeTextBody" : true, "textBody" : "<h1>Summary of events occurring during the ${policy.digestDurationInMins}+ minute(s) prior to ${action.triggerTime}:</h1> <table> #foreach(${eventList} in ${fullEventsByTypeMap.values()}) #foreach(${event} in ${eventList}) <tr> <td> <!-- Event icon --> <img src="${event.severityImage.mimeContentRef}" alt="${event.severity}" /> </td> <td> <!-- Event name with event link --> <a href="${event.deepLink}">${event.displayName}</a> </td> <td> <!-- Event message --> ${event.eventMessage} </td> </tr> #end #end </table>"", "includeHtmlBody" : true, "htmlBody" : "<p>Please look into it.</p>", "testLogLevel" : "DEBUG", "testPropertiesPairs" : [ ], "testToRecipients" : [ ], "testCcRecipients" : [ ], "testBccRecipients" : [ ], "eventTypeCountPairs" : [ ] } ]
Import Email Action Templates
Use this to import email action templates to an account as a JSON file.
The import will fail if you attempt to import a template with the same name as an existing template of the same type in the destination account.
Data for this call should be in the form of multipart/form-data. Use UTF-8 URL encoding of the URI before posting; for example, do not replace a space (" ") with "%20" in the URI.
Format
POST /controller/actiontemplate/email
Example
curl -X POST --user user1@customer1:your_password http://demo.appdynamics.com/controller/actiontemplate/email -F file=@emailactiontemplate.json {"success":true,"errors":[],"warnings":[]}
Export HTTP Request Action Templates from an Account
This API exports all the HTTP request action templates in the current account to a JSON file.
Format
GET /controller/actiontemplate/httprequest/
Example:
curl --user user1@customer1:your_password http://demo.appdynamics.com/controller/actiontemplate/httprequest [ { "actionPlanType" : "httprequest", "name" : "MyCustomHTTPTemplate", "oneRequestPerEvent" : false, "eventClampLimit" : -1, "defaultCustomProperties" : [ ], "method" : "GET", "scheme" : "HTTP", "host" : "http", "port" : 0, "path" : "//demo.appdynamics.com//controller/rest/applications/${latestEvent.application.name}/nodes/${latestEvent.node.name}", "query" : "", "urlCharset" : "UTF_8", "authType" : "BASIC", "authUsername" : "user1", "authPassword" : "your_password", "headers" : [ ], "payloadTemplate" : { "httpRequestActionMediaType" : "text/plain", "charset" : "UTF_8", "formDataPairs" : [ ], "payload" : "" }, "connectTimeoutInMillis" : 5000, "socketTimeoutInMillis" : 15000, "maxFollowRedirects" : 0, "responseMatchCriteriaAnyTemplate" : [ ], "responseMatchCriteriaNoneTemplate" : [ ], "testLogLevel" : "DEBUG", "testPropertiesPairs" : [ ], "eventTypeCountPairs" : [ ] } ]
Import HTTP Action Templates into an Account
After you have exported HTTP request action templates, you can import them to a different account by logging into the destination account and passing the JSON file created by the export operation as the payload to the POST
request.
You can modify the exported file before you import it. You might want to do this to remove one or more template configurations or to change their names.
The import will fail if you attempt to import a template with the same name as an existing template of the same type in the destination account.
Use UTF-8 URL encoding of the URI before posting; for example, do not replace a space (" ") with "%20" in the URI.
Format
GET /controller/actiontemplate/httprequest
Example
curl -X POST --user user1@customer1:your_password http://demo.appdynamics.com/controller/actiontemplate/httprequest -F file=@httpactiontemplate.json {"success":true,"errors":[],"warnings":[]}
Export Custom Dashboards and Templates
You can export and import custom dashboards and custom dashboard templates interactively from the Controller UI or by using this API call. See Import and Export Custom Dashboards and Templates Using the UI.
In the export call, you must identify the dashboard to export by its ID. When you open the dashboard in the UI, the ID appears as the dashboard parameter at the end of the URL.
For example, in this URL snippet, the custom dashboard ID is 3: location=CDASHBOARD_DETAIL&mode=MODE_DASHBOARD&dashboard=3
Format
GET /controller/CustomDashboardImportExportServlet?dashboardId=dashboard_id
Input Parameters
Parameter Name | Parameter Type | Value | Mandatory |
---|---|---|---|
| Query | The numeric ID of the custom dashboard. | Yes |
Example
curl --user user1@customer1:your_password http://demo.appdynamics.com/controller/CustomDashboardImportExportServlet?dashboardId=8 { "schemaVersion" : null, "dashboardFormatVersion" : "3.0", "name" : "Analytics-BrowserData", ... "warRoom" : false, "template" : false }
View a complete response example:
{ "schemaVersion" : null, "dashboardFormatVersion" : "3.0", "name" : "Analytics-BrowserData", "description" : null, "properties" : null, "templateEntityType" : "APPLICATION_COMPONENT_NODE", "associatedEntityTemplates" : null, "minutesBeforeAnchorTime" : 15, "startDate" : null, "endDate" : null, "refreshInterval" : 120000, "backgroundColor" : 15395562, "color" : 15395562, "height" : 768, "width" : 1024, "canvasType" : "CANVAS_TYPE_GRID", "layoutType" : "", "widgetTemplates" : [ { "widgetType" : "AnalyticsWidget", "title" : "Browser_data", "height" : 4, "width" : 4, "x" : 0, "y" : 0, "label" : "", "description" : "", "drillDownUrl" : "", "useMetricBrowserAsDrillDown" : false, "backgroundColor" : 16777215, "backgroundColors" : null, "backgroundColorsStr" : null, "color" : 4210752, "fontSize" : 12, "useAutomaticFontSize" : false, "borderEnabled" : false, "borderThickness" : 0, "borderColor" : 0, "backgroundAlpha" : 1.0, "showValues" : false, "compactMode" : false, "showTimeRange" : false, "renderIn3D" : false, "showLegend" : false, "legendPosition" : null, "legendColumnCount" : null, "startTime" : null, "endTime" : null, "minutesBeforeAnchorTime" : 0, "isGlobal" : true, "propertiesMap" : null, "dataSeriesTemplates" : null, "adqlQueries" : [ "SELECT appkey, pageexperience, distinctcount(pageurl) AS \"URL (Count Distinct)\" FROM browser_records LIMIT 100,100" ], "analyticsWidgetType" : "COLUMN", "maxAllowedYAxisFields" : 3, "maxAllowedXAxisFields" : 2, "min" : null, "interval" : 98, "max" : null, "intervalType" : "By Fixed Number", "showMinExtremes" : null, "showMaxExtremes" : null, "displayPercentileMarkers" : null, "percentileValue1" : null, "percentileValue2" : null, "percentileValue3" : null, "percentileValue4" : null, "resolution" : "1m", "dataFetchSize" : null, "percentileLine" : null, "timeRangeInterval" : null, "pollingInterval" : null, "unit" : null } ], "warRoom" : false, "template" : false }o
Import Custom Dashboards and Templates
You can import custom dashboards and templates based on a previously exported JSON definition, which has optionally been modified. Import the definition as an application/json
content type.
Data for this call should be in the form of multipart/form-data. Use UTF-8 URL encoding of the URI before posting; for example, do not replace a space (" ") with "%20" in the URI.
Prior to version 4.1, exported custom dashboards were in XML format. You can import custom dashboards previously exported as XML data into the current Controller; however, custom dashboards can only be exported as JSON data.
Format
POST /controller/CustomDashboardImportExportServlet
Example
curl -X POST --user user1@customer1:your_password http://demo.appdynamics.com/controller/CustomDashboardImportExportServlet -F file=@customdashboards.json {"success":true,"errors":[],"warnings":[],"createdDashboardName":"Uploaded-Analytics-BrowserData"}
Export Health Rules from an Application
Returns all health rules in XML format.
Format
GET /controller/healthrules/application_id?name=health_rule_name
Input parameters
Parameter Name | Parameter Type | Value | Mandatory |
---|---|---|---|
| URI | The application name or application ID. | Yes |
name | Query | The name of the health rule to export. If not specified, exports all health rules. | No |
Example
curl --user user1@customer1:your_password http://demo.appdynamics.com/controller/healthrules/38?name=MyCustomHealthRule <health-rules controller-version="004-002-000-000"> <health-rule> <name>MyCustomHealthRule</name> <type>BUSINESS_TRANSACTION</type> <description/> <enabled>true</enabled> <is-default>false</is-default> <always-enabled>true</always-enabled> <duration-min>30</duration-min> <wait-time-min>30</wait-time-min> <affected-entities-match-criteria> <affected-bt-match-criteria> <type>ALL</type> </affected-bt-match-criteria> </affected-entities-match-criteria> <warning-execution-criteria> <entity-aggregation-scope> <type>ANY</type> <value>0</value> </entity-aggregation-scope> <policy-condition> <type>leaf</type> <display-name>CPU</display-name> <condition-value-type>BASELINE_STANDARD_DEVIATION</condition-value-type> <condition-value>2.0</condition-value> <operator>GREATER_THAN</operator> <condition-expression/> <use-active-baseline>true</use-active-baseline> <metric-expression> <type>leaf</type> <function-type>VALUE</function-type> <value>0</value> <is-literal-expression>false</is-literal-expression> <display-name>null</display-name> <metric-definition> <type>LOGICAL_METRIC</type> <logical-metric-name>Average CPU Used (ms)</logical-metric-name> </metric-definition> </metric-expression> </policy-condition> </warning-execution-criteria> </health-rule> </health-rules>
Import Health Rules into an Application
You can import health rules defined in an XML file into a business application.
Data for this call should be in the form of multipart/form-data. In the POST request, use UTF-8 URL encoding for the URI; for example, do not replace a space (" ") with "%20" in the URI.
By default, a health rule in the posted data with an identical name to one in the existing configuration does not overwrite the existing health rule. If you want to overwrite an existing health rule of the same name, use the overwrite parameter.
The syntax is the same for importing one health rule configuration or several. All the health rule configurations in the posted XML file are imported.
Format
POST /controller/healthrules/application_id?overwrite=true_or_false
Input parameters
Parameter Name | Parameter Type | Value | Mandatory |
---|---|---|---|
| URI | The application name or application ID. | Yes |
overwrite | Query | Set to true to have health rules in the posted data overwrite existing health rules with the same name. The default is false . | No |
Example
curl -X POST --user user1@customer1:your_password http://demo.appdynamics.com/controller/healthrules/38 -F file=@uploadhealthrule.xml Imported 1 health rules successfully.
If the health rule exists and you have not enabled the overwrite parameters, you will get the following response:
Not importing the health rule: healthrulename since it already exists.
Export Transaction Detection Rules
Use this to get all transaction detection rules in XML format. This call returns different types of detection rule configurations when MDS is enabled.
You can get transaction detection rules from a number of different configurations, including the configuration for a specific scope by name.
The URI used by clients for this call should be UTF-8 encoded.
Format
GET /controller/transactiondetection/application_id/[scope_name]/rule_type/[entry_point_type]/[rule_name] >> xml_name.xml
Input parameters
Parameter Name | Parameter Type | Value | Mandatory | |
---|---|---|---|---|
application_id | URI | The application name or application ID. It can be found in the URL in the address bar if you click the specified application. It is an Integer value. It will return an error if you do not specify. | Yes | |
scope_name | URI | The name of the scope from which you are exporting the entry point configuration. The scope name cannot be It will export all the rules under all the scopes if you do not specify. | No | |
rule_type | URI | The type of rule to export, from these options:
It will return an error if you do not specify. | Yes | |
entry_point_type | URI | The POJO, Servlet, EJB, Spring Bean, etc. | No | |
rule_name | URI | The name of the rule which you are exporting. It will export all the rules under a scope or all the scopes if you do not specify. | No |
- The order of the parameters cannot be changed. The order of the parameters should be:
application_id/[scope_name]/rule_type/[entry_point_type]/[rule_name]
. - It will return an XML file with error content if you use the wrong name(s) in all the parameters.
- Tier information is provided in the scope list.
- If you do not specify the scope when exporting, then you should also not specify it when importing.
- Please check the
server.log
file if you do not get the expected result after exporting.
Scenarios:
Export the rules from all the scopes.
curl -X GET --user user1@customer1:welcome http://localhost:8080/controller/transactiondetection/applicationID/{rule_type} >> {xml_name}.xml
Example:
curl -X GET --user user1@customer1:welcome http://localhost:8080/controller/transactiondetection/10/custom >> result.xml
If you do not include
scope_name
, the output is divided into three parts under<mds-config-data>: scope-list, rule-list,
andscope-rule-mapping-list.
<mds-data> <mds-config-data> <scope-list> <scope scope-description="" scope-name="scope0" scope-type="ALL_TIERS_IN_APP" scope-version="0"/> <scope scope-description="" scope-name="scope1" scope-type="SELECTED_TIERS" scope-version="0"/> </scope-list> <rule-list> <rule agent-type="APPLICATION_SERVER" enabled="true" priority="1" rule-description="ruleInScope1_SERVLET" rule-name="ruleInScope1_SERVLET" rule-type="TX_MATCH_RULE" version="0"> <tx-match-rule>{"type":"CUSTOM","txautodiscoveryrule":{"autodiscoveryconfigs":[]},"txcustomrule":{"type":"INCLUDE","txentrypointtype":"SERVLET","matchconditions":[{"type":"HTTP","httpmatch":{"uri":{"type":"IS_NOT_EMPTY","matchstrings":[""]},"parameters":[],"headers":[],"cookies":[]}}],"actions":[],"properties":[]},"agenttype":"APPLICATION_SERVER"}</tx-match-rule> </rule> <rule agent-type="DOT_NET_APPLICATION_SERVER" enabled="true" priority="0" rule-description="ASP.NET MVC5 Resource Handler" rule-name="ASP.NET MVC5 Resource Handler" rule-type="TX_MATCH_RULE" version="0"> <tx-match-rule>{"type":"CUSTOM","txcustomrule":{"type":"EXCLUDE","txentrypointtype":"POJO","matchconditions":[{"type":"HTTP","httpmatch":{"parameters":[],"headers":[],"classmatch":{"type":"MATCHES_CLASS","classnamecondition":{"type":"EQUALS","matchstrings":["System.Web.Optimization.BundleHandler"],"isnot":false}},"cookies":[]}}],"actions":[{"type":"HTTP_SPLIT","httpsplit":{}}],"properties":[]},"agenttype":"DOT_NET_APPLICATION_SERVER"}</tx-match-rule> </rule> <rule agent-type="APPLICATION_SERVER" enabled="true" priority="0" rule-description="testPOJO" rule-name="testPOJO" rule-type="TX_MATCH_RULE" version="0"> <tx-match-rule>{"type":"CUSTOM","txcustomrule":{"type":"EXCLUDE","txentrypointtype":"POJO","matchconditions":[{"type":"HTTP","httpmatch":{"parameters":[],"headers":[],"classmatch":{"type":"MATCHES_CLASS","classnamecondition":{"type":"EQUALS","matchstrings":["System.Web.Optimization.BundleHandler"],"isnot":false}},"cookies":[]}}],"actions":[{"type":"HTTP_SPLIT","httpsplit":{}}],"properties":[]},"agenttype":"APPLICATION_SERVER"}</tx-match-rule> </rule> <rule agent-type="APPLICATION_SERVER" enabled="true" priority="0" rule-description="whatever_SERVLET" rule-name="whatever_SERVLET" rule-type="TX_MATCH_RULE" version="0"> <tx-match-rule>{"type":"CUSTOM","txcustomrule":{"type":"EXCLUDE","txentrypointtype":"SERVLET","matchconditions":[{"type":"HTTP","httpmatch":{"parameters":[],"headers":[],"classmatch":{"type":"MATCHES_CLASS","classnamecondition":{"type":"EQUALS","matchstrings":["System.Web.Optimization.BundleHandler"],"isnot":false}},"cookies":[]}}],"actions":[{"type":"HTTP_SPLIT","httpsplit":{}}],"properties":[]},"agenttype":"APPLICATION_SERVER"}</tx-match-rule> </rule> </rule-list> <scope-rule-mapping-list> <scope-rule-mapping scope-name="scope1"> <rule rule-description="ruleInScope1_SERVLET" rule-name="ruleInScope1_SERVLET"/> </scope-rule-mapping> <scope-rule-mapping scope-name="scope0"> <rule rule-description="ASP.NET MVC5 Resource Handler" rule-name="ASP.NET MVC5 Resource Handler"/> <rule rule-description="whatever_SERVLET" rule-name="whatever_SERVLET"/> <rule rule-description="testPOJO" rule-name="testPOJO"/> </scope-rule-mapping> </scope-rule-mapping-list> </mds-config-data> </mds-data>
Export the rules under the specified scope:
curl -X GET --user user1@customer1:welcome http://localhost:8080/controller/transactiondetection/applicationID/scope_name/{rule_type} >> {xml_name}.xml
Example:
curl -X GET --user user1@customer1:welcome http://localhost:8080/controller/transactiondetection/10/scope0/custom >> result.xml
If you include
scope_name
then onlyrule-list
is included in the output.<mds-data> <mds-config-data> <rule-list> <rule agent-type="DOT_NET_APPLICATION_SERVER" enabled="true" priority="0" rule-description="ASP.NET MVC5 Resource Handler" rule-name="ASP.NET MVC5 Resource Handler" rule-type="TX_MATCH_RULE" version="0"> <tx-match-rule>{"type":"CUSTOM","txcustomrule":{"type":"EXCLUDE","txentrypointtype":"ASP_DOTNET","matchconditions":[{"type":"HTTP","httpmatch":{"parameters":[],"headers":[],"classmatch":{"type":"MATCHES_CLASS","classnamecondition":{"type":"EQUALS","matchstrings":["System.Web.Optimization.BundleHandler"],"isnot":false}},"cookies":[]}}],"actions":[{"type":"HTTP_SPLIT","httpsplit":{}}],"properties":[]},"agenttype":"DOT_NET_APPLICATION_SERVER"}</tx-match-rule> </rule> <rule agent-type="APPLICATION_SERVER" enabled="true" priority="0" rule-description="whatever_SERVLET" rule-name="whatever_SERVLET" rule-type="TX_MATCH_RULE" version="0"> <tx-match-rule>{"type":"CUSTOM","txcustomrule":{"type":"EXCLUDE","txentrypointtype":"SERVLET","matchconditions":[{"type":"HTTP","httpmatch":{"parameters":[],"headers":[],"classmatch":{"type":"MATCHES_CLASS","classnamecondition":{"type":"EQUALS","matchstrings":["System.Web.Optimization.BundleHandler"],"isnot":false}},"cookies":[]}}],"actions":[{"type":"HTTP_SPLIT","httpsplit":{}}],"properties":[]},"agenttype":"APPLICATION_SERVER"}</tx-match-rule> </rule> <rule agent-type="APPLICATION_SERVER" enabled="true" priority="0" rule-description="testPOJO" rule-name="testPOJO" rule-type="TX_MATCH_RULE" version="0"> <tx-match-rule>{"type":"CUSTOM","txcustomrule":{"type":"EXCLUDE","txentrypointtype":"POJO","matchconditions":[{"type":"HTTP","httpmatch":{"parameters":[],"headers":[],"classmatch":{"type":"MATCHES_CLASS","classnamecondition":{"type":"EQUALS","matchstrings":["System.Web.Optimization.BundleHandler"],"isnot":false}},"cookies":[]}}],"actions":[{"type":"HTTP_SPLIT","httpsplit":{}}],"properties":[]},"agenttype":"APPLICATION_SERVER"}</tx-match-rule> </rule> </rule-list> </mds-config-data> </mds-data>
Export the rules belonging to the specified entry point under all the scopes.
curl -X GET --user user1@customer1:welcome http://localhost:8080/controller/transactiondetection/applicationID/{rule_type}/{entry_point_type} >> {xml_name}.xml
Example:
curl -X GET --user user1@customer1:welcome http://localhost:8080/controller/transactiondetection/10/custom/servlet >> {xml_name}.xml
If you do not include
scope_name
then the output is divided into three parts under<mds-config-data>: scope-list, rule-list, and scope-rule-mapping-list.
<mds-data> <mds-config-data> <scope-list> <scope scope-description="" scope-name="scope0" scope-type="ALL_TIERS_IN_APP" scope-version="0"/> <scope scope-description="" scope-name="scope1" scope-type="SELECTED_TIERS" scope-version="0"/> </scope-list> <rule-list> <rule agent-type="APPLICATION_SERVER" enabled="true" priority="1" rule-description="ruleInScope1_SERVLET" rule-name="ruleInScope1_SERVLET" rule-type="TX_MATCH_RULE" version="0"> <tx-match-rule>{"type":"CUSTOM","txautodiscoveryrule":{"autodiscoveryconfigs":[]},"txcustomrule":{"type":"INCLUDE","txentrypointtype":"SERVLET","matchconditions":[{"type":"HTTP","httpmatch":{"uri":{"type":"IS_NOT_EMPTY","matchstrings":[""]},"parameters":[],"headers":[],"cookies":[]}}],"actions":[],"properties":[]},"agenttype":"APPLICATION_SERVER"}</tx-match-rule> </rule> <rule agent-type="APPLICATION_SERVER" enabled="true" priority="0" rule-description="whatever_SERVLET" rule-name="whatever_SERVLET" rule-type="TX_MATCH_RULE" version="0"> <tx-match-rule>{"type":"CUSTOM","txcustomrule":{"type":"EXCLUDE","txentrypointtype":"SERVLET","matchconditions":[{"type":"HTTP","httpmatch":{"parameters":[],"headers":[],"classmatch":{"type":"MATCHES_CLASS","classnamecondition":{"type":"EQUALS","matchstrings":["System.Web.Optimization.BundleHandler"],"isnot":false}},"cookies":[]}}],"actions":[{"type":"HTTP_SPLIT","httpsplit":{}}],"properties":[]},"agenttype":"APPLICATION_SERVER"}</tx-match-rule> </rule> </rule-list> <scope-rule-mapping-list> <scope-rule-mapping scope-name="scope1"> <rule rule-description="ruleInScope1_SERVLET" rule-name="ruleInScope1_SERVLET"/> </scope-rule-mapping> <scope-rule-mapping scope-name="scope0"> <rule rule-description="whatever_SERVLET" rule-name="whatever_SERVLET"/> </scope-rule-mapping> </scope-rule-mapping-list> </mds-config-data> </mds-data>
Export the rules belonging to the specified entry point under the specified scope.
curl -X GET --user user1@customer1:welcome http://localhost:8080/controller/transactiondetection/applicationID/scope_name/{rule_type}/{entry_point_type} >> {xml_name}.xml
Example:
curl -X GET --user user1@customer1:welcome http://localhost:8080/controller/transactiondetection/10/scope0/custom/servlet >> {xml_name}.xml
<mds-data> <mds-config-data> <rule-list> <rule agent-type="APPLICATION_SERVER" enabled="true" priority="1" rule-description="ruleInScope1_SERVLET" rule-name="ruleInScope1_SERVLET" rule-type="TX_MATCH_RULE" version="0"> <tx-match-rule>{"type":"CUSTOM","txautodiscoveryrule":{"autodiscoveryconfigs":[]},"txcustomrule":{"type":"INCLUDE","txentrypointtype":"SERVLET","matchconditions":[{"type":"HTTP","httpmatch":{"uri":{"type":"IS_NOT_EMPTY","matchstrings":[""]},"parameters":[],"headers":[],"cookies":[]}}],"actions":[],"properties":[]},"agenttype":"APPLICATION_SERVER"}</tx-match-rule> </rule> </rule-list> </mds-config-data> </mds-data>
Export the single rule belonging to the specified entry point under the specified scope.
curl -X GET --user user1@customer1:welcome http://localhost:8080/controller/transactiondetection/applicationID/scope_name/{rule_type}/{entry_point_type}/{rule_name} >> {xml_name}.xml
Example:
curl -X GET --user user1@customer1:welcome http://localhost:8080/controller/transactiondetection/10/scope0/custom/servlet/rule_name >> {xml_name}.xml
<mds-data> <mds-config-data> <rule-list> <rule agent-type="APPLICATION_SERVER" enabled="true" priority="1" rule-description="" rule-name="ruleInScope1" rule-type="TX_MATCH_RULE" version="0"> <tx-match-rule>{"type":"CUSTOM","txautodiscoveryrule":{"autodiscoveryconfigs":[]},"txcustomrule":{"type":"INCLUDE","txentrypointtype":"SERVLET","matchconditions":[{"type":"HTTP","httpmatch":{"uri":{"type":"IS_NOT_EMPTY","matchstrings":[""]},"parameters":[],"headers":[],"cookies":[]}}],"actions":[],"properties":[]},"agenttype":"APPLICATION_SERVER"}</tx-match-rule> </rule> </rule-list> </mds-config-data> </mds-data>
Import Transaction Detection Rules
Use this to import automatic detection rules in XML format. This call returns different types of detection rule configurations when MDS is enabled.
Importing action will overwrite a rule or add the new rule to the all/specified scopes.
Data for this call should be in the form of multipart/form-data. The URI for this call should be UTF-8 encoded.
Format
POST /controller/transactiondetection/application_id/[scope_name]/rule_type/[entry_point_type]/[rule_name] -F file=@exported_file_name.xml
Input parameters
Parameter Name | Parameter Type | Value | Mandatory | |||
---|---|---|---|---|---|---|
application_id | URI | The application name or application ID. It can be found in the URL in address bar if you click the specified application. It is an Integer value. It will return an error if you do not specify. | Yes | |||
scope_name | URI | The name of the scope from which you are importing the entry point configuration. It will import the rules to all the scopes if you do not specify. | No | |||
rule_type | URI | The type of rule to import, from these options:
It will return an error if you do not specify. | Yes | |||
entry_point_type | URI | The POJO, Servlet, EJB, Spring Bean, etc | No | |||
rule_name | URI | The name of the rule which you are importing. It will import all the rules under a scope or all the scopes if you do not specify. | No |
- When you import, if the XML file does not have
<scope-list>
, then you should type the scope name, otherwise, it will fail, and vice versa. - It will return an error if you use the wrong name(s) in all the parameters.
- If you do not specify the scope when importing, then you should not specify it when exporting.
- Check the
server.log
file if you do not get the expected result after exporting.
Examples
Import the rule(s) to the application without scopes specified:
curl -X POST --user user1@customer1:welcome http://localhost:8080/controller/transactiondetection/{application_id}/{rule_type} -F file=@{exported_file_name}.xml
Import the rule(s) to the application with scopes specified:
curl -X POST --user user1@customer1:welcome http://localhost:8080/controller/transactiondetection/{application_id}/{scope_name}/{rule_type} -F file=@{exported_file_name}.xml
- For more scenarios to import, see Export Transaction Detection Rules.
Export Policies
You can export policies to a JSON file. Before you export policies, export any actions or health rules with their respective APIs.
Format
GET /controller/policies/application_id
Input Parameters
Parameter Name | Parameter Type | Value | Mandatory |
---|---|---|---|
application_id | URI | The application name or application ID. | Yes |
Example
curl --user user1@customer1:your_password http://demo.appdynamics.com/controller/policies/application_id [ { "applicationName" : "ECommerce-Books", "name" : "My Policy", "reactorType" : "IMMEDIATE", "enabled" : true, "batchActionsPerMinute" : true, "durationInMin" : 1, "eventFilterTemplate" : { "applicationName" : "ECommerce-E2E", "healthRuleNames" : null, "eventTypes" : [ "POLICY_OPEN_WARNING", "POLICY_OPEN_CRITICAL", "POLICY_CONTINUES_WARNING", "POLICY_CONTINUES_CRITICAL" ], "rsdTypes" : null, "customEventFilters" : null, "specificEntityNamesByType" : null }, "entityFilterTemplates" : [ ], "actionWrapperTemplates" : [ { "actionTag" : "ops_viewer@acme.com", "type" : null, "value" : 0, "notes" : "Policy: My Policy", "entityIdentifierTemplates" : [ ] } ] } ]
Import Policies
You can import policies that you exported with the Export Policies API. Before you import policies, import any actions or health rules with their respective APIs.
You can import a policy after modifying the defined parameter(s) and overwrite the existing policy with the updated one.
Format
POST /controller/policies/application_id ?overwrite=true_or_false
Input Parameters
Parameter Name | Parameter Type | Value | Mandatory |
---|---|---|---|
application_id | URI | The application name or application ID. | Yes |
overwrite | Query | Set to true to have updates to a policy overwrite the existing policy with the same name. The default is false . | No |
Example
curl -X POST --user user1@customer1:your_password http://demo.appdynamics.com/controller/policies/38 -F file=@ImportPolicies.json {"success":true,"errors":[],"warnings":[]}
Example to Overwrite a Policy
curl -X POST --user user1@customer1:your_password http://demo.appdynamics.com/controller/policies/38\?overwrite\=true -F file=@ImportPolicies.json {"success":true,"errors":[],"warnings":[]}
Export Application Analytics Dynamic Service Configuration
The Analytics Dynamic Service is an AppDynamics app agent plugin that performs Analytics client functions for the agent. Enabling the Dynamic Service enables AppDynamics Analytics for an app agent type. You can export the Dynamic Service configuration to back up the configuration or for later import into another Controller.
Format
GET /controller/analyticsdynamicservice/application_id
Input Parameters
Parameter Name | Parameter Type | Value | Mandatory |
---|---|---|---|
application_id | URI | The application name or application ID. | Yes |
filename | Query | The name of a file to which the configuration will be exported. | No |
Example
curl -i --user user1@customer1:your_password http://demo.appdynamics.com/controller/analyticsdynamicservice/10 <analytics-dynamic-service-configurations controller-version="004-003-000-000"> <analytics-dynamic-service-configuration> <override>true</override> <agent-type>APP_AGENT</agent-type> <enabled>true</enabled> </analytics-dynamic-service-configuration> <analytics-dynamic-service-configuration> <override>true</override> <agent-type>DOT_NET_APP_AGENT</agent-type> <enabled>true</enabled> </analytics-dynamic-service-configuration> <analytics-dynamic-service-configuration> <override>true</override> <agent-type>NODEJS_APP_AGENT</agent-type> <enabled>true</enabled> </analytics-dynamic-service-configuration> </analytics-dynamic-service-configurations>
Import Application Analytics Dynamic Service Configuration
The Analytics Dynamics Service configuration determines whether AppDynamics Analytics is enabled for an app agent type. You use this API to import a previously exported configuration to another Controller.
Data for this call should be in the form of multipart/form-data.
Format
POST /controller/analyticsdynamicservice/application_id
Input Parameters
Parameter Name | Parameter Type | Value | Mandatory |
---|---|---|---|
application_id | URI | The name or ID identifier of the application to which the Analytics Dynamic Service configuration should be applied. | Yes |
Example
curl -i -X POST --user user1@customer1:your_password http://demo.appdynamics.com/controller/analyticsdynamicservice/10 -F file=@dynamicservice.xml
The following example shows sample contents of the dynamicservice.xml
file. Notice that the agent-type
element indicates the type of app server agent to which the enabled state of the dynamics service applies. The APP_AGENT
type represents the Java Agent, the DOT_NET_APP_AGENT
the .NET Agent, and so on.
<analytics-dynamic-service-configurations controller-version="004-003-000-000"> <analytics-dynamic-service-configuration> <override>true</override> <agent-type>APP_AGENT</agent-type> <enabled>false</enabled> </analytics-dynamic-service-configuration> <analytics-dynamic-service-configuration> <override>true</override> <agent-type>DOT_NET_APP_AGENT</agent-type> <enabled>false</enabled> </analytics-dynamic-service-configuration> <analytics-dynamic-service-configuration> <override>true</override> <agent-type>NODEJS_APP_AGENT</agent-type> <enabled>true</enabled> </analytics-dynamic-service-configuration> </analytics-dynamic-service-configurations>