Metrics report in percentage format

Hi,

I am running Grafana 6.6.1 with InfluxDB 1.7.10. I am attaching the screenshot for your reference.
Currently, memory consumption is around 4.5 GB out of a total 16 GB RAM. Is there a way to find out in percentage number from Grafana? For example, is it 30 % or 40 % of the total 16GB RAM?

I am attaching a screenshot that reports the percentage of a specific metric in question.

Thanks in Advance and I look forward to hearing from you.

Best Regards,

Kaushal

Hi Kaushal,

Absolutely, you’d do that by modifying your query. InfluxData has a full page of documentation on how to calculate percentages for your queries.

There are two options for percentage in Grafana (the ratio 0-1 and the already formatted percentage 0-100).

@emiltullstedt I have the below query.

SELECT mean("value") AS "USED-value", mean("warn") AS "USED-warn", mean("warn-min") AS "USED-warn-min", mean("warn-max") AS "USED-warn-max", mean("crit") AS "USED-crit", mean("crit-min") AS "USED-crit-min", mean("crit-max") AS "USED-crit-max" FROM "metrics" WHERE ("host" = '[mumbai-dmz-nondmz-rmp1.exampledomain.io](http://mumbai-dmz-nondmz-rmp1.exampledomain.io/)' AND "service" = 'Check Memory' AND "command" = 'check_nrpe' AND "performanceLabel" = 'USED') AND $timeFilter GROUP BY time($__interval) fill(previous)

If you can provide me an example to calculate percentages for the above query? Thanks in Advance.

Best Regards,

Kaushal

Well, based on the InfluxDB documentation you’d do something like this:

SELECT (mean("value") / mean("total")) * 100 AS 'used-percentage'
FROM "metrics"
WHERE (...) AND $timeFilter
GROUP BY time($__interval) fill(previous)

But it’s hard to say exactly how you should do it with your set of metrics.

1 Like

Hi emiltullstedt,

I am attaching the screenshot for your reference.

Please suggest further.

Best Regards,

Kaushal

Sorry, the screenshot still doesn’t tell me much more about the underlying data. If you read up on the linked documentation and study the structure I sent you I am sure you’ll be able to do it yourself after a few attempts :slight_smile: