Token导航 LogoToken导航TokenDH.com
开发操作浏览器github未标认证来源可访问许可证需确认审计异常

new-relic新遗物

Agent Skill

用于辅助云资源、部署、容器、基础设施和运维自动化任务。它适合让 Agent 检查配置、整理部署步骤、分析资源状态、生成排障思路或辅助云服务接入。使用时需要明确目标环境、账号权限、区域和资源组,区分本地测试与生产操作;涉及删除资源、重启服务、修改网络或权限配置时,应先确认影响范围。

总安装

1,093

周安装

46

GitHub Stars

18

下载量

383
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:new-relic(新遗物)
来源仓库:https://github.com/bagelhole/devops-security-agent-skills
仓库路径:skills/new-relic
安装命令:
npx skills add https://github.com/bagelhole/devops-security-agent-skills --skill new-relic
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/bagelhole/devops-security-agent-skills --skill new-relic

简介

用于基于 New Relic 平台的应用与基础设施监控与可观测性建设。

  • 适合实现 APM 性能监控、自定义仪表盘、告警规则及分布式链路追踪。
  • 支持基础设施 Agent 安装与配置,集成多种应用探针。
  • 需 New Relic 账户与许可证密钥,具备应用与主机访问权限。
  • new-relic 属于开发类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

New Relic

Monitor applications and infrastructure with New Relic's observability platform.

When to Use This Skill

Use this skill when:

  • Implementing full-stack observability
  • Setting up APM for applications
  • Monitoring infrastructure health
  • Creating custom dashboards and alerts
  • Implementing distributed tracing

Prerequisites

  • New Relic account and license key
  • Application access for APM agents
  • Infrastructure access for host agents

Infrastructure Agent

Linux Installation

# Add repository and install
curl -Ls https://download.newrelic.com/install/newrelic-cli/scripts/install.sh | bash

# Configure license key
sudo NEW_RELIC_API_KEY=<YOUR_API_KEY> NEW_RELIC_ACCOUNT_ID=<ACCOUNT_ID> /usr/local/bin/newrelic install

# Or manual configuration
echo "license_key: YOUR_LICENSE_KEY" | sudo tee -a /etc/newrelic-infra.yml
sudo systemctl start newrelic-infra

Docker

# docker-compose.yml
version: '3.8'

services:
  newrelic-infra:
    image: newrelic/infrastructure:latest
    cap_add:
      - SYS_PTRACE
    privileged: true
    pid: "host"
    network_mode: "host"
    environment:
      - NRIA_LICENSE_KEY=${NEW_RELIC_LICENSE_KEY}
      - NRIA_DISPLAY_NAME=docker-host
    volumes:
      - /:/host:ro
      - /var/run/docker.sock:/var/run/docker.sock

Kubernetes

# Using Helm
helm repo add newrelic https://helm-charts.newrelic.com

helm install newrelic-bundle newrelic/nri-bundle \
  --namespace newrelic \
  --create-namespace \
  --set global.licenseKey=${NEW_RELIC_LICENSE_KEY} \
  --set global.cluster=my-cluster \
  --set newrelic-infrastructure.privileged=true \
  --set ksm.enabled=true \
  --set kubeEvents.enabled=true \
  --set logging.enabled=true

APM Agents

Node.js

// At the very start of your application
require('newrelic');

// newrelic.js configuration
exports.config = {
  app_name: ['My Application'],
  license_key: process.env.NEW_RELIC_LICENSE_KEY,
  distributed_tracing: {
    enabled: true
  },
  logging: {
    level: 'info'
  },
  error_collector: {
    enabled: true,
    ignore_status_codes: [404]
  },
  transaction_tracer: {
    enabled: true,
    transaction_threshold: 'apdex_f',
    record_sql: 'obfuscated'
  }
};
# Install agent
npm install newrelic

# Run application
NEW_RELIC_LICENSE_KEY=xxx node -r newrelic app.js

Python

# newrelic.ini
[newrelic]
license_key = YOUR_LICENSE_KEY
app_name = My Application
distributed_tracing.enabled = true
transaction_tracer.enabled = true
error_collector.enabled = true
browser_monitoring.auto_instrument = true
# Install agent
pip install newrelic

# Generate config file
newrelic-admin generate-config YOUR_LICENSE_KEY newrelic.ini

# Run application
NEW_RELIC_CONFIG_FILE=newrelic.ini newrelic-admin run-program python app.py

# Or with gunicorn
NEW_RELIC_CONFIG_FILE=newrelic.ini newrelic-admin run-program gunicorn app:app

Java

# Download agent
curl -O https://download.newrelic.com/newrelic/java-agent/newrelic-agent/current/newrelic-java.zip
unzip newrelic-java.zip

# Configure newrelic.yml
# license_key: YOUR_LICENSE_KEY
# app_name: My Application

# Run with agent
java -javaagent:/path/to/newrelic.jar -jar myapp.jar

Go

package main

import (
    "github.com/newrelic/go-agent/v3/newrelic"
    "net/http"
)

func main() {
    app, err := newrelic.NewApplication(
        newrelic.ConfigAppName("My Application"),
        newrelic.ConfigLicense("YOUR_LICENSE_KEY"),
        newrelic.ConfigDistributedTracerEnabled(true),
    )
    if err != nil {
        panic(err)
    }

    http.HandleFunc(newrelic.WrapHandleFunc(app, "/", indexHandler))
    http.ListenAndServe(":8080", nil)
}

func indexHandler(w http.ResponseWriter, r *http.Request) {
    txn := newrelic.FromContext(r.Context())
    txn.AddAttribute("user_id", "12345")
    w.Write([]byte("Hello, World!"))
}

Custom Instrumentation

Custom Events

import newrelic.agent

# Record custom event
newrelic.agent.record_custom_event('OrderPlaced', {
    'order_id': '12345',
    'amount': 99.99,
    'customer_id': 'cust_001'
})

Custom Metrics

import newrelic.agent

# Record custom metric
newrelic.agent.record_custom_metric('Custom/OrderValue', 99.99)

# With attributes
newrelic.agent.record_custom_metric('Custom/ProcessingTime',
    processing_time,
    {'unit': 'milliseconds'}
)

Custom Spans

import newrelic.agent

@newrelic.agent.function_trace(name='process_payment')
def process_payment(order_id, amount):
    # This creates a custom span in the trace
    pass

# Manual span creation
with newrelic.agent.FunctionTrace(name='custom_operation'):
    # Traced code
    pass

NRQL Queries

Basic Queries

-- Transaction throughput
SELECT rate(count(*), 1 minute) FROM Transaction
WHERE appName = 'My Application'
SINCE 1 hour ago

-- Average response time
SELECT average(duration) FROM Transaction
WHERE appName = 'My Application'
SINCE 1 hour ago

-- Error rate
SELECT percentage(count(*), WHERE error IS true) FROM Transaction
WHERE appName = 'My Application'
SINCE 1 hour ago

-- Apdex score
SELECT apdex(duration, t: 0.5) FROM Transaction
WHERE appName = 'My Application'
SINCE 1 hour ago

Advanced Queries

-- Slowest transactions
SELECT average(duration) FROM Transaction
WHERE appName = 'My Application'
FACET name
SINCE 1 hour ago
ORDER BY average(duration) DESC
LIMIT 10

-- Error breakdown
SELECT count(*) FROM TransactionError
WHERE appName = 'My Application'
FACET error.class
SINCE 1 hour ago

-- Percentile response times
SELECT percentile(duration, 50, 90, 95, 99) FROM Transaction
WHERE appName = 'My Application'
SINCE 1 hour ago TIMESERIES

-- Custom event analysis
SELECT average(amount), count(*) FROM OrderPlaced
FACET customer_id
SINCE 1 day ago

Dashboards

Dashboard JSON

{
  "name": "Application Dashboard",
  "pages": [
    {
      "name": "Overview",
      "widgets": [
        {
          "title": "Throughput",
          "visualization": {"id": "viz.line"},
          "configuration": {
            "nrqlQueries": [
              {
                "accountId": 12345,
                "query": "SELECT rate(count(*), 1 minute) FROM Transaction WHERE appName = 'My Application' SINCE 1 hour ago TIMESERIES"
              }
            ]
          }
        },
        {
          "title": "Error Rate",
          "visualization": {"id": "viz.billboard"},
          "configuration": {
            "nrqlQueries": [
              {
                "accountId": 12345,
                "query": "SELECT percentage(count(*), WHERE error IS true) FROM Transaction WHERE appName = 'My Application' SINCE 1 hour ago"
              }
            ]
          }
        }
      ]
    }
  ]
}

Alerts

Alert Condition (NRQL)

{
  "name": "High Error Rate",
  "type": "static",
  "nrql": {
    "query": "SELECT percentage(count(*), WHERE error IS true) FROM Transaction WHERE appName = 'My Application'"
  },
  "valueFunction": "single_value",
  "terms": [
    {
      "threshold": 5,
      "thresholdOccurrences": "all",
      "thresholdDuration": 300,
      "operator": "above",
      "priority": "critical"
    },
    {
      "threshold": 2,
      "thresholdOccurrences": "all",
      "thresholdDuration": 300,
      "operator": "above",
      "priority": "warning"
    }
  ]
}

Alert Policy

{
  "name": "Application Alerts",
  "incident_preference": "PER_CONDITION_AND_TARGET",
  "conditions": [
    {
      "name": "High Response Time",
      "type": "apm_app_metric",
      "entities": ["My Application"],
      "metric": "response_time_web",
      "condition_scope": "application",
      "terms": [
        {
          "duration": "5",
          "operator": "above",
          "threshold": "1",
          "priority": "critical"
        }
      ]
    }
  ]
}

Logs in Context

Python Configuration

# newrelic.ini
[newrelic]
application_logging.enabled = true
application_logging.forwarding.enabled = true
application_logging.metrics.enabled = true
application_logging.local_decorating.enabled = true

Log Forwarding

# newrelic-infra.yml
log:
  - name: application-logs
    file: /var/log/myapp/*.log
    attributes:
      service: myapp
      environment: production

Common Issues

Issue: No Data Appearing

Problem: Agent not reporting to New Relic Solution: Verify license key, check network connectivity, review agent logs

Issue: Missing Transactions

Problem: Some transactions not captured Solution: Check instrumentation coverage, verify framework support

Issue: High Overhead

Problem: APM agent impacting performance Solution: Adjust sampling rate, disable unnecessary features

Best Practices

  • Use meaningful application names
  • Implement distributed tracing across services
  • Set up service maps for dependency visualization
  • Configure appropriate alert thresholds
  • Use custom attributes for business context
  • Implement logs in context for correlation
  • Set up workloads for service grouping
  • Regular review of unused dashboards and alerts

Related Skills

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

35.91%
按下载量换算138

Claude

32.51%
按下载量换算125

Cursor

18.86%
按下载量换算72

Gemini CLI

9.59%
按下载量换算37

安全审计

Gen Agent Trust Hub

未通过

Socket

通过

Snyk

可疑

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills