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:
- Sign up for a New Relic account
- Install and configure the New Relic One CLI
Create a Nerdpack
Update your CLI:
$nr1 update
Create a Nerdpack with the CLI:
$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
.
Serve your Nerdpack:
$cd entity-nerdlet$nr1 nerdpack:serve
Go to https://one.newrelic.com/?nerdpacks=local, and navigate to Apps.
?nerdpacks=local
is required to enable your locally served Nerdpacks to load in New Relic.
Under Your apps, click your launcher to view your New Relic application.
Attach your Nerdlet to entities
You've seen how you can access your Nerdlet from a launcher. Now, access your Nerdlet from your entities.
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.
Add a context
object with an entities
array:
{ "schemaType": "NERDLET", "id": "entity-nerdlet-nerdlet", "displayName": "EntityNerdletNerdlet", "description": "", "context": { "entities": [] }}
This tells New Relic that you want to surface your Nerdlet in an array of entity contexts.
Add an entity context:
{ "schemaType": "NERDLET", "id": "entity-nerdlet-nerdlet", "displayName": "EntityNerdletNerdlet", "description": "", "context": { "entities": [ { "domain": "APM", "type": "APPLICATION" } ] }}
Here, you've attached your Nerdlet to all application entities in the APM domain.
Go to APM.
Because you're serving your Nerdpack locally, remember that you must still specify the ?nerdpacks=local
query string.
Choose any of your applications.
Scroll down to see your Nerdlet attached to the application.
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:
APM
: Application Performance MonitoringBROWSER
: BrowserINFRA
: Infrastructure monitoringMOBILE
: Mobile monitoringSYNTH
: Synthetic monitoring
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