Important: This documentation is about an older version. It's relevant only to the release noted, many of the features and functions have been updated or replaced. Please view the current version.
New Relic data source for Grafana
The New Relic data source plugin allows you to query and visualize New Relic APM (Application Performance Monitoring) and Insights from within Grafana.
Requirements
The New Relic data source has the following requirements:
- Grafana Enterprise with a valid license.
- Grafana user with a server admin or org admin role.
- In order to use the plugin, you need an active New Relic account.
Known limitations
- Ad-hoc filters are not currently supported.
- NRQL queries with multiple
FACET
fields are not supported. - NRQL queries with
COMPARE WITH
operator are not supported. - Currently only APM (Application Performance Monitoring) and Insights are supported.
Install the New Relic data source plugin
To install the data source, refer to Installation.
Get an API key and account ID from New Relic
You will need your personal API key/user API key, refer to New Relic API Key. You will also need your account ID from New Relic, refer to Account ID.
Configure the data source in Grafana
Add a data source by filling in the following fields:
- Name
- Enter a name for this particular New Relic data source.
- Personal API Key / User API key
- Enter your New Relic API key. To find your New Relic API key, refer to Get an API key and account ID from New Relic.
- Account ID
- Enter your New Relic Account ID. To find your New Relic Account ID, refer to Get an API key and account ID from New Relic.
- Region
- Enter your region hosting your service.
Configure the data source with provisioning
It is possible to configure data sources using config files with Grafana’s provisioning system. You can read more about how it works and all the settings you can set for data sources on the provisioning docs page.
Here is an example for provisioning this data source
apiVersion: 1
datasources:
- name: NewRelic
type: grafana-newrelic-datasource
access: proxy
editable: true
enabled: true
secureJsonData:
accountId: 1111111
personalApiKey: Personal API Key
version: 1
Query the data source
The service can be Metrics
, Data Explorer
or NRQL Editor
. To learn more about NRQL Editor/Insights, refer to Insights.
Metrics
If you do not find an option in these dropdown boxes you can still select the option by selecting Create: (your text)
.
- Source
- Select the source type either
Application
orPlugins
and then start typing in the dropdown box to find your source. - Metric
- Select the metric namespace you wish to view from the expanding lists.
- Value
- Enter the metric value you want returned.
- Alias By
- You can combine plain text with the following variables:
$__nr_metric
is the metric name e.g.CPU/User time
.$__nr_metric_value
is the metric value e.g.average_value
.
Data Explorer - BETA
Data explorer allows you to query New Relic Insights data without writing raw NRQL.
Once you switch to Data Explorer mode, the query editor will be pre-configured with a default query. You can make your own data explorer query by customizing the following fields:
You can preview the NRQL query based on your options in the Preview section. If you want to further customize the query, you can switch to the raw NRQL editor by clicking Switch to NRQL Editor.
Read more about NRQL syntax in the New Relic documentation page.
NRQL editor (Insights)
For a New Relic Query Language intro, refer to Introduction to NRQL.
Code completion will be displayed once typing begins. To select a completion option, highlight the desired option with the arrow keys and press Tab to select.
The editor supports the time filter NRQL macro. This will use your Grafana dashboard’s time range in the query by interpolating $__timeFilter
to SINCE <from> UNTIL <to>
.
Example:
SELECT average(value) FROM $event_template_variable $__timeFilter TIMESERIES
Synthetics Queries
New Relic Synthetics data can be queried from the SyntheticCheck
and SyntheticRequest
tables using NRQL Editor/Insights.
For example, the query below returns the count of all requests by response status.
SELECT count(*) FROM SyntheticRequest FACET responseStatus $__timeFilter
The query below returns the success rate of all the monitors.
SELECT (
filter(count(*),WHERE result = 'SUCCESS')
/ filter(count(*), WHERE result IN ('SUCCESS','FAILED'))
* 100
) as 'Success Rate' FROM SyntheticCheck
FACET monitorName $__timeFilter TIMESERIES
For more details about the Synthetic monitoring querying, refer to Events reported by synthetic monitoring
Templates and variables
To add a new New Relic query variable, refer to Add a query variable. Use your New Relic data source as your data source for the following available queries.
New Relic query can return relative endpoints (excluding file extensions). For more information, refer to New Relic REST API
After creating a variable you can use it in your New Relic queries by using variable syntax. For more information refer to Variable syntax. For more information about variables, refer to Templates and variables.
Get the most out of the plugin
- Add Annotations.
- Configure and use Templates and variables.
- Add Transformations.
- Set up alerting; refer to Alerts overview.