このページでは、コントローラでさまざまなタイプの構成設定をインポートおよびエクスポートするために使用できる AppDynamics API メソッドについて説明します。

構成インポートおよびエクスポート API について

構成インポート/エクスポート API を使用すると、複数のコントローラアカウント、ビジネスアプリケーション、またはコントローラインスタンス間で設定を移行できます。また、これを使用して、トランザクション検出ルール、正常性ルール、カスタムダッシュボードといった設定アーティファクトを既存の設定にプログラムで追加することもできます。 

エクスポートされた設定は、設定アーティファクトの XML または JSON を使用した表現です。ファイルをエクスポートした後、別のアカウントやアプリケーションにアップロードしたり、必要に応じて設定を変更したりすることができます。  

アプリケーションからアクションをエクスポートする

指定したアプリケーション内のすべてのアクションを JSON ファイルにエクスポートするには、これを使用します。

API コールの作成に使用するユーザアカウントに、エクスポート元のアプリケーションのアクションまたはアクションテンプレートを表示する権限が必要です。


形式

GET /controller/actions/application_id 

入力パラメータ

Parameter Name

Parameter Type

Value

必須

application_id

URI

アプリケーション名またはアプリケーション ID。

あり

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
   }
]

アクションをアプリケーションへインポートする

アクションをエクスポートした後は、エクスポート操作によって作成された JSON ファイルを、POST 要求へのペイロードとして渡す別のアプリケーションにインポートできます。

API コールの作成に使用するユーザアカウントには、アカウントでアクションまたはアクションテンプレートを作成する権限が必要です。

既存の設定のアクションと競合する名前を持つインポートファイル内のアクションはインポートされません。これらのアクションのインポートは失敗しますが、新しいアクションは正常にインポートされます。

このコールは、データをマルチパート/フォームデータ コンテンツとして取得します。投稿前に URI の UTF-8 URL エンコーディングを使用します。たとえば、URI のスペース(" ")を "%20" に置き換えることはできません。

形態

POST /controller/actions/application_id 

入力パラメータ

Parameter Name

Parameter Type

Value

必須

application_id

URI

アプリケーション名またはアプリケーション ID。

あり

curl  -X POST --user user1@customer1:your_password http://demo.appdynamics.com/controller/actions/38 -F file=@ExportActions.json
 
{"success":true,"errors":[],"warnings":[]}

ファイルにコンフィギュレーション内のファイルと同じ名前のアクションがある場合、それらのアクションはインポートされず、応答は要求の成功を false.  として示します。次に例を示します。

{"success":false,"errors":["Not importing Action with name: DuplicateExportedDiagnosticAction, since it already exists."],"warnings":["Imported 1 out of 2 actions"]}  

アカウントからメール アクション テンプレートをエクスポートする

この API は、現在のアカウントのすべてのメール アクション テンプレートを JSON 形式でエクスポートします。 

形式

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" : [ ]
} ]

メール アクション テンプレートをインポートする

電子メール アクション テンプレートを JSON ファイルとしてアカウントにインポートするには、これを使用します。 

宛先アカウント内の同じタイプの既存のテンプレートと同じ名前のテンプレートをインポートしようとすると、インポートは失敗します。


このコールのデータは、マルチパート/フォームデータの形式にする必要があります。投稿前に URI の UTF-8 URL エンコーディングを使用します。たとえば、URI のスペース(" ")を "%20" に置き換えることはできません。

フォーマット(Format)

POST /controller/actiontemplate/email

curl  -X POST --user user1@customer1:your_password http://demo.appdynamics.com/controller/actiontemplate/email -F file=@emailactiontemplate.json

{"success":true,"errors":[],"warnings":[]}

アカウントから HTTP リクエスト アクション テンプレートをエクスポートする

この API は、現在のアカウント内のすべての HTTP リクエスト アクション テンプレートを JSON ファイルにエクスポートします。

形式

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" : [ ]
} ]

HTTP アクションテンプレートをアカウントへインポートする

HTTP リクエスト アクション テンプレートをエクスポートした後、宛先アカウントにログインし、エクスポート操作によって作成された JSON ファイルを POST 要求へのペイロードとして渡すことで、それらを別のアカウントにインポートできます。

インポートする前に、エクスポートされたファイルを変更できます。これにより、1 つ以上のテンプレート設定を削除したり、名前を変更したりすることができます。

宛先アカウント内の同じタイプの既存のテンプレートと同じ名前のテンプレートをインポートしようとすると、インポートは失敗します。


投稿前に URI の UTF-8 URL エンコーディングを使用します。たとえば、URI のスペース(" ")を "%20" に置き換えることはできません。

形式

GET /controller/actiontemplate/httprequest  

curl  -X POST --user user1@customer1:your_password http://demo.appdynamics.com/controller/actiontemplate/httprequest -F file=@httpactiontemplate.json

{"success":true,"errors":[],"warnings":[]}

カスタムダッシュボードおよびテンプレートをエクスポートする

コントローラ UI から、またはこの API コールを使用して、カスタムダッシュボードとカスタム ダッシュボード テンプレートを双方向にエクスポートおよびインポートできます。「UIを使ったカスタムダッシュボードとテンプレートのインポート/エクスポート」を参照してください。 

ダッシュボードをエクスポートするには、API コールを作成するユーザにカスタムダッシュボードを表示する権限が必要です。  


エクスポートコールでは、エクスポートするダッシュボードをその ID で識別する必要があります。UI でダッシュボードを開くと、URL の末尾にダッシュボードパラメータとして ID が表示されます。

たとえば、次の URL スニペットでは、カスタムダッシュボード ID は 3 です。location=CDASHBOARD_DETAIL&mode=MODE_DASHBOARD&dashboard=3 

形態

GET /controller/CustomDashboardImportExportServlet?dashboardId=dashboard_id

入力パラメータ

Parameter Name

Parameter Type

Value

必須

dashboardId

[Query(クエリ)]

カスタムダッシュボードの数値 ID。

あり

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
}

次に、完全な応答の例を表示します。

{
  "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


カスタムダッシュボードおよびテンプレートをインポートする

以前にエクスポートし、必要に応じて変更が加えられた JSON 定義に基づいて、カスタムダッシュボードとテンプレートをインポートできます。定義を application/json コンテンツタイプとしてインポートします。

API コールを作成するユーザに、コントローラでのダッシュボード作成権限が必要です。 


このコールのデータは、マルチパート/フォームデータの形式にする必要があります。
投稿前に URI の UTF-8 URL エンコーディングを使用します。たとえば、URI のスペース(" ")を「%20」に置き換えることはできません。

バージョン 4.1 以前では、エクスポートされるカスタムダッシュボードは XML 形式でした。以前に XML データとしてエクスポートされたカスタムダッシュボードを現在のコントローラにインポートできます。ただし、カスタムダッシュボードは JSON データとしてのみエクスポートできます。

フォーマット(Format)

POST /controller/CustomDashboardImportExportServlet 

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"}

アプリケーションから正常性ルールをエクスポートする

すべての正常性ルールを XML 形式で返します。 

API コールの作成に使用するユーザアカウントには、正常性ルールを表示する権限が必要です。 


形態

GET /controller/healthrules/application_id?name=health_rule_name  

入力パラメータ

Parameter Name

Parameter Type

Value

必須

application_id

URI

アプリケーション名またはアプリケーション ID。

あり

name[Query(クエリ)]エクスポートする正常性ルールの名前。指定されていない場合、すべての正常性ルールをエクスポートします。なし


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>

正常性ルールをアプリケーションへインポートする

XML ファイルで定義された正常性ルールをビジネスアプリケーションにインポートできます。 

このコールのデータは、マルチパート/フォームデータの形式にする必要があります。POST 要求で URI の UTF-8 URL エンコーディングを使用します。たとえば、URI のスペース(" ")を「%20」に置き換えることはできません。

デフォルトでは、既存の設定で使用されている名前と同じ名前で投稿されたデータの正常性ルールによって、既存の正常性ルールが上書きされることはありません。同じ名前を持つ既存の正常性ルールを上書きする場合は、overwrite パラメータを使用します。

この構文は、1 つまたは複数の正常性ルール設定をインポートする場合と同じです。投稿された XML ファイル内のすべての正常性ルール設定がインポートされます。

形態

POST /controller/healthrules/application_id?overwrite=true_or_false

入力パラメータ

Parameter Name

Parameter Type

Value

必須

application_id

URI

アプリケーション名またはアプリケーション ID。

あり

overwrite[Query(クエリ)]true に設定すると、投稿されたデータの正常性ルールによって同じ名前を持つ既存の正常性ルールが上書きされます。デフォルトは false です。なし

curl -X POST --user user1@customer1:your_password http://demo.appdynamics.com/controller/healthrules/38 -F file=@uploadhealthrule.xml

Imported 1 health rules successfully.

すでに正常性ルールが存在し、overwrite パラメータを有効にしていない場合は、次の応答が返されます。

Not importing the health rule: healthrulename since it already exists.

トランザクション検出ルールのエクスポート

すべてのトランザクション検出ルールを XML 形式で取得するには、これを使用します。MDS を有効にすると、このコールによってさまざまなタイプの検出ルール設定が返されます。

名前による特定範囲の設定など、さまざまな設定からトランザクション検出ルールを取得できます。 

このコールのクライアントによって使用される URI は、UTF-8 でエンコードされている必要があります。

形式

GET /controller/transactiondetection/application_id/[scope_name]/rule_type/[entry_point_type]/[rule_name] >> xml_name.xml

入力パラメータ

パラメータ名
Parameter Type
必須
application_idURI

アプリケーション名またはアプリケーション ID。指定したアプリケーションをクリックすると、アドレスバー内の URL に表示されることがあります。これは整数値です。

指定しない場合は、エラーが返されます。

あり
scope_nameURI

エントリポイントの設定のエクスポート元となる範囲の名前。

範囲名を custom および auto にすることはできません。範囲名にスペースが含まれている場合は、スペースの代わりに %20 と入力します。例: curl -X GET --user user1@customer1:welcome http://localhost:8080/controller/transactiondetection/10/default%20scope/custom >> result.xml

これを指定しないと、すべての範囲のすべてのルールがエクスポートされます。

なし
rule_typeURI

エクスポートするルールのタイプ。次のオプションがあります。

  • auto:自動検出ルール
  • custom:設定内のカスタム検出ルール

指定しない場合は、エラーが返されます。

あり
entry_point_typeURI

POJO、Servlet、EJB、Spring Bean などがあります。
指定しないと、すべてのエントリポイントタイプに属するルールがエクスポートされます。
 
完全なリストは以下のとおりです(大文字と小文字は区別しません)。
 
binaryRemoting
servlet
strutsAction
springBean
ejb
pojo
jms
webService
aspDotNet
dotNetRemoting
dotNetWebService
wcf
dotNetJms
poco
phpWeb
phpMvc
phpDrupal
phpWordpress
phpCli
phpWebService
nodeJsWeb
native
nativeSDKWeb
nativeDynamicWeb
nativeWebServerWeb
golangSDKWeb
wmbAgentWeb


なし
rule_nameURI

エクスポートするルールの名前。

指定しないと、1 つまたはすべての範囲にあるすべてのルールがエクスポートされます。

なし
  • パラメータの順序は変更できません。パラメータの順序は、application_id/[scope_name]/rule_type/[entry_point_type]/[rule_name] とする必要があります。
  • すべてのパラメータで誤った名前を使用すると、エラーコンテンツを含む XML ファイルが返されます。
  • 階層情報は、範囲リストに表示されます。
  • エクスポート時に範囲を指定しない場合は、インポート時にも指定することができません。
  • エクスポート後に予期した結果が得られない場合は、server.log ファイルを確認してください。


シナリオ:

  • すべての範囲からルールをエクスポートします。

    curl -X GET --user user1@customer1:welcome http://localhost:8080/controller/transactiondetection/applicationID/{rule_type} &gt;&gt; {xml_name}.xml

    例:

    curl -X GET --user user1@customer1:welcome http://localhost:8080/controller/transactiondetection/10/custom &gt;&gt; result.xml

    scope_name を含めない場合、出力は <mds-config-data>: scope-list, rule-list, および scope-rule-mapping-list. の下で 3 つに分かれます。

    <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>
  • 指定した範囲の下でルールをエクスポートします。

    curl -X GET --user user1@customer1:welcome http://localhost:8080/controller/transactiondetection/applicationID/scope_name/{rule_type} &gt;&gt; {xml_name}.xml

    例:

    curl -X GET --user user1@customer1:welcome http://localhost:8080/controller/transactiondetection/10/scope0/custom &gt;&gt; result.xml

    scope_name を含めると、rule-list だけが出力に含まれます。

    <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>
  • すべての範囲の下で、指定したエントリポイントに属するルールをエクスポートします。

    curl -X GET --user user1@customer1:welcome http://localhost:8080/controller/transactiondetection/applicationID/{rule_type}/{entry_point_type} &gt;&gt; {xml_name}.xml

    例:

    curl -X GET --user user1@customer1:welcome http://localhost:8080/controller/transactiondetection/10/custom/servlet &gt;&gt; {xml_name}.xml

    scope_name を含めない場合、出力は <mds-config-data>: scope-list, rule-list, and scope-rule-mapping-list. の下で 3 つに分かれます。

    <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>
  • 指定した範囲の下で、指定したエントリポイントに属する複数のルールをエクスポートします。

    curl -X GET --user user1@customer1:welcome http://localhost:8080/controller/transactiondetection/applicationID/scope_name/{rule_type}/{entry_point_type} &gt;&gt; {xml_name}.xml

    例:

    curl -X GET --user user1@customer1:welcome http://localhost:8080/controller/transactiondetection/10/scope0/custom/servlet &gt;&gt; {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>
  • 指定した範囲の下で、指定したエントリポイントに属する単一ルールをエクスポートします。

    curl -X GET --user user1@customer1:welcome http://localhost:8080/controller/transactiondetection/applicationID/scope_name/{rule_type}/{entry_point_type}/{rule_name} &gt;&gt; {xml_name}.xml

    例:

    curl -X GET --user user1@customer1:welcome http://localhost:8080/controller/transactiondetection/10/scope0/custom/servlet/rule_name &gt;&gt; {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>

トランザクション検出ルールのインポート

自動検出ルールを XML 形式でインポートするには、これを使用します。MDS を有効にすると、このコールによってさまざまなタイプの検出ルール設定が返されます。

アクションをインポートすると、ルールが上書きされるか、すべてまたは指定した範囲に新しいルールが追加されます。

このコールのデータは、マルチパート/フォームデータの形式にする必要があります。 このコールの URI は、UTF-8 でエンコードされている必要があります。

形式

POST /controller/transactiondetection/application_id/[scope_name]/rule_type/[entry_point_type]/[rule_name] -F file=@exported_file_name.xml

入力パラメータ

パラメータ名
Parameter Type
必須
application_idURI

アプリケーション名またはアプリケーション ID。指定したアプリケーションをクリックすると、アドレスバーの URL に表示されることがあります。これは整数値です。

指定しない場合は、エラーが返されます。

あり
scope_nameURI

エントリポイントの設定のインポート元となる範囲の名前。

指定しないと、すべての範囲にルールがインポートされます。

なし
rule_typeURI

インポートするルールのタイプ。次のオプションがあります。

  • auto:自動検出ルール
  • custom:設定内のカスタム検出ルール
  • exclude:トランザクション検出のカスタム除外ルール

指定しない場合は、エラーが返されます。

あり
entry_point_typeURI

POJO、Servlet、EJB、Spring Bean などがあります。

なし
rule_nameURI

インポートするルールの名前。

指定しないと、1 つまたはすべての範囲にあるすべてのルールがインポートされます。

なし
  • インポート時に、XML ファイルに <scope-list> がない場合は、範囲名を入力する必要があります。入力しないとインポートに失敗します。その逆も同様です。
  • すべてのパラメータで誤った名前を使用すると、エラーが返されます。
  • インポート時に範囲を指定しない場合は、エクスポート時にも指定することができません。
  • エクスポート後に予期した結果が得られない場合は、server.log ファイルを確認します。

  • 範囲が指定されていないアプリケーションにルールをインポートします。

    curl -X POST --user user1@customer1:welcome http://localhost:8080/controller/transactiondetection/{application_id}/{rule_type} -F file=@{exported_file_name}.xml
  • 範囲が指定されたアプリケーションにルールをインポートします。

    curl -X POST --user user1@customer1:welcome http://localhost:8080/controller/transactiondetection/{application_id}/{scope_name}/{rule_type} -F file=@{exported_file_name}.xml
  • インポートするシナリオの詳細については、「トランザクション検出ルールのエクスポート」を参照してください。

ポリシーのエクスポート

ポリシーを JSON ファイルにエクスポートできます。ポリシーをエクスポートする前に、対応する API を使用してアクションまたは正常性ルールをエクスポートします。  

形式

GET /controller/policies/application_id 

入力パラメータ

パラメータ名Parameter Type必須
application_idURIアプリケーション名またはアプリケーション ID。あり

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" : [ ]
  } ]
} ]

ポリシーのインポート

Export Policies API を使用してエクスポートしたポリシーをインポートできます。ポリシーをインポートする前に、対応する API を使用してアクションまたは正常性ルールをインポートします。 

定義したパラメータを変更した後にポリシーをインポートし、更新後のポリシーで既存のポリシーを上書きすることができます。

形式

POST /controller/policies/application_id ?overwrite=true_or_false

入力パラメータ

パラメータ名Parameter Type必須
application_idURIアプリケーション名またはアプリケーション ID。あり
overwrite[Query(クエリ)]同じ名前を持つ既存のポリシーを上書きするようにポリシーを更新するには、true に設定します。デフォルトは false です。なし

curl  -X POST --user user1@customer1:your_password http://demo.appdynamics.com/controller/policies/38 -F file=@ImportPolicies.json
 
{"success":true,"errors":[],"warnings":[]}

ポリシーの上書き例

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":[]}

Application Analytics Dynamic Service の設定のエクスポート

Analytics Dynamic Service は、エージェントの分析クライアント機能を実行する AppDynamics アプリケーション エージェント プラグインです。Dynamic Service を有効にすると、アプリケーション エージェント タイプの AppDynamics Analytics が有効になります。Dynamic Service の設定をエクスポートして、設定のバックアップをとったり、後で別のコントローラにインポートしたりできます。    

形式

GET /controller/analyticsdynamicservice/application_id  

入力パラメータ

パラメータ名Parameter Type必須
application_idURIアプリケーション名またはアプリケーション ID。あり
filename[Query(クエリ)]

設定のエクスポート先となるファイルの名前。

なし

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>

Application Analytics Dynamic Service の設定をインポートする

Analytics Dynamics Service の設定で、AppDynamics Analytics をアプリケーション エージェント タイプに対して有効にするかどうかを決定します。以前にエクスポートした設定を別のコントローラにインポートするには、この API を使用します。 

このコールのデータは、マルチパート/フォームデータの形式にする必要があります。

形式

POST /controller/analyticsdynamicservice/application_id  

入力パラメータ

パラメータ名Parameter Type必須
application_idURIAnalytics Dynamic Service の設定を適用する必要があるアプリケーションの名前または ID(識別子)。あり

curl -i -X POST --user user1@customer1:your_password http://demo.appdynamics.com/controller/analyticsdynamicservice/10 -F file=@dynamicservice.xml

次に、dynamicservice.xml ファイルのコンテンツの例を示します。agent-type 要素は、Dynamic Service の有効な状態が適用されるアプリケーション サーバ エージェントのタイプを示しています。APP_AGENT タイプは Java エージェントを表し、DOT_NET_APP_AGENT は .NET エージェントを表す、などです。 

<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>