How to show top 10 values only in grafana - grafana

I am using grafana to display certain metrics. Sometimes the list is so big that I would need only top 10 values to be displayed. What is the option that Grafana provides for the same. I am using "Graph" panel.

This is not an option in Grafana as you would do this with the query language of the time series database that you are using.
Graphite has the limit function.
InfluxDB has the limit and slimit functions
ElasticSearch has the Size option:

If you use prometheus you could do this:
https://www.robustperception.io/graph-top-n-time-series-in-grafana

Related

Grafana is querying many null values from Graphite

I have set up Graphite and Grafana to run in docker. metrics are pushed to Graphite maybe a few times per day. I have set up graphs in Grafana to view these metrics from Graphite. Since there is few values once Grafana has queried a value it will get a null value the next query.
Is there a way to avoid this? Currently I'm using Transform -> filter data by values in Grafana to remove the null values. But is there a better way to avoid having tables full of mostly null values?
The solution was to configure the storage-schema.conf and storage-aggregation.conf in Graphite

Applying variable filter on all graphs on Grafana dashboard

Hi I have created a variable using the settings button on dashboard. I want to use that filter on all of my visualizations. All my visualizations are from postgresql and through queries. How can I do it?
Filter:

Can I modify postgresql sql before execute it

I use grafana to view metrics in timescaledb.
For large scale metrics I create a view to aggregate them to a small dataset, I configure a sql in grafana, which table is fixed, I want the table name is changed according to the time range, say: time range less than 6 hours, query the detail table, time range greater than 24 hours query the aggregate view.
So I am looking for a proxy or postgresql plugin which can used to modify the sql before execute it.
AFAIK there is no PostgreSQL extension to modify SQL query but there is a proxy that says it can rewrite and filter SQL query: https://github.com/wgliang/pgproxy.
You might alternatively look at TimescaleDB's real-time aggregates, which were released in 1.7
Basically it will transparently take the "union" between pre-calculated aggregates > 6 hours with the "raw" data < 6 hours.
Not quite what you are asking for, but might get you to the same place, and works transparently with grafana.
https://blog.timescale.com/blog/achieving-the-best-of-both-worlds-ensuring-up-to-date-results-with-real-time-aggregation/
I would suggest taking a look at Gallium Data, it's a free database proxy that allows you to change database requests before they hit the database, and database responses before they reach the clients.
Disclosure: I'm the founder of Gallium Data.

Is it possible to use grafana to write query results of SQL DBs (postgres / mysql) into influxDB ?

I would like to query several different DB's using grafana, and in order to keep metrics history I would like to keep it in influxDB.
I know that I can write my own little process that holds queries and send it to influx, but I wonder if its possible by grafana only?
You won't be able to use Grafana to do that. Grafana isn't really an appropriate tool for transforming/writing data. But either way, its query engine generally just works with one single datasource/database at a time, rather than multiple, which is what you'd need here.

Is Grafana used for analyzing system metrics alone?

I am new to grafana. I want to know whether grafana is used for only monitoring system metrics?
1) If not so, I am having postgreSQL database with some live data in it. Can i use the grafana for accessing those postgres tables directly into grafana without any conversion like json.
2) If there is possibility to directly access postgres databse into grafana which data source can i use?
Please correct me if I am wrong..
Grafana can be used to visualize any time-series or metrics and not just system metrics.
PostgreSQL can be used using a datasource plugin - https://github.com/sraoss/grafana-sqldb-datasource (haven't tried it out myself)
And there's a generic SQL Datasource being developed as well. Here's the PR for your reference. - https://github.com/grafana/grafana/pull/5364
I want to know whether grafana is used for only monitoring system
metrics?
You can use grafana to display a lot of different metrics. I for example use grafana + influxdb to display different sensor values from my apartment.
Can i use the grafana for accessing those postgres tables directly into grafana
I am not sure about that. But if you take a look at the available data-sources LINK you will see that there is no PostgreSQL. So I think this is a no.