Skip to content

Commit

Permalink
Merge pull request #4246 from founddrama/docs/amend-custom-violation-…
Browse files Browse the repository at this point in the history
…descriptions

fix(Alerts): amends 'Alert custom violation descriptions'
  • Loading branch information
rhetoric101 committed Oct 8, 2021
2 parents 9f3b31c + 0468ef4 commit 9eef65f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ The **Custom violation description** field allows you to use a general template

```
This is my condition name : {{conditionName}}
The hostname is : {{tag.fullHostname}}
The hostname is : {{tags.fullHostname}}
```

A violation resulting from this condition would fill in the details and you'd receive a notification like this:
Expand All @@ -61,21 +61,21 @@ Here's a custom violation description template example:

```
this is my condition name : {{conditionName}}
The hostname is : {{tag.fullHostname}}
Owning Team: {{tag.label.owning_team}}
Product: {{tag.label.product}}
ec2VpcId: {{tag.aws.ec2VpcId}}
Service name : {{tag.label.Name}}
AWS Region : {{tag.aws.awsRegion}}
AWS Availability Zone: {{tag.aws.awsAvailabilityZone}}
Department : {{tag.label.department}}
Environment: {{tag.label.environment}}
Cluster: {{tag.clusterName}}
Cluster Role: {{tag.clusterRole}}
EC2 Instance Type: {{tag.instanceType}}
EC2 InstanceID: {{tag.aws.ec2InstanceId}}
EC2 AmiId: {{tag.aws.ec2AmiId}}
EC2 Root Device Type: {{tag.aws.ec2RootDeviceType}}
The hostname is : {{tags.fullHostname}}
Owning Team: {{tags.label.owning_team}}
Product: {{tags.label.product}}
ec2VpcId: {{tags.aws.ec2VpcId}}
Service name : {{tags.label.Name}}
AWS Region : {{tags.aws.awsRegion}}
AWS Availability Zone: {{tags.aws.awsAvailabilityZone}}
Department : {{tags.label.department}}
Environment: {{tags.label.environment}}
Cluster: {{tags.clusterName}}
Cluster Role: {{tags.clusterRole}}
EC2 Instance Type: {{tags.instanceType}}
EC2 InstanceID: {{tags.aws.ec2InstanceId}}
EC2 AmiId: {{tags.aws.ec2AmiId}}
EC2 Root Device Type: {{tags.aws.ec2RootDeviceType}}
```

Here's how that data might appear in a notification:
Expand All @@ -91,21 +91,21 @@ The attributes you can use in a custom violation description are a subset of att
```
The target name is : {{targetName}}
```
* Tag attributes: For tags, you would use the format `{{tag.TAG_NAME}}`. There are two types of tags:
* Tag attributes: For tags, you would use the format `{{tags.TAG_NAME}}`. There are two types of tags:
* Entity-related tags: **For Infrastructure conditions only.** You can find available [entity-related tags](/docs/new-relic-one/use-new-relic-one/core-concepts/tagging-use-tags-organize-group-what-you-monitor#) by going to the [New Relic Explorer](/docs/new-relic-one/use-new-relic-one/ui-data/new-relic-one-entity-explorer-view-performance-across-apps-services-hosts) and looking under a service's **Metadata and tags**, or by viewing violation details. Here's an example of using tags in a custom violation description:

```
The AWS region is : {{tag.aws.awsRegion}}
Responsible team : {{tag.label.owning_team}}
The AWS region is : {{tags.aws.awsRegion}}
Responsible team : {{tags.label.owning_team}}
```
* Facet clause tags: **For NRQL conditions only.** If a NRQL condition uses a FACET clause, you can use `tag` formatting to use those values in your custom violation description. For example, if the NRQL query included `FACET hostName, cluster`, you could then use this:
* Facet clause tags: **For NRQL conditions only.** If a NRQL condition uses a `FACET` clause, you can use `tags` formatting to use those values in your custom violation description. For example, if the NRQL query included `FACET hostName, cluster`, you could then use this:

```
The host is : {{tag.hostName}}
The cluster is : {{tag.cluster}}
The host is : {{tags.hostName}}
The cluster is : {{tags.cluster}}
```

Please note that tag names cannot include a whitespace. The expanded values can include a whitespace, but not the names of the tags themselves.
Please note that tag names cannot include whitespace. The expanded values can include whitespace, but not the names of the tags themselves.

## Create a custom violation description with NRQL [#create-description-nrql]

Expand All @@ -115,20 +115,20 @@ Here's an empty mutation template:

```
mutation {
alertsNrqlConditionStaticUpdate(accountId: <var>YOUR_ACCOUNT_ID</var>, id: "<var>YOUR_CONDITION_ID</var>", condition: {description: ""}) {
<var>YOUR_CUSTOM_VIOLATION_DESCRIPTION</var>
}
}
alertsNrqlConditionStaticUpdate(accountId: <var>YOUR_ACCOUNT_ID</var>, id: "<var>YOUR_CONDITION_ID</var>", condition: {description: ""}) {
<var>YOUR_CUSTOM_VIOLATION_DESCRIPTION</var>
}
}
```

Here's an example mutation with a custom violation description:

```
mutation {
alertsNrqlConditionStaticUpdate(accountId: 123456, id: "123456", condition: {description: "timestamp : {{timestamp}} \n accountId : {{accountId}} \n type : {{type}} \n event : {{event}} \n description : {{description}} \n policyId : {{policyId}} \n policyName: {{policyName}} \n conditionName : {{conditionName}} \n conditionId : {{conditionId}} \n product : {{product}} \n conditionType : {{conditionType}} \n RunbookUrl : {{runbookUrl}} \n nrqlQuery : {{nrqlQuery}} \n nrqlEventType : {{nrqlEventType}} \n targetID : {{targetId}} \n targetName : {{targetName}} \n commandLine : {{tag.commandLine}} \n entityGuid : {{tag.entityGuid}} \n entityName : {{tag.entityName}} \n fullHostname : {{tag.fullHostname}} \n instanceType : {{tag.instanceType}} \n processDisplayName : {{tag.processDisplayName}}"}) {
description
}
}
alertsNrqlConditionStaticUpdate(accountId: 123456, id: "123456", condition: {description: "timestamp : {{timestamp}} \n accountId : {{accountId}} \n type : {{type}} \n event : {{event}} \n description : {{description}} \n policyId : {{policyId}} \n policyName: {{policyName}} \n conditionName : {{conditionName}} \n conditionId : {{conditionId}} \n product : {{product}} \n conditionType : {{conditionType}} \n RunbookUrl : {{runbookUrl}} \n nrqlQuery : {{nrqlQuery}} \n nrqlEventType : {{nrqlEventType}} \n targetID : {{targetId}} \n targetName : {{targetName}} \n commandLine : {{tags.commandLine}} \n entityGuid : {{tags.entityGuid}} \n entityName : {{tags.entityName}} \n fullHostname : {{tags.fullHostname}} \n instanceType : {{tags.instanceType}} \n processDisplayName : {{tags.processDisplayName}}"}) {
description
}
}
```

* For more information on NRQL conditions and using the NerdGraph API, go to [NerdGraph API: NRQL condition alerts](/docs/alerts/alerts-nerdgraph/nerdgraph-examples/nerdgraph-api-alerts-nrql-conditions).
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9eef65f

Please sign in to comment.