Find the Best Cosmetic Hospitals

Explore trusted cosmetic hospitals and make a confident choice for your transformation.

โ€œInvest in yourself โ€” your confidence is always worth it.โ€

Explore Cosmetic Hospitals

Start your journey today โ€” compare options in one place.

Step by Step guide to correctly create alerts via New Relic API


curl -X GET 'https://api.newrelic.com/v2/applications.json'   -H 'Api-Key: NRAK-3T8WTXSP4KJSLMG74WHR5I3SSY9'   -H 'Content-Type: application/json'

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   799    0   799    0     0    809      0 --:--:-- --:--:-- --:--:--   811{"applications":[{"id":1508171253,"name":"devopsschool","language":"java","health_status":"red","reporting":false,"settings":{"app_apdex_threshold":0.5,"end_user_apdex_threshold":7.0,"enable_real_user_monitoring":true,"use_server_side_config":false},"links":{"application_instances":[],"servers":[],"application_hosts":[]}}],"links":{"application.servers":"/v2/servers?ids={server_ids}","application.server":"/v2/servers/{server_id}","application.application_hosts":"/v2/application/{application_id}/hosts?ids={host_ids}","application.application_host":"/v2/application/{application_id}/hosts/{host_id}","application.application_instances":"/v2/application/{application_id}/instances?ids={instance_ids}","application.application_instance":"/v2/application/{application_id}/instances/{instance_id}"}}
Code language: JavaScript (javascript)

Here’s a step-by-step guide to correctly create alerts via New Relic API, with proper handling of:

  • type
  • condition_scope
  • entities
  • metric

This will help you avoid common errors like using the wrong entity type or unsupported metrics.


โœ… STEP-BY-STEP GUIDE TO NEW RELIC ALERT API SETUP


๐Ÿ”น STEP 1: Decide the Alert Use Case

What are you monitoring?

Use CaseAPI TypeDomainScope/Condition
App performance (APM)apm_app_metricAPMcondition_scope: application
Infrastructure (host, containers)infra_metricINFRAwhere_clause
Browser monitoringbrowser_metricBROWSERapplication
Synthetics (Ping/API checks)syntheticsSYNTHper monitor
Custom metricsuser_defineddependsAPM only

๐Ÿ”น STEP 2: Find the Correct Entity (ID or GUID)

๐Ÿ”ธ For APM App: Use numeric App ID

curl -X GET 'https://api.newrelic.com/v2/applications.json' \
  -H 'Api-Key: YOUR_API_KEY'
Code language: JavaScript (javascript)

Use id from the output in entities: [YOUR_APP_ID].

๐Ÿ”ธ For Infrastructure (Host): Use hostname or tag via where_clause


๐Ÿ”น STEP 3: Choose the Right type, condition_scope, and metric

โœ… APM (Application Metrics)

curl -X POST 'https://api.newrelic.com/v2/alerts_conditions/policies/<policy_id>.json' \
  -H 'Api-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "condition": {
      "type": "apm_app_metric",
      "name": "Error Rate Alert",
      "enabled": true,
      "condition_scope": "application",
      "entities": [1508171253],
      "metric": "error_percentage",
      "terms": [
        {
          "duration": "5",
          "operator": "above",
          "priority": "critical",
          "threshold": "5",
          "time_function": "all"
        }
      ]
    }
  }'
Code language: PHP (php)

โœ… Allowed APM Metrics:

  • apdex
  • error_percentage
  • response_time_web
  • response_time_background
  • throughput_web
  • throughput_background

โœ… Infrastructure Host Metrics

curl -X POST 'https://api.newrelic.com/v2/alerts_conditions.json' \
  -H 'Api-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "condition": {
      "type": "infra_metric",
      "name": "High CPU Usage on Host",
      "enabled": true,
      "policy_id": 6269799,
      "event_type": "SystemSample",
      "select_value": "cpuPercent",
      "comparison": "above",
      "critical_threshold": {
        "value": 80,
        "duration_minutes": 5,
        "time_function": "all"
      },
      "where_clause": "hostname = '\''ip-10-0-0-1'\''"
    }
  }'
Code language: PHP (php)

โœ… Common Infra Metrics (event_type: SystemSample)

  • cpuPercent
  • memoryUsedBytes
  • diskUsedPercent
  • loadAverageOneMinute

โœ… Synthetics Monitor Example

curl -X POST 'https://api.newrelic.com/v2/alerts_synthetics_conditions/policies/<policy_id>.json' \
  -H 'Api-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "synthetics_condition": {
      "name": "Ping Failure",
      "monitor_id": "your-monitor-id",
      "enabled": true,
      "runbook_url": "",
      "terms": [
        {
          "duration": "5",
          "operator": "above",
          "priority": "critical",
          "threshold": "0",
          "time_function": "all"
        }
      ]
    }
  }'
Code language: PHP (php)

๐Ÿ”น STEP 4: Test the Entity Type (Optional)

If unsure whether an entity is valid for APM alert:

{
  actor {
    entity(guid: "GUID_HERE") {
      name
      domain
      type
      guid
    }
  }
}
Code language: JavaScript (javascript)

Use via: https://api.newrelic.com/graphiql


๐Ÿ“˜ Summary Reference Table

Monitoring TargetAPI typeMetric SourceEntity/Where
APM Appapm_app_metricApp-level (error_percentage, etc.)entities: [APP_ID]
Host (infra)infra_metricHost-level (cpuPercent, memoryUsed)where_clause
Browser appbrowser_metricPage load, JS errorsApp ID
SyntheticssyntheticsMonitor failure % or durationMonitor ID
Custom metricsuser_definedCustom instrumented metricsAPM app ID

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services โ€” all in one place.

Explore Hospitals
Iโ€™m a DevOps/SRE/DevSecOps/Cloud Expert passionate about sharing knowledge and experiences. I have worked at <a href="https://www.cotocus.com/">Cotocus</a>. I share tech blog at <a href="https://www.devopsschool.com/">DevOps School</a>, travel stories at <a href="https://www.holidaylandmark.com/">Holiday Landmark</a>, stock market tips at <a href="https://www.stocksmantra.in/">Stocks Mantra</a>, health and fitness guidance at <a href="https://www.mymedicplus.com/">My Medic Plus</a>, product reviews at <a href="https://www.truereviewnow.com/">TrueReviewNow</a> , and SEO strategies at <a href="https://www.wizbrand.com/">Wizbrand.</a> Do you want to learn <a href="https://www.quantumuting.com/">Quantum Computing</a>? <strong>Please find my social handles as below;</strong> <a href="https://www.rajeshkumar.xyz/">Rajesh Kumar Personal Website</a> <a href="https://www.youtube.com/TheDevOpsSchool">Rajesh Kumar at YOUTUBE</a> <a href="https://www.instagram.com/rajeshkumarin">Rajesh Kumar at INSTAGRAM</a> <a href="https://x.com/RajeshKumarIn">Rajesh Kumar at X</a> <a href="https://www.facebook.com/RajeshKumarLog">Rajesh Kumar at FACEBOOK</a> <a href="https://www.linkedin.com/in/rajeshkumarin/">Rajesh Kumar at LINKEDIN</a> <a href="https://www.wizbrand.com/rajeshkumar">Rajesh Kumar at WIZBRAND</a> <a href="https://www.rajeshkumar.xyz/dailylogs">Rajesh Kumar DailyLogs</a>

Related Posts

Terraform Backend Tutorial

Terraform is a popular open-source infrastructure as code tool used to create and manage infrastructure resources. The state of the infrastructure resources managed by Terraform is stored…

Read More

Best Tools for Software Composition Analysis (SCA)

Hereโ€™s a clear and professional explanation of the three related concepts you asked about โ€” all of which are critical parts of secure software development, especially in…

Read More

Top 10 AI Code Review Tools in 2026: Features, Pros, Cons & Comparison

Introduction In 2026, AI code review tools have become essential for developers aiming to enhance code quality, streamline workflows, and accelerate software delivery. These tools leverage advanced…

Read More

Top 10 Expense Management Tools in 2026: Features, Pros, Cons & Comparison

Introduction Expense management tools are critical for businesses of all sizes in 2026 as they help streamline financial processes, improve budgeting, ensure compliance, and enhance financial visibility….

Read More

Top 10 Web Application Firewall (WAF) Tools in 2026: Features, Pros, Cons & Comparison

Introduction In the rapidly evolving landscape of cybersecurity, Web Application Firewalls (WAFs) have become a critical component in defending web applications from malicious attacks such as SQL…

Read More

Top 10 Endpoint Management Tools in 2026: Features, Pros, Cons & Comparison

Introduction In 2026, businesses of all sizes are increasingly reliant on a variety of devicesโ€”laptops, desktops, mobile devices, and other endpointsโ€”that connect to their networks. With the…

Read More
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x