How to get the percentage of Values in NRQL

This is the query I have to measure a bandwidth Utilisation of a few ports through NPM.

from Metric select (latest(kentik.snmp.ifHCInOctets) + Latest(kentik.snmp.ifHCOutOctets))* 8 /1024/1024 WHERE if_interface_name = ‘Ethernet1/53’ since 1 day ago facet device_name

is there a way I can calculate the percentage of each of the port Values and setup a alert by the difference in a certain percentage of difference between 2 ports.

Hi @Rajkumar.Nageswaran - I don’t think that you can achieve your requirement with just NRQL and an alert.

You would be able to achieve something similar by writing an API Synthetic which executes the NRQL against the GraphQL API, get the results, perform your comparison and then fail the synthetic if the comparison exceeds thresholds.

Links as they are not very clear in the text :slight_smile:
https://docs.newrelic.com/docs/synthetics/synthetic-monitoring/scripting-monitors/write-synthetic-api-tests/#get-nerdgraph-example
https://docs.newrelic.com/docs/apis/nerdgraph/examples/nerdgraph-nrql-tutorial/

Thanks @stefan_garnham Let me try.

Hi @Rajkumar.Nageswaran

Thanks for reaching out, I hope you are well.

I see @stefan_garnham got to this one ahead of us ( many thanks ).

Please do let us know if this worked for you!