cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Not able to import health rule using API

Hi team,

I am not able to import the health rules using the API access token method or by my username and password. Whenever I try to import it using either of the methods, the response comes as "null". Could you please guide me as to where I am going wrong?

The command I am using while pushing using the access token(I have all the default permissions set for my client id)(not working): 

curl -X POST "https://customername.saas.appdynamics.com/controller/healthrules/application_name" -F file=@test.xml -H "Authorization: Bearer <access_token>"

Note: I am fetching the access token using the below command, which is working fine

curl -X POST -H "Content-Type: application/x-www-form-urlencoded" "https://customername.saas.appdynamics.com/controller/api/oauth/access_token" -d 'grant_type=client_credentials&client_id=<client_id>@<account_name>&client_secret=<client_secret>'

Command I am using while pushing using username, password(not working): 

curl -X POST --user username@accountname:password https://customername.saas.appdynamics.com/controller/healthrules/Application_name -F file=@test.xml

The health rule xml file below contains seven health rules related to Average Response time, Calls, CPU, Error, Garbage collection, Heap, and Memory.
The XML file of health rules:

<health-rules>
<health-rule>
        <name>APM_Average_Response_Time_x_tier_name</name>
        <type>NODE_HEALTH_TRANSACTION_PERFORMANCE</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-infra-match-criteria>
                <type>SPECIFIC_TIERS</type>
                <application-components>
                    <application-component>x_tier_name</application-component>
                </application-components>
            </affected-infra-match-criteria>
        </affected-entities-match-criteria>
        <critical-execution-criteria>
            <condition-aggregation-type>ALL</condition-aggregation-type>
            <entity-aggregation-scope>
                <type>ANY</type>
                <value>0</value>
            </entity-aggregation-scope>
            <policy-condition>
                <type>leaf</type>
                <display-name>Average Response time (ms)</display-name>
                <short-name>A</short-name>
                <condition-value-type>BASELINE_STANDARD_DEVIATION</condition-value-type>
                <condition-value>9.0</condition-value>
                <operator>EQUALS</operator>
                <condition-expression/>
                <use-active-baseline>true</use-active-baseline>
                <trigger-on-no-data>false</trigger-on-no-data>
                <enable-triggers>false</enable-triggers>
                <min-triggers>15</min-triggers>
                <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 Response Time (ms)</logical-metric-name>
                    </metric-definition>
                </metric-expression>
            </policy-condition>
        </critical-execution-criteria>
        <warning-execution-criteria>
            <condition-aggregation-type>ALL</condition-aggregation-type>
            <entity-aggregation-scope>
                <type>ANY</type>
                <value>0</value>
            </entity-aggregation-scope>
            <policy-condition>
                <type>leaf</type>
                <display-name>Average Response time (ms)</display-name>
                <short-name>A</short-name>
                <condition-value-type>BASELINE_STANDARD_DEVIATION</condition-value-type>
                <condition-value>7.0</condition-value>
                <operator>EQUALS</operator>
                <condition-expression/>
                <use-active-baseline>true</use-active-baseline>
                <trigger-on-no-data>false</trigger-on-no-data>
                <enable-triggers>false</enable-triggers>
                <min-triggers>15</min-triggers>
                <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 Response Time (ms)</logical-metric-name>
                    </metric-definition>
                </metric-expression>
            </policy-condition>
        </warning-execution-criteria>
    </health-rule>

    <health-rule>
        <name>APM_Calls_x_tier_name</name>
        <type>NODE_HEALTH_TRANSACTION_PERFORMANCE</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-infra-match-criteria>
                <type>SPECIFIC_TIERS</type>
                <application-components>
                    <application-component>x_tier_name</application-component>
                </application-components>
            </affected-infra-match-criteria>
        </affected-entities-match-criteria>
        <critical-execution-criteria>
            <condition-aggregation-type>ALL</condition-aggregation-type>
            <entity-aggregation-scope>
                <type>ANY</type>
                <value>0</value>
            </entity-aggregation-scope>
            <policy-condition>
                <type>leaf</type>
                <display-name>Calls Per Minute</display-name>
                <short-name>A</short-name>
                <condition-value-type>BASELINE_STANDARD_DEVIATION</condition-value-type>
                <condition-value>5.0</condition-value>
                <operator>EQUALS</operator>
                <condition-expression/>
                <use-active-baseline>true</use-active-baseline>
                <trigger-on-no-data>false</trigger-on-no-data>
                <enable-triggers>false</enable-triggers>
                <min-triggers>15</min-triggers>
                <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>Calls per Minute</logical-metric-name>
                    </metric-definition>
                </metric-expression>
            </policy-condition>
        </critical-execution-criteria>
        <warning-execution-criteria>
            <condition-aggregation-type>ALL</condition-aggregation-type>
            <entity-aggregation-scope>
                <type>ANY</type>
                <value>0</value>
            </entity-aggregation-scope>
            <policy-condition>
                <type>leaf</type>
                <display-name>Calls Per Minute</display-name>
                <short-name>A</short-name>
                <condition-value-type>BASELINE_STANDARD_DEVIATION</condition-value-type>
                <condition-value>3.0</condition-value>
                <operator>EQUALS</operator>
                <condition-expression/>
                <use-active-baseline>true</use-active-baseline>
                <trigger-on-no-data>false</trigger-on-no-data>
                <enable-triggers>false</enable-triggers>
                <min-triggers>15</min-triggers>
                <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>Calls per Minute</logical-metric-name>
                    </metric-definition>
                </metric-expression>
            </policy-condition>
        </warning-execution-criteria>
    </health-rule>


<health-rule>
        <name>APM_CPU_x_tier_name</name>
        <type>INFRASTRUCTURE</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-infra-match-criteria>
                <type>SPECIFIC_TIERS</type>
                <application-components>
                    <application-component>x_tier_name</application-component>
                </application-components>
            </affected-infra-match-criteria>
        </affected-entities-match-criteria>
        <critical-execution-criteria>
            <condition-aggregation-type>ALL</condition-aggregation-type>
            <entity-aggregation-scope>
                <type>ANY</type>
                <value>0</value>
            </entity-aggregation-scope>
            <policy-condition>
                <type>leaf</type>
                <display-name>CPU | % Busy</display-name>
                <short-name>A</short-name>
                <condition-value-type>ABSOLUTE</condition-value-type>
                <condition-value>90.0</condition-value>
                <operator>GREATER_THAN</operator>
                <condition-expression/>
                <use-active-baseline>false</use-active-baseline>
                <trigger-on-no-data>false</trigger-on-no-data>
                <enable-triggers>false</enable-triggers>
                <min-triggers>15</min-triggers>
                <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>Hardware Resources|CPU|%Busy</logical-metric-name>
                    </metric-definition>
                </metric-expression>
            </policy-condition>
        </critical-execution-criteria>
        <warning-execution-criteria>
            <condition-aggregation-type>ALL</condition-aggregation-type>
            <entity-aggregation-scope>
                <type>ANY</type>
                <value>0</value>
            </entity-aggregation-scope>
            <policy-condition>
                <type>leaf</type>
                <display-name>CPU | % Busy</display-name>
                <short-name>A</short-name>
                <condition-value-type>ABSOLUTE</condition-value-type>
                <condition-value>75.0</condition-value>
                <operator>GREATER_THAN</operator>
                <condition-expression/>
                <use-active-baseline>false</use-active-baseline>
                <trigger-on-no-data>false</trigger-on-no-data>
                <enable-triggers>false</enable-triggers>
                <min-triggers>15</min-triggers>
                <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>Hardware Resources|CPU|%Busy</logical-metric-name>
                    </metric-definition>
                </metric-expression>
            </policy-condition>
        </warning-execution-criteria>
    </health-rule>

<health-rule>
        <name>APM_Errors_x_tier_name</name>
        <type>NODE_HEALTH_TRANSACTION_PERFORMANCE</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-infra-match-criteria>
                <type>SPECIFIC_TIERS</type>
                <application-components>
                    <application-component>x_tier_name</application-component>
                </application-components>
            </affected-infra-match-criteria>
        </affected-entities-match-criteria>
        <critical-execution-criteria>
            <condition-aggregation-type>ALL</condition-aggregation-type>
            <entity-aggregation-scope>
                <type>ANY</type>
                <value>0</value>
            </entity-aggregation-scope>
            <policy-condition>
                <type>leaf</type>
                <display-name>Errors per minute</display-name>
                <short-name>A</short-name>
                <condition-value-type>BASELINE_STANDARD_DEVIATION</condition-value-type>
                <condition-value>5.0</condition-value>
                <operator>GREATER_THAN</operator>
                <condition-expression/>
                <use-active-baseline>true</use-active-baseline>
                <trigger-on-no-data>false</trigger-on-no-data>
                <enable-triggers>false</enable-triggers>
                <min-triggers>15</min-triggers>
                <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>Errors per Minute</logical-metric-name>
                    </metric-definition>
                </metric-expression>
            </policy-condition>
        </critical-execution-criteria>
        <warning-execution-criteria>
            <condition-aggregation-type>ALL</condition-aggregation-type>
            <entity-aggregation-scope>
                <type>ANY</type>
                <value>0</value>
            </entity-aggregation-scope>
            <policy-condition>
                <type>leaf</type>
                <display-name>Errors per minute</display-name>
                <short-name>A</short-name>
                <condition-value-type>BASELINE_STANDARD_DEVIATION</condition-value-type>
                <condition-value>3.0</condition-value>
                <operator>GREATER_THAN</operator>
                <condition-expression/>
                <use-active-baseline>true</use-active-baseline>
                <trigger-on-no-data>false</trigger-on-no-data>
                <enable-triggers>false</enable-triggers>
                <min-triggers>15</min-triggers>
                <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>Errors per Minute</logical-metric-name>
                    </metric-definition>
                </metric-expression>
            </policy-condition>
        </warning-execution-criteria>
    </health-rule>

<health-rule>
        <name>APM_Memory_x_tier_name</name>
        <type>INFRASTRUCTURE</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-infra-match-criteria>
                <type>SPECIFIC_TIERS</type>
                <application-components>
                    <application-component>x_tier_name</application-component>
                </application-components>
            </affected-infra-match-criteria>
        </affected-entities-match-criteria>
        <critical-execution-criteria>
            <condition-aggregation-type>ALL</condition-aggregation-type>
            <entity-aggregation-scope>
                <type>ANY</type>
                <value>0</value>
            </entity-aggregation-scope>
            <policy-condition>
                <type>leaf</type>
                <display-name>Memory | Used (%)</display-name>
                <short-name>A</short-name>
                <condition-value-type>ABSOLUTE</condition-value-type>
                <condition-value>90.0</condition-value>
                <operator>GREATER_THAN</operator>
                <condition-expression/>
                <use-active-baseline>false</use-active-baseline>
                <trigger-on-no-data>false</trigger-on-no-data>
                <enable-triggers>false</enable-triggers>
                <min-triggers>15</min-triggers>
                <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>Hardware Resources|Memory|Used %</logical-metric-name>
                    </metric-definition>
                </metric-expression>
            </policy-condition>
        </critical-execution-criteria>
        <warning-execution-criteria>
            <condition-aggregation-type>ALL</condition-aggregation-type>
            <entity-aggregation-scope>
                <type>ANY</type>
                <value>0</value>
            </entity-aggregation-scope>
            <policy-condition>
                <type>leaf</type>
                <display-name>Memory | Used (%)</display-name>
                <short-name>A</short-name>
                <condition-value-type>ABSOLUTE</condition-value-type>
                <condition-value>75.0</condition-value>
                <operator>GREATER_THAN</operator>
                <condition-expression/>
                <use-active-baseline>false</use-active-baseline>
                <trigger-on-no-data>false</trigger-on-no-data>
                <enable-triggers>false</enable-triggers>
                <min-triggers>15</min-triggers>
                <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>Hardware Resources|Memory|Used %</logical-metric-name>
                    </metric-definition>
                </metric-expression>
            </policy-condition>
        </warning-execution-criteria>
</health-rule>

<health-rule>
        <name>APM_Heap_JVM_x_tier_name</name>
        <type>INFRASTRUCTURE</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-infra-match-criteria>
                <type>SPECIFIC_TIERS</type>
                <application-components>
                    <application-component>x_tier_name</application-component>
                </application-components>
            </affected-infra-match-criteria>
        </affected-entities-match-criteria>
        <critical-execution-criteria>
            <condition-aggregation-type>ALL</condition-aggregation-type>
            <entity-aggregation-scope>
                <type>ANY</type>
                <value>0</value>
            </entity-aggregation-scope>
            <policy-condition>
                <type>leaf</type>
                <display-name>Memory:Heap|Used %</display-name>
                <short-name>A</short-name>
                <condition-value-type>BASELINE_STANDARD_DEVIATION</condition-value-type>
                <condition-value>5.0</condition-value>
                <operator>GREATER_THAN</operator>
                <condition-expression/>
                <use-active-baseline>true</use-active-baseline>
                <trigger-on-no-data>false</trigger-on-no-data>
                <enable-triggers>false</enable-triggers>
                <min-triggers>15</min-triggers>
                <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>JVM|Memory:Heap|Used %</logical-metric-name>
                    </metric-definition>
                </metric-expression>
            </policy-condition>
        </critical-execution-criteria>
        <warning-execution-criteria>
            <condition-aggregation-type>ALL</condition-aggregation-type>
            <entity-aggregation-scope>
                <type>ANY</type>
                <value>0</value>
            </entity-aggregation-scope>
            <policy-condition>
                <type>leaf</type>
                <display-name>Memory:Heap|Used %</display-name>
                <short-name>A</short-name>
                <condition-value-type>BASELINE_STANDARD_DEVIATION</condition-value-type>
                <condition-value>3.0</condition-value>
                <operator>GREATER_THAN</operator>
                <condition-expression/>
                <use-active-baseline>true</use-active-baseline>
                <trigger-on-no-data>false</trigger-on-no-data>
                <enable-triggers>false</enable-triggers>
                <min-triggers>15</min-triggers>
                <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>JVM|Memory:Heap|Used %</logical-metric-name>
                    </metric-definition>
                </metric-expression>
            </policy-condition>
        </warning-execution-criteria>
    </health-rule>

<health-rule>
        <name>APM_Garbage_Collection_JVM_x_tier_name</name>
        <type>INFRASTRUCTURE</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-infra-match-criteria>
                <type>SPECIFIC_TIERS</type>
                <application-components>
                    <application-component>x_tier_name</application-component>
                </application-components>
            </affected-infra-match-criteria>
        </affected-entities-match-criteria>
        <critical-execution-criteria>
            <condition-aggregation-type>ALL</condition-aggregation-type>
            <entity-aggregation-scope>
                <type>ANY</type>
                <value>0</value>
            </entity-aggregation-scope>
            <policy-condition>
                <type>leaf</type>
                <display-name>GC Time spent per min (ms)</display-name>
                <short-name>A</short-name>
                <condition-value-type>BASELINE_STANDARD_DEVIATION</condition-value-type>
                <condition-value>5.0</condition-value>
                <operator>GREATER_THAN</operator>
                <condition-expression/>
                <use-active-baseline>true</use-active-baseline>
                <trigger-on-no-data>false</trigger-on-no-data>
                <enable-triggers>false</enable-triggers>
                <min-triggers>15</min-triggers>
                <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>JVM|Garbage Collection|GC Time Spent Per Min (ms)</logical-metric-name>
                    </metric-definition>
                </metric-expression>
            </policy-condition>
        </critical-execution-criteria>
        <warning-execution-criteria>
            <condition-aggregation-type>ALL</condition-aggregation-type>
            <entity-aggregation-scope>
                <type>ANY</type>
                <value>0</value>
            </entity-aggregation-scope>
            <policy-condition>
                <type>leaf</type>
                <display-name>GC Time spent per min (ms)</display-name>
                <short-name>A</short-name>
                <condition-value-type>BASELINE_STANDARD_DEVIATION</condition-value-type>
                <condition-value>3.0</condition-value>
                <operator>GREATER_THAN</operator>
                <condition-expression/>
                <use-active-baseline>true</use-active-baseline>
                <trigger-on-no-data>false</trigger-on-no-data>
                <enable-triggers>false</enable-triggers>
                <min-triggers>15</min-triggers>
                <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>JVM|Garbage Collection|GC Time Spent Per Min (ms)</logical-metric-name>
                    </metric-definition>
                </metric-expression>
            </policy-condition>
        </warning-execution-criteria>
</health-rule>

</health-rules>

 
Thank you

 

Regards,

Mohammed Saad

1 REPLY 1

Ryan.Paredez
Community Manager

Hi @Mohammed Saad.Shaikh,

I wanted to share this AppD Docs page that has some info on exporting and importing Health Rules via API.

Let me know if it helps.


Thanks,

Ryan, Cisco AppDynamics Community Manager




Found something helpful? Click the Accept as Solution button to help others find answers faster.

Liked something? Click the Thumbs Up button.



Check out Observabiity in Action

new deep dive videos weekly in the Knowledge Base.