| name | newrelic |
| description | Interact with New Relic using the newrelic CLI. Use for: NRQL queries, APM apps/deployments, NerdGraph GraphQL, Synthetics monitors, custom events, workloads, or entity search. Triggers on 'query New Relic', 'NRQL', 'APM', or 'New Relic'. |
New Relic CLI
Configured profile: Tim Case (default) — account ID 7572905.
newrelic <command> [subcommand] [flags]
Global flags available on all commands:
-a <id> / --accountId — override account (default: 7572905)
--format JSON|Text|YAML — output format (default: JSON)
--plain — compact output
--profile <name> — switch auth profile
NRQL Queries
Query the New Relic Database directly:
newrelic nrql query -q 'SELECT count(*) FROM Transaction SINCE 1 hour ago'
newrelic nrql query -q 'SELECT average(duration) FROM Transaction FACET appName SINCE 30 minutes ago'
newrelic nrql query -q 'SELECT * FROM Log WHERE level = "error" SINCE 15 minutes ago LIMIT 50'
newrelic nrql query -q 'SELECT count(*) FROM Transaction TIMESERIES 5 minutes SINCE 1 hour ago'
newrelic nrql history
Entity Search
Find applications, hosts, services, and other monitored entities:
newrelic entity search --name "my-app"
newrelic entity search --type APPLICATION
newrelic entity search --name "api" --type APPLICATION
newrelic entity search --domain APM
newrelic entity search --alert-severity CRITICAL
newrelic entity search --name "web" --reporting true
newrelic entity search --name "api" --fields-filter name,guid,alertSeverity
APM Applications
newrelic apm application search --name "my-app"
newrelic apm application get --applicationId <id>
newrelic apm deployment list --applicationId <id>
newrelic apm deployment create --applicationId <id> \
--revision "v1.2.3" \
--user "tcase" \
--description "Deploy new feature X"
newrelic apm deployment delete --applicationId <id> --deploymentId <id>
Change Tracking
Record a deployment or change event (broader than APM-only deployment markers):
newrelic changeTracking create \
--entityGuid "<guid>" \
--version "v1.2.3" \
--user "tcase" \
--description "Production deploy"
Synthetics Monitors
newrelic synthetics monitor list
newrelic synthetics monitor search --name "homepage check"
newrelic synthetics monitor get --monitorId <id>
newrelic synthetics run --monitorGuids <guid1>,<guid2>
Custom Events
newrelic events post --accountId 7572905 \
--event '{"eventType":"Deploy","version":"1.2.3","env":"production"}'
newrelic events postFile --accountId 7572905 --file events.json
NerdGraph (GraphQL)
For anything the CLI subcommands don't cover, query the NerdGraph API directly:
newrelic nerdgraph query '{ actor { user { name email } } }'
newrelic nerdgraph query '
{
actor {
account(id: 7572905) {
nrql(query: "SELECT count(*) FROM Transaction SINCE 1 hour ago") {
results
}
}
}
}'
See references/nerdgraph.md for common NerdGraph query patterns and entity GUID lookups.
Workloads
newrelic workload list
newrelic workload get --guid <guid>
newrelic workload create --name "Production Services" --entityGuids <guid1>,<guid2>
newrelic workload update --guid <guid> --name "New Name"
newrelic workload delete --guid <guid>
Entity Tags
newrelic entity tags create --guid <guid> --tag env:production,team:platform
newrelic entity tags get --guid <guid>
newrelic entity tags delete --guid <guid> --tag env:production
Output & Scripting Tips
newrelic entity search --name "api" --format JSON
newrelic entity search --name "api" | jq '.[].guid'
newrelic apm application search --name "web" | jq '.[0].id'
newrelic entity search --name "api" --format YAML