Get individual plugin components (v2)

You can use New Relic's REST API and your API key to obtain information about a single component for your plugin, including:

  • The summary metric values in raw and formatted form as set by the plugin publisher
  • Threshold data indicating where Caution and Critical alerts will be triggered
  • The COMPONENT_ID and COMPONENT_NAME for the plugin
  • Summary information, 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 by component name

To obtain a list of the summary data values for a single component by name, use:

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

List by component ID

To obtain a list of the summary data for a single component by its component ID, use one of the following commands.

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

OR:

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

View the component's output

The output for each component ID will be similar to the following example (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 %"    <---<<<  Formatted SUMMARY_METRIC_VALUE
          }
        },
        {
          "id": 116636,
          "name": "Throughput",
          "metric": "Component/Throughput/Total[bits/sec]",
          "value_functions": ...
           . . . 
         }
        . . .  
      ]
    }
  },
}

For more help

Additional documentation resources include:

  • Get a list of plugins (v2) (using New Relic's REST API to obtain a list of plugins, 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: