Home > Software engineering >  Query in Grafana tomcat plugin with telegraf
Query in Grafana tomcat plugin with telegraf

Time:12-11

I have this query that gives result in number but would like to convert it to percentage :

SELECT mean("free") FROM "tomcat_jvm_memory" WHERE ("host" = '$host') AND $timeFilter GROUP BY time($__interval) fill(null)

Result is 4567678899

How would I convert this to percentage in the grafana dashboard.I really want to query good dashboad with tomcat plugin below :

**Metrics
tomcat_jvm_memory
   free
   max
   total
tomcat_jvm_memorypool
   committed
   init
   max
   used
tomcat_connector
   bytes_received
   bytes_sent
   current_thread_busy
   current_thread_count
   error_count
   max_threads
   max_time
   processing_time
   request_count**

CodePudding user response:

following your question, I have setup two Grafana's gauges that show Used Jvm Memory in Gigabytes and Percentage, I attach the screenshot

enter image description here

For the first one the query is:

SELECT last("max")-last("free"), last("max") FROM "tomcat_jvm_memory" 
WHERE ("host" = '$host') AND $timeFilter 
GROUP BY time($__interval) fill(null)

rendered with the Gauge Widget with the following settings:

Value options:
 
a) Show -> Calculate
b) Calculation -> Last
c) Fields -> tomcat_jvm_memory.last_last

...

Standard options:

a) Unit -> Data: bytes(IEC)

...

Thresholds:

a)            
  • Related