How to create a dropdown variable with tag values in a Grafana? - grafana

I am using Grafana with KairosDB as datasource.
In Grafana dashboard , I want to add a variable with ringId as name, and Basically that dropdown will have to display all the values of tag "ringId" available in the database so that whenever new value comes under ringId tag in database it should be pulled there.
Help me how to write a query in kairosdb to pull all the ringId's.
here

You can use: tag_values(<metric_name>, <tag_name>). In your case, <metric_name> should be a metric having ringId as tag.

Related

How do I visualise the p95/p99 for a Cloudwatch data source in Grafana?

We're using the Cloudwatch data source in Grafana. I can see in Cloudwatch we can dynamically type in a pXX value of p95 for instance:
But in Grafana I can only see the following: Average, Maximum, Minimum, SampleCount
There's two ways to do it:
Type it in
You can type in p95 into the Statistic box (the dropdown won't show you the option, but you can type it in).
Note you also can't delete the text elements - typing it in will overwrite it.
Making a variable
The other way I found how to do this is to add a custom variable:
I included the Maximum,Minimum,Average and then I added p95 and p90 (but you can add any p value).
You can also add any of the other statistics here:
https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Statistics-definitions.html
Then in the Grafana dashboard set the variable statistic (or whatever you decide to call it) to your new variable and your graph will now show p95.

How to create a dropdown variable with tag values in a Grafana dashboard?

I am using Grafana and InfluxDB with K6. My tests are generating data for some metrics and I am always defining a test-wide tag testrunname which is set to a different value every time.
In Grafana, I want to add a variable in my dashboard, and I want it to be one of all the available values so far added for the tests that I run. Basically the dropdown will have to display all the values of tag testrunname available in the database.
Not having much luck so far.
How to achieve this?
The query is:
SHOW TAG VALUES WITH KEY = "testrunname"
From documentation.

How to set a display name to a custom variable in Grafana dashboard?

There is an option to create custom variables and give CSV values for them which appear in the drop-down selection of Grafana Dashboard. These variables become the input to the queries which are templatized. Sometimes, the variable values are not readable but they mean something. Example: If a dashboard is displaying stats of a city then the queries would have a condition like city_id: $city_id where $city_id is replaced by the custom variable which represents the city id 12345. Instead of having to display the id (12345), I want to display the names of the cities like Bengaluru, Mumbai, Delhi, etc
go to Dashboard -> Settings -> JSON Model
find templating section and the variables you defined
modify the text field for the variable whose display name you want to change
This option is not available on the dashboard configuration screen. But, if you see the JSON Model of the dashboard and see the templating section there is a list of options where the variables are defined. It has a text and value field. You can modify the text field to set the display name. Save the changes and refresh your dashboard, the changes will be reflected.

How do I add a filter by a tag in grafana?

I feel like I'm trying to do something incredibly simple, but I just can't find any cogent explanation anywhere on the internet after an hour of searching.
I'm using InfluxDB/Grafana and I have a DB with several tables. My tables have a tag key named "host" so that I can tell which server the data is coming from.
I want to create a dropdown on my dashboard so that I can select which host's data is displaying on the panels. Is there any way to do this?
Create dashboard variable from the query
SHOW TAG VALUES WITH KEY = "host"
and use it in the panel query. It is documented in the Grafana doc:
https://grafana.com/docs/grafana/latest/features/datasources/influxdb/#templating

Grafana + Influxdb templated variable selected with All is not passed as All in a link, instead passed as a comma separated string of values

In dashboard A
I have a templated variable called region with datasource Influxdb.
It has values like “EAST”, “WEST”.
I defined it should also have an All option (checked Include All option).
The variable is passed inside a link to another dashboard B:
var-region_name=${region_name}
The same region variable is defined in Dashboard B.
When the user selects in Dashboard A the region as All option and in turn clicks to open dashboard B,
the region shows as {EAST,WEST} in dashboard B instead the desired value All.
This subsequently causes the query to have an empty result.
To fix, the user has to select the All option in dashboard B which is obviously not user-friendly.
How can I see that All passes as All from dashboard to dashboard.
You can format your variable values using the syntax provide in the grafana documentation.
I don't have any experience with influxDB, but as per this answer, it uses regex for specifying multiple values in a query expression, so you should try '${yourVariable:regex}' in your query.