Is Grafana used for analyzing system metrics alone? - postgresql

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.

Related

Can I use grafana with a relational database not listed in the supported data source list?

I need to show metrics in real time but my metrics are stored in a relational database not supported by the datasources listed here https://grafana.com/docs/grafana/latest/http_api/data_source/
Can I somehow provide the JDBC (or other DB driver) to Grafana?
As #danielle clearly mentioned, "There is no direct support for JDBC or ODBC currently. You could get this data in time series form and into Grafana if you are prepared to do some programming.
The simple json data source is a generic backend that could make JDBC/ODBC calls to MapD and then transform the data into the right form for Grafana."
https://github.com/grafana/grafana/issues/8739#issuecomment-312118425
Though this comment is a bit old, i'm pretty sure there is no out of the box way to visualize data using JDBC/ODBC, yet.
One possible approach can make use of:
Grafana can access PostgreSQL
PostgreSQL can transparently display data in other databases as though it was a PostgreSQL table through Foreign Data Wrappers
Doing it this way, you'd use PostgreSQL to act as a gateway to the data. Depending on the table structure, you might also need to create a view in PG to shape the data to match Grafana's requirements for PG data source.

Store and use static metadata in Grafana

I am trying to create Grafana dashboard for a large system. There are thousands of metadata variables which I need to store and access. E.g. SLA's for hundreds of applications. What is the best way to achieve this? My data source for logs and metrics is elastic search.
Should I store the static data as Elastic search index and query along with main data or is it possible to store it in some other DB and access it with main elastic search data.
tl;dr Best is to handle all metadata before and only feed Grafana with indexes ready for display.
The only source of data in Grafana is the 'data source'. There is no way to get any sort of metadata in Grafana. Especially with ElasticSearch(ES) as a data source which is fairly new to Grafana.
The best way to configure any metadata is in an ES index or to model your data along with the metadata using a transformation or ingestion in ES. As suggested in tl;dr it is best to handle all the correlation and transformation beforehand and let Grafana just query indices to render graphs.
However, if you need any aggregations to be performed on the data Grafana does support it. You can check it in the official documentation

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.

How to show top 10 values only in 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

Remove a series in Graphite when using postgres for storage?

Just installed graphite using postgres for storage and sending data to graphite using statsd. Works fine!
My issue is I created a bunch of series (mostly gauges) that were just for testing and I want them gone but see no way to delete them. I have no whisper files to delete since I am using postgres.
In looking at the tables in postgres for the graphite database I see nothing that contains the series. I see my custom graphs and my user but nowhere in the graphite database can I find my testing series to blow away.
Any pointers? Are the series not kept in the postgres DB?
Graphite only uses PostgreSQL/MySQL/SQLite for storing user profiles, saved graphs & dashboards, and events (annotation-style data). Time-series metrics are stored in the native Whisper files. In most cases these files will exist under /opt/graphite/storage/whisper/.
Say you sent a metric by accident named foo.bar.baz. This file will exist at /opt/graphite/storage/whisper/foo/bar/baz.wsp and can be deleted from the command-line with sudo rm /opt/graphite/storage/whisper/foo/bar/baz.wsp.