divideSeriesList in Grafana 5.1.0 - grafana

I have a requirement to divide two series lists. As documentation says "divideSeriesList" function added in Graphite in 1.0.2 version.
So, I updated my Graphite to 1.0.2 and Grafana to 5.1.0. After update, I can see "devideSeriesList" in Graphite but not in Grafana. Where as I can see many other new functions in Grafana after update.
Is there any way I can solve this issue or any alternate way to divide two series lists in Grafana?
Thanks,

List of the functions (https://github.com/grafana/grafana/blob/master/public/app/plugins/datasource/graphite/gfunc.ts) in Grafana is static and it's currently out of sync according to graphite. Do not hesitate to make PR to Grafana with updated.
Alternatively you can write your own datasource plugin - http://docs.grafana.org/plugins/developing/datasources/.

Related

Best fit prometheus metric data model for grafana sysdig

I am using prometheues metric in grafana UI emitted from sysdig dashboard.
I am implementing a state change metric i.e pod states and my data mode is below:
pod_request_state_duration(id,method="create",demoapi,state=creating-running)
I want to use promQL to find the changing state and display in grafana UI. Please help.
As the query is not exact, i will try to give a best possible solution.
Try using delta.
delta(pod_request_state_duration{id,method="create",demoapi,state=creating-running}[time_duration])

How to support global variable in Grafana common to all dashboards?

I am using a custom formula in a variable that I want to use across multiple dashboards. Is there a way to make global variable in grafana?
Unfortunately it doesn't look like Grafana supports this, as of version 9.
See https://github.com/grafana/grafana/issues/1959, from 2015, and some duplicates:
https://github.com/grafana/grafana/issues/5504
https://github.com/grafana/grafana/issues/12095
https://github.com/grafana/grafana/issues/16797
You can subscribe to an issue to be notified of any updates.
The only global variables available for now are the built-in ones listed here -
https://grafana.com/docs/grafana/next/variables/variable-types/global-variables/

Grafana with InfluxDB: Ad hoc filter is always empty

Data source query language: Flux
Grafana Version 7.4.3
InfluxDB 2.0.4
Can anyone explain how does Ad hoc filter work? How is drop down list generated?
In my case it always says No options found:
Variable settings:
Do I have to write appropriate queries in panels to make it work?
I guess you have missed info This datasource does not support adhoc filter yet when you was creating variable:
So adhoc filter doesn't work for InfluxDB in your current Grafana version.
BTW: it was supported in previous version (at least 6.7.X).

Multiple asPercent series

Metrics example - something.{variable}.success & something.{variable}.total
What I want to achieve is multiple series graph containing the success percentage for each feature variable.
Trying asPercent(something.*.success, something.*.total) makes graphite simply return 400 in grafana.
As I understand I would be able to achieve this by applyByNode(), but it seems that it's not available in grafana's graphite integration? I'm using self-hosted grafana 7.0 with graphite 1.1.7 .
I also seen example of nesting reduceSeries and mapSeries, but all of them use predefined values for wildcard, in my case there are too many of them to bother.

Grafana and Prometheus: add metrics automatically

I'm using Grafana and Prometheus to monitor our server. We have a lot of database procedures like "select_users" or "insert_task". In order to monitor how many pending database procedure calls are there in the server, we add data points for every procedure call in Prometheus dynamically. Now we have data points like "pending_select_users", "pending_insert_task" in Prometheus.
However, since there are so many database procedures(and the number will increase during developing), it's not very practical for us to add metrics in Grafana for each data point manually. Is there a way we can add metrics dynamically in Grafana? Since all the data point have a common name prefix("pending_"), can we add metrics in Grafana with wildcard? Or is there a better way to do this?
Since Grafana uses JSON as the underlying dashboard DSL, you could dynamically create dashboards, every time you add a new metric, and import it (via API) into Grafana.
I'd add an automation on top of your Prometheus targets, scrape the metrics, and if new metrics (with the required prefix) are found without a matching dashboard, the automation would create it and import it into Grafana.
Grafana API: http://docs.grafana.org/http_api/ (specifically for Dashbboards).
The solution described by #Eitan is definitely feasible. The same goes for using a library like grafonnet to generate dashboards dynamically.
But the simplest approach in my opinion would be to create a variable in Grafana that contains all the label values you are interested in. Something like
label_values(metric_name{label_name=~"prefix*"}, label_name)
should work for that. And then use the repeating panels / rows feature of Grafana to repeat a set of panels for every value in the variable. Though this could get out of hand if you have dozens / hundreds of distinct values.
https://grafana.com/docs/grafana/latest/variables/repeat-panels-or-rows/
https://grafana.com/blog/2020/06/09/learn-grafana-how-to-automatically-repeat-rows-and-panels-in-dynamic-dashboards/
If you want to generate just a single dashboard from your Proimetheus metrics sample, you can use this service:
http://eljah.tatar/micrometer2grafana/