Attach your Nerdlet to entities

One way for users to access your Nerdlet is by creating a launcher. The launcher opens a Nerdlet from the Apps page in New Relic. You can also provide access to your Nerdlet from an entity in your account.

In this guide, you'll learn how to attach your Nerdlet to your entities.

Before you begin

If you haven't already:

Create a Nerdpack

Step 1 of 5

Update your CLI:

bash
$
nr1 update
Step 2 of 5

Create a Nerdpack with the CLI:

bash
$
nr1 create --type nerdpack --name entity-nerdlet

This results in a Nerdpack, called entity-nerdlet, which consists of a launcher, called entity-nerdlet-launcher, and a Nerdlet, called entity-nerdlet-nerdlet.

Step 3 of 5

Serve your Nerdpack:

bash
$
cd entity-nerdlet
$
nr1 nerdpack:serve
Step 4 of 5

Go to https://one.newrelic.com/?nerdpacks=local, and navigate to Apps:

Navigate to Apps

?nerdpacks=local is required to enable your locally served Nerdpacks to load in New Relic.

Step 5 of 5

Under Your apps, click your launcher to view your New Relic One application:

Click entity-nerdlet launcher

Attach your Nerdlet to entities

You've seen how you can access your Nerdlet from a launcher. Now, access your Nerdlet from your entities.

Step 1 of 6

From inside your Nerdpack's root directory, open nerdlets/entity-nerdlet-nerdlet/nr1.json. This is your Nerdlet's metadata file. You'll use this file to attach your Nerdlet to entities.

Step 2 of 6

Add a context object with an entities array:

1
{
2
"schemaType": "NERDLET",
3
"id": "entity-nerdlet-nerdlet",
4
"displayName": "EntityNerdletNerdlet",
5
"description": "",
6
"context": {
7
"entities": []
8
}
9
}
nerdlets/entity-nerdlet-nerdlet/nr1.json

This tells New Relic that you want to surface your Nerdlet in an array of entity contexts.

Step 3 of 6

Add an entity context:

1
{
2
"schemaType": "NERDLET",
3
"id": "entity-nerdlet-nerdlet",
4
"displayName": "EntityNerdletNerdlet",
5
"description": "",
6
"context": {
7
"entities": [
8
{
9
"domain": "APM",
10
"type": "APPLICATION"
11
}
12
]
13
}
14
}
nerdlets/entity-nerdlet-nerdlet/nr1.json

Here, you've attached your Nerdlet to all application entities in the APM domain.

Step 4 of 6

Go to APM:

Navigate to APM

Because you're serving your Nerdpack locally, remember that you must still specify the ?nerdpacks=local query string.

Step 5 of 6

Choose any of your applications:

Navigate to APM application

Step 6 of 6

Scroll down to see your Nerdlet attached to the application:

Your Nerdlet attached to the application views

Click this menu option and see your Nerdlet the same way you did with the launcher.

Configure your entities context

The context.entities key in your Nerdlet's nr1.json file specifies which entities your Nerdlet should be attached to.

Specify an entity domain

Attach your Nerdlet to a certain entity domain by specifying the domain as one of the following values:

For example, attach your Nerdlet to all entities in the APM domain:

{
"context": {
"entities": [{ "domain": "APM" }]
}
}

Attach your Nerdlet to all entities except those in a domain:

{
"context": {
"entities": [{ "domain": "!APM" }]
}
}

Attach your Nerdlet to all entities in multiple domains:

{
"context": {
"entities": [{ "domain": "APM" }, { "domain": "BROWSER" }]
}
}

Specify an entity type

Attach your Nerdlet to a certain entity type by specifying the type as one of the following values:

  • APPLICATION
  • HOST
  • MONITOR

For example, attach your Nerdlet to all entities of the APPLICATION type:

{
"context": {
"entities": [{ "type": "APPLICATION" }]
}
}

Attach your Nerdlet to all entities except those of a specified type:

{
"context": {
"entities": [{ "type": "!APPLICATION" }]
}
}

Attach your Nerdlet to every entity whose type matches one of an array of types:

{
"context": {
"entities": [{ "type": "APPLICATION" }, { "type": "MONITOR" }]
}
}

Specify entity tags

Attach your Nerdlet to entities that have a given tag.

For example, attach your Nerdlet to the entity which has a particular GUID:

{
"context": {
"entities": [
{
"tags": [
{
"key": "guid",
"values": ["<SOME ENTITY GUID>"]
}
]
}
]
}
}

Attach your Nerdlet to every entity which has particular accountId and uses the Python programming language:

{
"context": {
"entities": [
{
"tags": [
{
"key": "accountId",
"values": ["<SOME ACCOUNT ID>"]
},
{
"key": "language",
"values": ["python"]
}
]
}
]
}
}

Combine filters

When you filter the entities to which your Nerdlet will be added, you can combine domain, type, and tags:

{
"context": {
"entities": [
{
"domain": "APM",
"type": "APPLICATION",
"tags": [
{
"key": "language",
"values": ["python"]
}
]
},
{
"domain": "SYNTH",
"type": "MONITOR"
},
{
"domain": "BROWSER"
}
]
}
}

In this example, you've attached your Nerdlet to:

  • All APM applications whose metadata tags specify the python language
  • AND all Synthetic monitors
  • AND all Browser entities