APM: Alert on hosts output

Hi,

One of the hosts of an application had fallen over a while, as shown in the screenshot taken from its APM Overview page broken out by hosts (attached below).

Is there a way to alert on this via APM? I couldn’t figure out how to output any of the displayed values/attributes in Insights.

I understand Infrastructure can be used for this sort of alerting, but I’m limited to APM at the moment.

Thanks for your time.

1 Like

Hi, @rishav.dhar: What about alerting if throughput is 0?

SELECT count(*)
FROM Transaction
WHERE appName = 'Your Application'
3 Likes

Thanks, @philweber, really appreciate your response!

Unfortunately, that doesn’t fit in this particular case since the above screenshot only displays a filtered view of the guilty host. There are 21 other hosts which continued as usual, so the application’s throughput never approached zero.

I do understand I’m being tricky with the lack-of-Infrastructure caveat, but it’s something I don’t have control over at the moment. As such, I was really hoping APM could provide a workaround of sorts, especially given the relevant data is being reported on the application’s Overview page (permalinked).

Thanks once again for your valid suggestion.

How about:

SELECT count(*)
FROM Transaction
WHERE appName = 'Your Application'
FACET host

Then you can be notified if any host has 0 throughput.

2 Likes

That’s fantastic!

Is is possible to select all applications in an account with the NRQL query? I found appending OR statements to the WHERE clause works to list more applications, so I was wondering if there’s a catch-all for all applications together.

@rishav.dhar

Removing WHERE appName = 'Your Application' will make it target every reporting app rather than targetting just one. :smiley:

2 Likes

Several months of using New Relic, and I still fall at the first hurdle! :man_facepalming:

Thanks @philweber & @RyanVeitch for your guidance, really grateful for the support! I’ve set up the alert as shown in the screenshot below. Just to confirm, the threshold condition “sum of query of results” is tested against each host separately, right?


Out of interest, is it possible to query other host attributes which are present on the APM Overview page, like CPU usage, response times and memory?

Does count(*) on Transaction just return the hosts’ cumulative throughput for a given time range? Units?

I had another question about ordering of the output data in a dashboard, but I addressed it in a relevant thread.

The answer is probably yes but you will probably want ProcessSample attributes and then FACET hostname or something similar. Be aware that the attributes on ProcessSample are calculated differently to the APM CPU %

Yes, this will give the total number of transactions executed. Again FACET hostname for a breakdown by server.

1 Like

@stefan_garnham: Rishav noted above that he does not have New Relic Infrastructure, so ProcessSample is not available.

1 Like

Hi, @rishav.dhar: New Relic has recently started sending some APM metrics to Insights. You may be able to use the following query, for example, to get the CPU figure visible on your application’s Overview dashboard:

SELECT average(newrelic.timeslice.value) * 100 AS 'CPU %' 
FROM Metric 
WHERE appName = 'Your Application' 
  AND metricTimesliceName = 'CPU/User/Utilization' 
TIMESERIES
1 Like

This is pretty mental :exploding_head:!

Best of all, it can be filtered on the dashboard, unlike the charts copied over from APM Overview. I amended the NRQL with a wildcard for the appName with the hope of selecting all available applications (do let me know if I’m doing this a stupid way).

FROM Metric
 SELECT average(newrelic.timeslice.value) * 100 AS 'CPU %'
 WHERE appName LIKE '%'
  AND metricTimesliceName = 'CPU/User/Utilization'
 FACET host
 SINCE 4 weeks ago
 TIMESERIES AUTO
 LIMIT 2000

Curiously, the NRQL timeslice chart appears to report almost exactly half of what is reported by the standard APM variant, as per the screenshot below. Any ideas why this might be? Link to dash.

There is no need to include WHERE appName LIKE '%'; you may simply omit appName from the query if you do not want to filter on it.

I have no idea why the query returns a different value from the Overview page. Perhaps a support engineer will chime in with an explanation.

1 Like

For me, omiting the WHERE appName … breaks the query :\

The linked doc also states “You must specify at least one data source”, which is why I went with the WHERE appName LIKE '%' route.

Huge thanks for delving into this as deep as you have, really appreciate your time and effort!

You need WHERE, just not the appName part: WHERE metricTimesliceName = '...'

1 Like

I hope I’m not missing something obvious :sweat_smile:

Oh, my mistake. Apparently Metric queries require an app name or entity ID. Sorry!

2 Likes

No worries, I made the same mistake as well!

Hopefully the wildcard option you’re working with for capturing all app names is sufficient for now as it meets the query requirement for an AppName clause.

1 Like

Thanks, @RyanVeitch, it does appear to meet the requirement of capturing all apps within a given account.

However, there’s an discrepancy issue described a few posts earlier whereby the NRQL timeslice chart appears to report almost exactly half of what is reported by the standard APM variant, as shown in the screenshot attached above.

Any ideas why this might be? Link to dash.