• /
  • EnglishEspañol日本語한국어Português
  • 로그인지금 시작하기

Get host memory used for an application

You can use the New Relic REST API (v2) to obtain the average memory usage for your application on a single host. This value appears on the APM Summary page in the Hosts table, in the column labeled Memory, or in the corresponding chart.

Get memory usage for a host

To obtain the average Memory usage for one of your app's hosts, use the following command to obtain the metric names[]=Memory/Physical with values[]=percent.

bash
$
curl -X GET "https://api.newrelic.com/v2/applications/$APP_ID/hosts/$HOST_ID/metrics/data.json" \
>
-H "Api-Key:$API_KEY" -i \
>
-d 'names[]=Memory/Physical&values[]=used_mb_by_host&summarize=true'
  • Replace $APP_ID and $API_KEY with your app ID and your API key.
  • Replace $HOST_ID with the host id of your target host.

This example shows the time range for the default time period (last 30 minutes). For additional detail:

To obtain the same information from the New Relic API Explorer (v2):

  1. Select Application Hosts > GET Metric Data, and include your API key.
  2. Add your application ID, host id, and the names[]=Memory/Physical and values[]=used_mb_by_host metrics in the appropriate fields.

Get memory usage for the entire app

To obtain the average Memory usage for your application, use a command similar to the one in the previous example, but remove the reference to hosts and $HOST_ID. Replace $APP_ID and $API_KEY with your app ID and your API key.

bash
$
curl -X GET "https://api.newrelic.com/v2/applications/$APP_ID/metrics/data.json" \
>
-H "Api-Key:$API_KEY" -i \
>
-d 'names[]=Memory/Physical&values[]=total_used_mb&summarize=true'

For additional detail:

To obtain the same information from the New Relic API Explorer (v2):

  1. Select Applications > GET Metric Data, and include your API key.
  2. Add your application ID and the names[]=Memory/Physical and values[]=total_used_mb metrics in the appropriate fields.
Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.