Queries are requests that are intended to only fetch data (no side effects). Queries in NerdGraph are not static, meaning that you can ask for more or less data depending on your needs. For each query, you can specify exactly what data you want to retrieve, as long as it is supported by the schema.
This query returns a list of all provider accounts available in your infrastructure data. Depending on the provider, additional properties can be requested. For example, for GCP, you can also ask for the serviceAccountId property, which is needed when linking a new GCP project to New Relic.
Anonymous:
{
actor{
account(id:YOUR_ACCOUNT_ID){
cloud{
providers{
id
name
slug
...onCloudGcpProvider{
serviceAccountId
}
}
}
}
}
}
Named:
querycloudProviders{
actor{
account(id:YOUR_ACCOUNT_ID){
cloud{
providers{
id
name
slug
}
}
}
}
}
This query returns information about a specific provider account for your AWS integration. The properties id, name, slug are requested, along with a list of integrations available to be monitored.
{
actor{
account(id:YOUR_ACCOUNT_ID){
cloud{
provider(slug:"aws"){
id
slug
name
services{
id
slug
name
}
}
}
}
}
}
This query returns information about a specific cloud service integration of a provider. In this example, the integration is the AWS ALB monitoring integration and the provider is AWS. The properties id, name, slug, and isAllowed are requested with the available configuration parameters.
{
actor{
account(id:YOUR_ACCOUNT_ID){
cloud{
provider(slug:"aws"){
service(slug:"alb"){
id
name
slug
isEnabled
}
}
}
}
}
}
This query returns the list of cloud accounts enabled with your New Relic account. (Your cloud account associates your New Relic account and a specific provider account with your integration.) You can enable multiple cloud provider accounts in the same New Relic account, even with the same cloud provider.
{
actor{
account(id:YOUR_ACCOUNT_ID){
cloud{
linkedAccounts{
id
name
createdAt
provider{
id
name
}
}
}
}
}
}
This query returns information about a linked account, including the properties name, providerId, and a list of the cloud integrations enabled for monitoring.
{
actor{
account(id:YOUR_ACCOUNT_ID){
cloud{
linkedAccount(id:LINKED_CLOUD_ACCOUNT_ID){
name
provider{
id
name
}
integrations{
id
name
createdAt
updatedAt
}
}
}
}
}
}
This query returns all monitored integrations for all the provider cloud accounts.
{
actor{
account(id:YOUR_ACCOUNT_ID){
cloud{
linkedAccounts{
name
provider{
id
name
}
integrations{
id
name
service{
id
name
}
createdAt
updatedAt
}
}
}
}
}
}
This query returns information about a specific integration from a specific linked account.
{
actor{
account(id:YOUR_ACCOUNT_ID){
cloud{
linkedAccount(id:LINKED_CLOUD_ACCOUNT_ID){
name
provider{
id
name
}
integration(id:INTEGRATION_ID){
id
name
service{
id
name
}
createdAt
updatedAt
}
}
}
}
}
}
Mutation examples
Mutations are requests that are intended to have side effects, such as creating or updating data on the server. Mutations require the keyword mutation and the name of the mutation. NerdGraph mutations are restricted to a subset of all possible mutations.
This mutation allows linking cloud provider accounts to a New Relic account, creating one or more linked accounts. It can link one specific cloud provider account (for example aws) to the New Relic account or multiple cloud provider accounts to one New Relic account.
Required:
The parameter PROVIDER_ACCOUNT_NAME is required and cannot be empty. It must be unique in your New Relic account.
Other parameters are specific to the provider (AWS, GCP, and Azure) and are also required. In the following sections, you can see which parameters are required for each provider account. After linking an account the createdAt and updatedAt values are equal.
mutation{
cloudLinkAccount(
accounts:{
accountId:YOUR_ACCOUNT_ID,
aws:[{
name:PROVIDER_ACCOUNT_NAME,
# other parameters
}]
azure:[{
name:PROVIDER_ACCOUNT_NAME,
# other parameters
}]
gcp:[{
name:PROVIDER_ACCOUNT_NAME,
# other parameters
}]
}
){
linkedAccounts{
id
name
authLabel
createdAt
updatedAt
}
}
}
}
This mutation links an AWS provider account to your New Relic account.
mutation{
cloudLinkAccount(
accountId:YOUR_ACCOUNT_ID,
accounts:{
aws:[{
name:PROVIDER_ACCOUNT_NAME,
arn:AWS_ROLE_ARN
}]
}
){
linkedAccounts{
id
name
authLabel
createdAt
updatedAt
}
}
}
}
This mutation links an AWS account sending data through CloudWatch Metric Streams to your New Relic account.
mutation{
cloudLinkAccount(
accountId:YOUR_ACCOUNT_ID,
accounts:{
aws:[{
name:PROVIDER_ACCOUNT_NAME,
arn:AWS_ROLE_ARN,
metricCollectionMode:PUSH
}]
}
){
linkedAccounts{
id
name
authLabel
createdAt
updatedAt
}
}
}
}
This mutation links a Microsoft Azure cloud subscription to the New Relic account.
mutation{
cloudLinkAccount(
accountId:YOUR_ACCOUNT_ID
accounts:{
azure:[
{
name:PROVIDER_ACCOUNT_NAME
applicationId:AZURE_APP_ID
clientSecret:AZURE_APP_KEY
tenantId:AZURE_TENANT_ID
subscriptionId:AZURE_SUBSCRIPTION_ID
}
]
}
){
linkedAccounts{
id
name
authLabel
createdAt
updatedAt
}
}
}
This mutation rotates the client secret on an existing Microsoft Azure account.
mutation{
cloudUpdateAccount(
accountId:YOUR_ACCOUNT_ID
accounts:{
azure:{
linkedAccountId:NR_LINKED_ACCOUNT_ID
clientSecret:AZURE_SECRET_TOKEN
}
}
){
linkedAccounts{
id
name
authLabel
createdAt
updatedAt
}
}
}
This mutation links a GCP project to the New Relic account.
This mutation allows you to rename one or more linked provider accounts. The name parameter is required, cannot be empty, and must be unique within your New Relic account.
This mutation allows you to enable the monitoring of one or more specific cloud integrations in an existing cloud account. With this mutation, New Relic records data for the enabled integration from the provider account. For each provider account you have access to different input parameters, matching each available service.
mutation{
cloudConfigureIntegration(
accountId:YOUR_ACCOUNT_ID
integrations:{
PROVIDER_SLUG:{
INTEGRATION_SLUG:[
{
linkedAccountId:LINKED_CLOUD_ACCOUNT_ID
# other parameters
}
]
}
}
){
integrations{
id
name
integration{
id
slug
}
...onSqsIntegration{
awsRegions
}
}
}
}
If you have many provider accounts linked, you can enable the same integration in the many cloud accounts at the same time.
For the output of the operation, you can use GraphQL fragments for integration specific configuration parameters.
mutation{
cloudConfigureIntegration(
accountId:YOUR_ACCOUNT_ID
integrations:{
PROVIDER_SLUG:{
INTEGRATION_SLUG:[
{linkedAccountId:LINKED_CLOUD_ACCOUNT_ID_1}
{linkedAccountId:LINKED_CLOUD_ACCOUNT_ID_2}
]
}
}
){
integrations{
id
name
integration{
id
name
}
...onSqsIntegration{
awsRegions
}
}
}
}
If you have multiple cloud accounts linked, you can also enable multiple integrations in multiple linked cloud accounts at the same time.
For the output of the operation, you can use GraphQL fragments to ask for integration specific configuration parameters.
This mutation also allows you to modify one or more cloud integrations and change one or more configuration parameters. Each service will have specific parameters that you can modify.
For parameters of a type list (for example, awsRegion) supply the full list. For the output of the operation, you can use GraphQL fragments to ask for integration specific configuration parameters.
mutation{
cloudConfigureIntegration(
accountId:YOUR_ACCOUNT_ID
integrations:{
PROVIDER_SLUG:{
INTEGRATION_SLUG:[
{
linkedAccountId:LINKED_CLOUD_ACCOUNT_ID
metricsPollingInterval:NEW_POLLING_INTERVAL
PARAMETER_1:VALUE_1
PARAMETER_N:VALUE_N
}
]
}
}
){
integrations{
id
name
service{
id
slug
}
...onSqsIntegration{
metricsPollingInterval
PARAMETER_1
PARAMETER_N
}
}
errors{
type
message
}
}
}
This mutation allows you to disable an integration and stop data collection for the specific cloud integration.
mutation{
cloudDisableIntegration(
accountId:YOUR_ACCOUNT_ID,
integrations:{
:{
:[
{linkedAccountId:LINKED_CLOUD_ACCOUNT_ID}
]
}
}
){
disabledIntegrations{
id
name
authLabel
provider{
id
}
}
errors{
type
message
}
}
}
This mutation allows you to unlink cloud provider accounts from New Relic account.
Caution
This action can not be undone. However, you can link the account again, but account history will still be lost.
If you have multiple accounts with the same provider account, you can enable the same integration in multiple provider accounts at the same time. Use your New Relic account ID in the YOUR_ACCOUNT_ID parameter and the ID of the provider accounts in the LINKED_CLOUD_ACCOUNT_ID_N parameter value.
To update the polling interval for an AWS SQS integration, use your New Relic account ID in the YOUR_ACCOUNT_ID parameter and the id of the linked provider account in the LINKED_ACCOUNT_ID parameter value: