Memory Alerting

Hello,

how can I create an Alert that triggers when a specific percentage of instance RAM is used? Creating a new condition, I don’t find any option to do so but on the summary page I see the memory usage so I assume the information is there.

What am I missing?

Best, Florian

1 Like

Hello @fs11,

Thanks for reaching out.

Could you please provide an example of the metric you want to alert on? Perhaps a screenshot or URL link ?

Regards

Hi @sbetea,

sure see the screenshot attached. It’s in chart at the very bottom of the summary page.

Best, Florian

Hi @sbetea,

any ideas on how we can get this alert set up?

Cheers, Florian

Hi @fs11,

I’m not seeing exactly where you obtained that screenshot from, however if you’re looking to alert on memory usage you could based the alert on a custom metric. The metric for that chart would, I believe, be Memory/Physical.

1 Like

Hi @hwilkalis,

thanks for your help, I was able to create the metric - the problem was that the search didn’t work, which is why I thought there are no metrics. But manually adding Memory/Physical worked.

What unit is it using? Let’s say I want to have an alert if at least 1 instance uses more than 80% of its memory and the instance has 10.5GB RAM, what is the correct value?

Best, Florian

Hi @fs11

What unit is it using?

This is probably measured in bytes (the Java agent uses bytes), but every language agent behaves differently, so it might depend on which language agent you’re using for this app.

Let’s say I want to have an alert if at least 1 instance uses more than 80% of its memory and the instance has 10.5GB RAM, what is the correct value?

Only Java agent has the ability to set up alert conditions based on behavior split out by instance (these are called JVM Health Metric conditions). This metric will be aggregated across all instances. If there is only one single instance for this app, you’re golden! But if you have multiple instances, you may prefer to instead use a NRQL alert condition coupled with a metric timeslice query faceted by host.

2 Likes

Hi @Fidelicatessen,

thanks for helping, I think the NRQL approach is right - however it is very frustrating to use and I get stuck with error messages that are not helpful. A simple query like this

FROM Metric SELECT apm.service.apdex WHERE appId = APP_ID

returns “We ran into an error while trying to return your chart data.” What is wrong with this query? How does a proper query look like to get the max memory data of all hosts?

Best, Florian

Hey @fs11, I too quite like that memory usage chart and do miss it in the new view of the APM page.

As @hwilkalis mentioned, Memory/Physical is the closest I’ve managed to get to it, and unfortunately it does not result in a percentage output like you’re after. You can find this attribute—amongst others—from an application’s APM page > sidebar > Metrics explorer > type “memory” into the search bar.

Upon selecting it, a NRQL query is pre-populated for you, a bit like this:

FROM Metric
  SELECT average(newrelic.timeslice.value) * 1000000
    AS 'Memory/Physical'
  WHERE metricTimesliceName = 'Memory/Physical'
    AND appName LIKE '%'
  FACET appName
  SINCE 30 MINUTES AGO
  TIMESERIES
  • This particularly query splits out all of your apps’ memory usage due to FACET appName.
  • To filter in/out specific apps, you can amend the AND appName LIKE '%' condition to be more specific instead of using the % wildcard.
  • Memory usage is given in bytes, which then gets multiple by 1,000,000 to return usage in MB.

If you want to alert on this, you can head over to Alerts & AI > Policies > New policy > Add condition > Categorize: NRQL > copy/paste in the aforementioned NRQL without the FACET…, SINCE… and TIMESERIES… lines.

You now have the option of setting either static, baseline or outlier thresholds. While not exactly percentage-based, they’re on par when you want to be alerted on sudden changes in memory usage.

1 Like

@rishav.dhar wow thanks that helped a lot. I changed it a bit for our usecase because we want to have an Alert in case any instance is crossing a specific threshold:

FROM Metric
SELECT sum(newrelic.timeslice.value)
AS ‘Memory/Physical’
WHERE metricTimesliceName = ‘Memory/Physical’
AND appId = 123
FACET host

The preview chart renders fine but unfortunately there is now a new error: ValidationException: Malformed NRQL Query. QUERY_COMPILATION

In which way is this malformed when it actually works? Thanks for your help!

1 Like

The query looks good to me. If nothing else, perhaps could use a shortcut reference to get the same output with better legibility.

FROM Metric
  SELECT sum(apm.service.memory.physical)
  WHERE appId = 123456
  FACET host

Beyond that, might be worth sharing an obfuscated screenshot in case that helps Support troubleshoot the issue you’re facing.

1 Like

@rishav.dhar fantastic, it works, thank you very much :slight_smile:

2 Likes

Thank @rishav.dhar for your help with this one! :star_struck: Glad to hear the solution worked. I went ahead and marked it as solved.