360 Secure SkillHub
360 安全技能中心

New Relic CLI Skills

该 Skill 以 newrelic CLI 为核心,支持 NRQL 查询、APM 性能排查、AI Monitoring、部署标记、告警与基础设施查看、诊断及 IAM 管理;附带脚本和参考文档,并对写入操作提出审批与回读校验要求。

分类:数据
vince-winkintel
vince-winkintel
热度 50.74
最近更新 2026-12-03 01:16:51

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add vince-winkintel/newrelic-cli-skills
兼容性
通用兼容
联网要求
需要联网
数据出网
必须出网
Metadata
name
newrelic-cli-skills
version
1.0.13
description
Monitor, query, and manage New Relic observability data via the newrelic CLI. Covers NRQL queries and organization-scoped macros, AI Monitoring telemetry and datasets, APM performance triage, deployment markers, read-only alert and incident inspection, infrastructure monitoring, agent diagnostics, and identity/access administration. Use when user asks about LLM token usage, AI application telemetry or datasets, application performance, error rates, slow transactions, deployment tracking, incident inspection, New Relic setup, users, groups, roles, permissions, or access grants.
metadata
{"openclaw":{"purpose":"New Relic observability skill for both read and targeted write workflows. Reads APM metrics, NRQL query results, AI Monitoring events (including potentially sensitive prompt/response content and tool inputs), incidents, entity alert severity, and infrastructure host data from the New Relic API. The documented New Relic CLI has no alerts command tree, so alert and incident workflows in this repo are read-only. Write operations include deployment marker creation and organization-scoped NRQL macro creation/update/deletion, plus irreversible AI Monitoring dataset/version deletion. Dataset deletion cascades to all versions; last-version deletion also deletes its dataset. Require explicit approval of exact dataset/version IDs and cascade scope, fresh read-back before deletion, and exact-result verification afterward; do not bypass confirmation for automation. See aimonitoring/references/datasets.md. Require explicit approval before macro writes, inspect downstream query/dashboard impact with coverage gaps disclosed, and read the exact target back. Macros are not supported in alert conditions; cached query execution may lag behind stored-state read-back. Diagnostics validate writes hostname-bearing NrIntegrationError tracer telemetry; require explicit approval for the verified effective target and hostname disclosure, and do not blindly retry interrupted writes. Diagnostics run can download and execute nrdiag, including when listing suites; require explicit download/execution approval and separate authorization for any diagnostic-data upload. The advertised attachment-key flag is not forwarded by this CLI runner; do not assume upload. IAM workflows add user/group CRUD, membership changes, and access-grant creation/revocation; require explicit confirmation before IAM writes and verify each write by reading the target back. Helper scripts execute newrelic CLI commands only and should validate untrusted inputs before embedding them in NRQL.\n","requires":{"env":["NEW_RELIC_API_KEY","NEW_RELIC_ACCOUNT_ID"],"binaries":["newrelic"],"notes":"NEW_RELIC_API_KEY must be a User Key (starts with NRAK-).\nNEW_RELIC_ACCOUNT_ID is the numeric account ID from the NR UI.\nAI Monitoring dataset and dataset-version commands require CLI >=v0.117.0;\ncheck newrelic --version before using them. This floor applies only to those commands.\nSee references/installation.md for CLI installation instructions.\nUse an API key scoped to the minimum required accounts.\nMacro writes require Organization product admin or Organization manager access;\nOrganization read only grants macro reads. Confirm the effective organization\nand its primary region before macro operations; environment credentials can\noverride the selected profile. See nrql/SKILL.md for preflight and write gates.\nIAM writes also require organization-level authorization for the user associated\nwith the key: Authentication domain manager or Organization manager for\nusermanagement, and Organization manager for accessmanagement grant writes.\nAdministrative user-management access requires a core or full platform user.\n"}}}
tags
["newrelic","observability","apm","monitoring","performance","nrql","ai-monitoring","iam"]

New Relic CLI Skills

Quick Decision Tree

Performance issue reported? → apm/SKILL.md Need to query data or manage organization-scoped NRQL macros? → nrql/SKILL.md AI/LLM telemetry, datasets, or dataset versions? → aimonitoring/SKILL.md Recording a deployment? → deployments/SKILL.md Inspecting alerts or incidents? → alerts/SKILL.md Infrastructure/host issues? → infrastructure/SKILL.md Agent not reporting? → diagnostics/SKILL.md Users, groups, roles, permissions, or access grants? → iam/SKILL.md


Setup & Auth

For installation, use Homebrew on macOS or an official release archive. The Scoop route remains blocked by manifest/archive checksum mismatches, including the checked default-branch manifest; do not skip or disable checksum checks. Follow the installation reference for immutable evidence and the manual path: verify the exact archive against its release's official SHA-256 manifest (case-insensitive hex comparison) before extraction. This checks integrity, not release authenticity. Confirm the selected version with newrelic --version before configuring credentials.

# macOS (Homebrew)
brew install newrelic-cli
newrelic --version

# Configure profile
newrelic profile add \
  --profile "default" \
  --apiKey $NEW_RELIC_API_KEY \
  --accountId $NEW_RELIC_ACCOUNT_ID \
  --region US   # US, EU, JP, GOV, or FEDRAMP (alias for GOV)

newrelic profile default --profile "default"

# Verify
newrelic profile list --format JSON

For structured profile discovery, pass --format JSON explicitly. The isDefault field identifies the persisted default profile, and profile names are emitted without terminal decoration. It does not necessarily identify the effective credentials: the global --profile flag can select another profile, while NEW_RELIC_API_KEY, NEW_RELIC_ACCOUNT_ID, NEW_RELIC_REGION, and NEW_RELIC_LICENSE_KEY override the corresponding stored profile fields.


Common One-Liners

# Search for an entity by name
newrelic entity search --name "my-app"

# Run a NRQL query
newrelic nrql query --accountId $NEW_RELIC_ACCOUNT_ID \
  --query "SELECT average(duration) FROM Transaction WHERE appName='my-app' SINCE 1 hour ago"

# Record a deployment
newrelic apm deployment create \
  --applicationId <APP_ID> \
  --revision "v1.2.3" \
  --description "Feature: user auth"

# Discover diagnostic CLI flags without launching nrdiag.
# Before any diagnose run (even --list-suites), follow diagnostics/SKILL.md:
# explicit download/execution approval; separate authorization for data upload.
newrelic diagnose run --help

# Find applications reporting AI Monitoring telemetry
newrelic aimonitoring application search

Entity Reference

Find entity GUIDs (needed for API calls and deployment markers):

# List all APM apps
newrelic entity search --name "" --type APPLICATION --domain APM

# Get APM application details
newrelic apm application get --guid <GUID>

# List all hosts
newrelic entity search --name "" --type HOST

Environment Variables

Variable Description
NEW_RELIC_API_KEY User key (NRAK-...)
NEW_RELIC_ACCOUNT_ID Numeric account ID
NEW_RELIC_REGION US, EU, JP, GOV, or FEDRAMP (FEDRAMP is an alias for GOV)

Sub-Skills

Sub-skill When to use
apm/ Performance triage, slow transactions, error analysis
nrql/ Custom queries, dashboards, ad-hoc exploration, and approval-gated organization macros
aimonitoring/ AI/LLM telemetry, dataset discovery/version inventory, and approval-gated deletion
deployments/ Mark releases, correlate deploys with performance
alerts/ Read-only incident telemetry and entity alert severity
infrastructure/ Host metrics, CPU/memory, process monitoring
diagnostics/ CLI profile/connectivity validation, agent reporting, and approval-gated nrdiag suites
iam/ Users, groups, memberships, roles, permissions, and access grants

Scripts

Script Purpose
scripts/check-performance.sh Quick health check across all apps
scripts/deployment-marker.sh Record a deployment event
scripts/top-slow-transactions.sh Find the 10 slowest transactions
scripts/error-report.sh Recent errors with stack traces

References