Search recommendations


This API returns all existing recommendations given a set of filters.

This topic includes the following sections:

HTTP method: POST

Request URLhttps://portal.us1.onbmc.com/cloudops/api/v1/recommendations/search

HeaderSee HTTP-request-and-response-headers for header information, such as required authorization token.

Request

Request body properties

Property

Type

Required

Description

category

String

Yes

Source of recommendation

Possible values: COST, SECURITY, PERFORMANCE, and so on.

resource_filter

String

No

A query to filter on the resource properties, that is, account_name, service_name, region, and type.

Examples:

  • "account_name STARTS_WITH 'test' AND service_name CONTAINS 'w'"
  • "resource_id IN['vpc-1234567890abcdef0', 'AWS-IRIS3-EC2'] && provider_id='aws'"
  • "type IN ['COMPUTE', 'STORAGE']
  • "type = 'COMPUTE'"

recommendation_filter

String

No

A query to filter on the cost or security recommendation properties, that is, type, rule_id, optimal, and so on.

Example: type IN ['IDLE_VM', 'OVERALLOCATED_VM']

  • "rule_id='1' && optimal='TRUE'"
  • type IN ['IDLE_VM', 'OVERALLOCATED_VM'] && ref_timestamp < 1547812197336
  • "risk>1000 && violation_count > 20 && violation_status='"

Note: Only type field is supported.

resource_pool_id

String

No

Filter the recommendations by resource pool id.

size

Integer

No

Accepted: -1, >0

Default: 20

If -1 is specified, the entire data set is returned.

from

Integer

No

Accepted: >=0

Default: 0

This value is ignored if size = -1

sort

String

No

Sort on different attributes.

Accepted: asc, desc

Default: cost_saving:desc

Example: sort=cost_saving:desc

ignored

Boolean

No

Excludes ignored recommendations based on the flag. By default includes all recommendations.

Default: true.

remediated

Boolean

No

Excludes remediated recommendations based on the flag. By default includes all recommendations.

Default: true.

Example request JSON

{
   "category": "COST",
   "resource_filter" : "resource_id IN ['2002:i-8020', '2002:i-9030'] && provider_id='aws'",
   "recommendation_filter": "type IN ['IDLE_VM', 'OVERALLOCATED_VM']",
   "size": -1,
   "sort": "cost_saving:desc"
}

Response

Example response JSON

[{
       "provider_id": "aws",
       "resource_id": "2002:i-8020",
       "category": "COST",
       "resource_name": "benchmark_t3_2xlarge_std",
       "rule_id": 1,
       "type": "IDLE_VM",
       "type_description": "",
       "short_finding": "This EC2 instance has been detected to be idle for 20 days.",
       "finding": "This EC2 instance has been detected to be idle for 20 days.",
       "recommendation": "This EC2 instance has been detected to be idle. To save $174 per month:<ul><li>Terminate EC2 instance i-8020 ($173 per month)</li><li>Delete EBS volume vol-mars (less than $1 per month)</li></ul>",
       "recommendation_description": "This EC2 instance has been detected to be idle. To save $174 per month:<ul><li>Terminate EC2 instance i-8020 ($173 per month)</li><li>Delete EBS volume vol-mars (less than $1 per month)</li></ul>",
       "cost_saving": 173,
       "cost_saving_currency": "USD",
       "severity": "EFFICIENCY_MEDIUM",
       "optimal": true,
       "resource_details": {
           "account_id": 1230045,
           "account_name": "KL",
           "category": "",
           "name": "qw-er-ty",
           "service_id": "ec2",
           "service_name": "EC2",
           "region": "us-ast-1",
           "provider_id": "aws",
           "resource_id": "pqrs"
        },
       "details": {
           "type_id": "IDLE_VM",
           "idle_days": 20.7,
           "uptime_days": 23.3,
           "idle_days_threshold": 95,
           "billing_option": "RI",
           "instance_type": "t3.2xlarge",
           "attached_volumes": [{
               "volume_id": "vol-mars",
               "volume_name": "benchmark_t3_2xlarge_std_vol"
            }]
        }
    },
    {
       "resource_id": "2002:i-9030",
       "provider_id": "aws",
       "category": "COST",
       "type": "OVERALLOCATED_VM",
       "type_description": "",
       "recommendation": "Resize this EC2 instance from t3.2xlarge to t3.small and its storage to save $17 per month.<br/>t3.small specs:<ul><li>2 vCPU (Current: 8 vCPU)</li><li>2 GB memory (Current: 32 GB)</li><li>Storage: 50 GB (Current: 120 GB)</li></ul>",
       "recommendation_description": "Resize this EC2 instance from t3.2xlarge to t3.small and its storage to save $17 per month.<br/>t3.small specs:<ul><li>2 vCPU (Current: 8 vCPU)</li><li>2 GB memory (Current: 32 GB)</li><li>Storage: 50 GB (Current: 120 GB)</li></ul>",
       "severity": "EFFICIENCY_LOW",
       "rule_id": "1",
       "finding": "This EC2 instance has been underutilizing CPU, memory and storage.",
       "short_finding": "This EC2 instance has been underutilizing CPU, memory and storage.",
       "cost_saving": 50,
       "cost_saving_currency": "USD",
       "optimal": false,
       "resource_details": {
           "account_id": 1230045,
           "account_name": "KL",
           "category": "",
           "name": "qw-er-ty",
           "service_id": "ec2",
           "service_name": "EC2",
           "region": "us-ast-1",
           "provider_id": "aws",
           "resource_id": "pqrs"
        },
       "details": {
           "type_id": "OVERALLOCATED_VM",
           "utilization_metrics_level": "A",
           "utilization_strategy": "AGGRESSIVE",
           "alerted_resources": [
               "CPU",
               "Memory",
               "Storage"
            ],
           "cpu_spare_threshold": 5000,
           "memory_spare_threshold": 1,
           "storage_spare_threshold": 20,
           "source_vcpu": 8,
           "source_memory_gb": 32,
           "source_internal_storage_gb": 0,
           "source_external_storage_gb": 120,
           "source_instance_type": "t3.2xlarge",
           "demand_vcpu": 1.8,
           "demand_memory_gb": 1.5,
           "demand_storage_gb": 49.43,
           "target_vcpu": 2,
           "target_memory_gb": 2,
           "target_external_storage_gb": 50,
           "target_instance_type": "t3.small"
        }
    }
]

Status codes and messages

HTTP code

Message

Description

200

OK

Request succeeded

401


Unauthorized

400


Bad request


 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*