## 6.2.5.1.3.1.1  Cloud Foundry Commands of Application Autoscaler
The Application Autoscaler plugin for the Cloud Foundry Command Line Interface (cf CLI) includes commands that you can use to get some insights into your scaling policies and for debugging.
Commands for the Application Autoscaler CLI Plugin
| Command                | Alias   | Usage                                                      | Options                                             | Description                                                                                     |                                                                                                                                                                                                                                   |
|------------------------|---------|------------------------------------------------------------|-----------------------------------------------------|-------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| cf autoscaling- policy | asp     | cf autoscal ing- policy APP_NAME [-- output PATH_TO_ FILE] | --output : dump the policy to a file in JSON format | Retrieve the scal- ing policy of an application. The policy will be dis- played in JSON format. | Examples View scaling policy, replace APP_NAME with the name of your application: $ cf autoscaling- policy APP_NAME Showing policy for app APP_NAME... { "instance_min_cou nt": 1, "instance_max_cou nt": 5, "scaling_rules": [ { |
| Command                        | Alias   | Usage                                                          | Options   | Description                                                                                                                           | Examples                                                                                               |
|--------------------------------|---------|----------------------------------------------------------------|-----------|---------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------|
| cf attach- autoscaling- policy | aasp    | cf attach- autoscal ing- policy APP_NAME PATH_TO_ POLICY_F ILE |           | Attach a scaling policy to an ap- plication. The pol- icy file must be a JSON file. See policy specifi- cation for the policy format. | $ cf attach- autoscaling- policy APP_NAME PATH_TO_POLICY_FI LE Attaching policy for app APP_NAME... OK |
| cf detach- autoscaling- policy | dasp    | cf detach- autoscal ing- policy APP_NAME                       |           | Detach the scaling policy from an ap- plication. The pol- icy will be deleted when detached.                                          | $ cf detach- autoscaling- policy APP_NAME Detaching policy for app APP_NAME... OK                      |
| Command                 | Alias   | Usage                                                                                                                       | Options                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | Description                                                                                                                                                                                               | Examples                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
|-------------------------|---------|-----------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| cf autoscaling- metrics | asm     | cf autoscal ing- metrics APP_NAME METRIC_N AME [-- start START_TI ME] [-- end END_TIME ] [-- asc] [-- output PATH_TO_ FILE] | • METRIC_NAME : default metrics "memoryused, memoryutil, re- sponsetime, throughput, cpu" or customized name for your own met- rics. • --start : start time of metrics collected with format yyyy-MM- ddTHH:mm:ss+/- HH:mm or yyyy-MM- ddTHH:mm:ssZ, default to very be- ginning if not speci- fied. • --end : end time of the metrics collected with format yyyy-MM- ddTHH:mm:ss+/- HH:mm or yyyy-MM- ddTHH:mm:ssZ, default to current time if not spefi- cied. • --asc : display in as- cending order, de- fault to descending order if not speci- fied • --output : dump the metrics to a file | Retrieve the ag- gregated metrics of an application. You can specify the start/end time of the returned query result and the display order (ascending or de- scending). The metrics are shown in a table. | $ cf autoscaling- metrics APP_NAME memoryused -- start 2018-12-27T11:49: 00+08:00 --end 2018-12-27T11:52: 20+08:00 --asc Retreiving aggregated metrics for app APP_NAME... Metrics Name Value Timestamp memoryused 62MB 2018-12-27T11:49: 00+08:00 memoryused 62MB 2018-12-27T11:49: 40+08:00 memoryused 61MB 2018-12-27T11:50: 20+08:00 memoryused 62MB 2018-12-27T11:51: 00+08:00 memoryused 62MB 2018-12-27T11:51: 40+08:00 Description of table-col- umns: • Metrics Name: name of the current metric item • Value: the value of the current metric item with unit • Timestamp: collect time of the current metric item |
| Command                 | Alias   | Usage                                                                                                         | Options                                                                                                                                                                                                                                                                                                                                                                                                                                                           | Description                                                                                                                                                                                                                  | Examples                                                                                                                                                                                                                                                                                                 |
|-------------------------|---------|---------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| cf autoscaling- history | ash     | cf autoscal ing- history APP_NAME [--start START_TI ME] [-- end END_TIME ] [-- asc] [-- output PATH_TO_ FILE] | • --start : start time of the scal- ing history with format yyyy-MM- ddTHH:mm:ss+/- HH:mm or yyyy-MM- ddTHH:mm:ssZ, default to very be- ginning if not speci- fied. • --end : end time of the scaling history with format yyyy-MM- ddTHH:mm:ss+/- HH:mm or yyyy-MM- ddTHH:mm:ssZ, default to current time if not spefi- cied. • --asc : display in as- cending order, de- fault to descending order if not speci- fied • --output : dump the scaling history to a | Retrieve the scal- ing event history of an application. You can specify the start/end time of the returned query result, and the display order (ascending or de- scending). The scaling event his- tory is shown in a table. | $ cf autoscaling- history APP_NAME --start 2018-08-16T17:58: 53+08:00 --end 2018-08-16T18:01: 00+08:00 --asc Showing history for app APP_NAME... Scaling Type Status Instance Changes Time Action Error dynamic failed 2- >-1 2018-08-16T17:58: 53+08:00 -1 instance(s) because throughput 10rps for 120 |
|                         |         |                                                                                                               |                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |                                                                                                                                                                                                                              | succeeded 2- >3                                                                                                                                                                                                                                                                                          |
|                         |         |                                                                                                               |                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |                                                                                                                                                                                                                              | 2018-08-16T17:59: 33+08:00 +1 instance(s) because                                                                                                                                                                                                                                                        |
|                         |         |                                                                                                               |                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |                                                                                                                                                                                                                              | succeeded 3- >6                                                                                                                                                                                                                                                                                          |
|                         |         |                                                                                                               |                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |                                                                                                                                                                                                                              | 2018-08-16T18:00: 00+08:00 3 instance(s) because limited                                                                                                                                                                                                                                                 |
| Command   | Alias   | Usage   | Options   | Description   | Examples                                                                                                                                                               |
|-----------|---------|---------|-----------|---------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|           |         |         |           |               | by min instances 6                                                                                                                                                     |
|           |         |         |           |               | Description of table-col- umns:                                                                                                                                        |
|           |         |         |           |               | • Scaling Type: the trig- ger type of the scal- ing action, possible scal- ing types: dynamic and scheduled • dynamic: the scal-                                       |
|           |         |         |           |               | ing action is trig- gered by a dy- namic rule (mem- oryused, memoryu- til, responsetime or throughput) • scheduled: the scal- ing action is trig- gered by a recurring |
|           |         |         |           |               | • Status: the result of the scaling action: suc- ceeded or failed                                                                                                      |
|           |         |         |           |               | • Instance Changes: how the instances number get changed (e.g. 1->2 means the application was scaled out from 1 in- stance to 2) • Time: the finish time of            |
|           |         |         |           |               | scaling action, no mater succeeded or failed • Action: the detail in- formation about why and how the application                                                      |
|           |         |         |           |               | scaled • Error: the reason why scaling failed                                                                                                                          |
## Related Information
What Is Application Autoscaler? Initial Setup Defining a Scaling Policy