List multiple plugin components (v2)

You can use New Relic's REST API and your API key to obtain information about multiple components (instances) for your plugin, including:

  • The summary metric in raw and formatted form as set by the plugin publisher
  • Threshold data indicating when Caution and Critical alerts will be triggered
  • Each COMPONENT_ID and COMPONENT_NAME for the plugin
  • Summary information for each component, including SUMMARY_METRIC_ID and SUMMARY_METRIC_NAME
  • The associated summary metric information, including METRIC_NAME and METRIC_VALUE

You can use the API Explorer to list components.

When using these examples, be sure to replace each placeholder (for example, ${PLUGIN_ID}) with its specific ID.

List all components

To obtain a list of the plugin's components (instances) and the summary data for the account associated with your API key, use:

curl -X GET "https://api.newrelic.com/v2/components.json" \
     -H "X-Api-Key:${APIKEY}" -i 

List by plugin_id

To obtain a list of the plugin's components (instances) and summary data for a single ${PLUGIN_ID}, use the following command.

curl -X GET 'https://api.newrelic.com/v2/components.json' \
     -H "X-Api-Key:${APIKEY}" -i \
     -d 'filter[plugin_id]=${PLUGIN_ID}" 

View the components' output

The output for each component ID will be similar to the following example, which is annotated and formatted for JSON. Due to the potential length of the output, you may want to paginate it.

{
  "components": [
    {
      "id": 3947935,    <---<<<  COMPONENT_ID
      "name": "F5-01-prod",    <---<<<  COMPONENT_NAME
      "summary_metrics": [
        {
          "id": 116635,     <---<<< SUMMARY_METRIC_ID
          "name": "CPU",     <---<<< SUMMARY_METRIC_NAME
          "metric": "Component/CPU/Total/Global[%]",     <---<<< METRIC_NAME
          "value_function": "average_value",     <---<<< METRIC_VALUE
          "thresholds": {
            "caution": 75,     <---<<< SUMMARY_METRIC_CAUTION_THRESHOLD
            "critical": 85     <---<<< SUMMARY_METRIC_CRITICAL_THRESHOLD
          },
          "values": {
            "raw": 78.79225,     <---<<< SUMMARY_METRIC_VALUE
            "formatted": "78.8 %"     <---<<< SUMMARY_METRIC_FORMATTED_VALUE
          }
        },
        {
          "id": 116636,
          "name": "Throughput",
          "metric": "Component/Throughput/Total[bits/sec]",
          ...
        },
      ]
    },
    ....
  ]
}

For more help

Additional documentation resources include:

  • Getting a list of plugins (v2) (using New Relic's REST API to obtain a list of plugins for an account, including each plugin ID, plugin name, and GUID, plus a list of summary metrics available for each of the components or instances)
  • Using the API Explorer (using the API Explorer's user interface to get data in and data out of New Relic)
  • Parts of the API Explorer (a quick reference for how to use each section of the API Explorer)

Recommendations for learning more: