Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
0 votes
0 answers
21 views

Custom grafana $timeFilter

I'm using this query to fetch data for current day power consumption in order to display in a bar chart. SELECT mean("value") FROM "Dataset" WHERE "measurement" = 'Ea+' ...
AL1AS's user avatar
  • 1
0 votes
0 answers
99 views

Grafana pivot table

I have three SQL Server tables built like this: SAMPLES (id, sample_number, sample_date, description) PARAMETERS (id, parameter_name, measure_unit) RESULTS (id, sample_id FK, parameter_id FK, value) ...
Deffo's user avatar
  • 197
0 votes
0 answers
27 views

Averaging Binned Values from AWS Timestream in Grafana

I'm pulling data from AWS Timestream to visualize in Grafana. I've set up a custom dashboard variable for $interval that I mostly keep set to auto. I'm attempting to bin the values on an AVG, but ...
user2942895's user avatar
0 votes
0 answers
52 views

Grafana variable interpolation

I have an "environment" template variable. And I want to somehow use it to interpolate $namespace that I have in my JSON. So if I selected prod, then $namespace would use "test1" ...
dluisely's user avatar
  • 101
0 votes
0 answers
16 views

Query variable between InfluxDB and Grafana

I try to visualize weeds' species heatmaps in Grafana. I'm using data stored in InfluxDB. I want to add a filter to visualise the map of the selected species. For that I'm using a Grafana variable. My ...
Donatien Wallaert's user avatar
0 votes
1 answer
128 views

Grafana db query error / SQL Server : Incorrect syntax near the keyword 'AS'

SELECT DK_KOD, $__time(DATEADD(HOUR, -3, MQ_TAR_ZMN)), SUM(ADET) AS toplam FROM [MYDB].[dbo].[Sayi] WHERE DK_KOD = 'XYZ' AND (TXN_KOD = 'A' OR TXN_KOD = 'B' OR TXN_KOD = 'C' ...
Halk Bank's user avatar
0 votes
0 answers
121 views

Grafana join two table based on column

I have 2 queries running on two diffrent databases in grafana Query 1 on DB 1 select key_1, field_1_2, filed_1_3 from table_from_db1 Query 2 on database 2 select key_1, fiedl2_2, field_2_3 from ...
RaoLinMau's user avatar
1 vote
1 answer
48 views

Merging 2 sql queries into 1

I am extracting some database data using PostgreSQL via Grafana. The first SQL gives me a list of user_ids (User2, User3...) who have interacted with a specific User1 I know beforehand: SELECT ...
Eu Román's user avatar
  • 333
0 votes
0 answers
47 views

How to set half-time interval in Grafana query

I'm need to make timeseries graph in Grafana from night shift (12h), but user must set time range in one day(24h). In SQL query i use $_timeFrom and $_timeTo for search timestamps between this range. ...
Кирилл Лукьященко's user avatar
0 votes
0 answers
147 views

Select from all table in grafana

this query works well but tables will be added every month so I would like it to give me the distinct results of the name column for all the tables in the database, without having to mark the names of ...
Ne Mo's user avatar
  • 15
0 votes
0 answers
28 views

Can I evaluate data over multiple data rows which is time based?

I am using Grafana to visualize data from a PostgreSQL data source. I want to visualize when a condition exist for a minimum of 3 minutes or longer, using a times series based graph. I added a ...
Edwin's user avatar
  • 1
0 votes
1 answer
72 views

InfluxDB + Grafana: Status codes by time

I am trying to display HTTP status codes in Grafana by time. The data is stored in InfluxDB like this (simplified): # time,status,bytesize 2024-04-27 11:24:00, 404,100 2024-04-28 01:24:00, 200,100 ... ...
zarathustra's user avatar
  • 2,060
1 vote
1 answer
78 views

SQL Query to average multiple data and compare with one data point to check offset

I am new to SQL so please bear with me. In one of my tables I have a series of inverter voltage values, written every minute. I am displaying the data on GRAFANA and would like to find anomalous ...
Kryrena's user avatar
  • 195
0 votes
0 answers
147 views

Submit multiple SQL queries in a dynamic way

I am using Grafana with the Amazon Athena data source. My back-end is an AWS-S3-based Parquet data lake structured as follows: [DeviceID]/[MessageName]/YYYY/MM/DD/filename.parquet Each table is thus ...
mfcss's user avatar
  • 1,461
0 votes
1 answer
37 views

MySQL - SUM() query results over multiple timestamps

I have some data like this Used Timestamp 0 2023-03-12 12:30:04 0 2023-03-12 12:30:04 1 2023-03-12 12:30:04 1 2023-03-12 12:30:04 0 2023-03-12 12:30:54 0 2023-03-12 12:30:54 1 2023-03-12 12:30:...
Chris W's user avatar
  • 53
1 vote
4 answers
127 views

MySQL CASE with user parameter in WHERE clause

I am trying to obtain all days to a month in my MySQL database. This query is being called in one of my Grafana dashboards that has a variable for the year, the month and the day. This query is ...
Wyatt's user avatar
  • 13
0 votes
0 answers
61 views

SQL Query to Select class and frequency for Grafana Histogram

I created an query to transform data from two tables to create an histogram in Grafana. I have the table data with the column resistance (entry for example 0.000564), and I have the table ...
blaert's user avatar
  • 21
0 votes
1 answer
61 views

calculation of rolling average with removed outliers using quantile or similar function

I would really appreciate if someone could help me to come out with sql code to calculate rolling average of sensor data “Y” in sqlite database. “time” is the unique column. I would like to calculate “...
mar79s's user avatar
  • 1
1 vote
0 answers
59 views

How to make Grafana interpret my data as an Histogram?

I'm using this dummy data just as an example. When applying this query on an Histogram panel I'm getting the wrong histogram. Why? SELECT CASE WHEN value BETWEEN 0 AND 9 THEN '0 - 9' ...
greenButMellow's user avatar
0 votes
0 answers
126 views

Grafana dashboard: Db query error: sql: expected 30 arguments, got 0

I have a constant variable Shift1_StartTime whose value is '7:30:00' and I have a SQL query WITH DataLogKWH AS ( SELECT SourceID, TimestampUTC, Value - LAG(value, 1, 0) ...
jitender singh's user avatar
0 votes
0 answers
110 views

how to use Absolute time range grafana when not exist timestamp column

this is my_table on postgresql db. I have not specific column for timestamp or datetime. I want to draw this table on Grafana. To display the traffic according to Grafana absolute time range. Now with ...
Esmail Ebrahimi's user avatar
0 votes
0 answers
50 views

Company Name Variable

I'm trying to add a variable in Grafana to filter on company name. It doesn't show any errors, but it doesn't show the data when connecting the filter. On the variable page itself it shows the right ...
Sjors van de Brug's user avatar
0 votes
0 answers
154 views

Grafana relabel legend on Prometheus time-series bar gauge via sql lookup

I have a simple panel displaying a bar gauge from a Prometheus query: sum by (obj_id) (increase(my_fancy_metric{}[$__range])) > 0 and the bar gauge displays as expected, similar to: <uuid1> [...
Matt's user avatar
  • 351
1 vote
0 answers
77 views

Unable to execute query due to variables not decoding

i am using grafana 10.0.0v i am getting sql query from a mysql table which i am storing in a variable and when i use the variable it should trigger the query present in the variable,it is working fine ...
saiteja_n05's user avatar
1 vote
0 answers
119 views

Grafana Datediff with Synapse Datasource

I have a simple query that works within Azure Synapse using its built-in MySql Server: SELECT TOP (15) cast ("Betriebstag" as DATETIME), CONVERT (VARCHAR, "Betriebstag", 34) as ...
Max86's user avatar
  • 75
2 votes
1 answer
786 views

Grafana SQL template variables (value, text)

I'm using the Grafana Athena plugin for analysing time series data. I want to allow my users to select multiple columns in a drop down and have them displayed in a panel. To do this, I'm using a query ...
mfcss's user avatar
  • 1,461
3 votes
3 answers
1k views

GRAFANA db query error: pq: column "name" does not exist

I am trying to get some graph about different entries in a column in Grafana, but Grafana tries to recognize the antry as a column instead of a column value. I have the following setup: A PostgreSQL ...
albdev's user avatar
  • 73
1 vote
1 answer
432 views

Querying multiple values inside textbox variable with postgreSQL

I am building a simple Grafana dashboard that would act as a (simplified) DB client for our support team. One of the important queries is an output based on a list of input values. I want to construct ...
Ott Jakovlev's user avatar
1 vote
1 answer
194 views

operator does not exist for timestamps

I am new to Grafana and have a (probably simple) problem: I create a variable in Grafana as: SELECT to_char("date", 'DD-MM-YYYY') FROM my.database; The variable is named date_as_date. The ...
Max86's user avatar
  • 75
1 vote
2 answers
520 views

Showing the Difference between 2 sources / queries in Grafana

At the minute I have 2 lists of data from 2 different queries and sources, for example I have: Source 1 Red Blue White Green Black Source 2 Red Blue Black I want to be able to compare the 2 and show ...
user2572639's user avatar
-1 votes
1 answer
47 views

Why doesn't the hard_limit_line in Grafana, postgre SQL doesn't show for the whole part of the graph? Instead only half way?

There is a set Hard_limit_power for each cluster and in this case it's 190kW but the line only shows for a certain period and not for the entire graph region. How can i extend this line? The written ...
Saajid Rameez's user avatar
0 votes
1 answer
1k views

Grafana Dashboard Time Series delta

I am plotting a metric on a time series panel inside a Grafana dashboard. How can I make the time series show the delta for the chosen timeframe - the difference between the first and last value in ...
alex747's user avatar
  • 149
0 votes
1 answer
107 views

convert event data to timeseries

I have a table like CODE | start | end A | 2023-03-03 |2023-03-04 A | 2023-03-07 |2023-03-09 B | 2023-03-03 |2023-03-06 C | 2023-03-02 | "null" Where code is the event code, ...
user835132's user avatar
0 votes
1 answer
1k views

Declare variable in Grafana query from dashboard variable

I am using a table visualization in Grafana and I want to filter the content of the table with a variable called "PC", of type query, showing a list of PC names. The SQL sentence that I am ...
Jose Mari Muguruza's user avatar
0 votes
1 answer
853 views

Alias Name in Postgresql with value from select statement

I am performing a select query to select time-series values. I select the column with the timestamp and the column with a measured value from two sub-queries that contain the relevant data. SELECT ...
DerWolferl's user avatar
-3 votes
1 answer
137 views

How to use multiple timezone on grafana

I have open this post today but some of rules i need to delete for recreate. Summarize, I have grafa 9.3.6 running on rhel 7.9. My dashboard has 2 different data source. 1.) Influxdb 2.) Sql server My ...
microracle's user avatar
0 votes
2 answers
955 views

How to configure OpenSearch/ElasticSearch SQL plug-in as a datasource in Grafana?

OpenSearch (or ElasticSearch) has a SQL plug-in that is accessible via /_plugins/_sql URL. I can run a SQL Query on the ES Dashboard using a query like this: POST /_plugins/_sql { "query": ...
rrlamichhane's user avatar
  • 1,635
0 votes
0 answers
33 views

How CASE or select if cab be used based on some conistion to fetch data from diffrent table in mysql

there are two tables suppose (t1 and t2) based on the constant condition I want to fetch data from different table txn is a predefined value I want something like this like: if txn=0 (select * from ...
aman singh's user avatar
0 votes
2 answers
215 views

Bigquery Where = ANY

I am querying Bigquery using Grafana, In Grafana i use a text box variable(SrcAddr) to select certain values. Select * from flow_tables where SrcAddr = '100.100.100.1' if the User did not provide any ...
Vishnu Be's user avatar
1 vote
1 answer
484 views

Grafana User Growth Time Series with SQL Server

I'm trying display the user growth per day using Grafana Time Series with SQL Server. However I found the documentation to be unhelpful and my queries are incorrect. The following returns a constant ...
kiwi's user avatar
  • 93
0 votes
2 answers
514 views

SQL - How to combine two queries from the same tables into one table with separate columns from each query?

I have a table in a database that is structures as follows: | date | app | action | response | |-----------|--------|-----------|----------| | 9/22/2022 | e-file | launch | 2 | | ...
dreampopgaze's user avatar
1 vote
1 answer
261 views

PostgresSQL query in Grafana, create graph of Null and non-null elements

I have a table with a NIF field, that field can be null or non-null. I wanted to create a graph where I could show the number of null and non-null elements. The current consultation is: SELECT 0 ...
Iago F's user avatar
  • 21
1 vote
1 answer
40 views

SQL query swap column and row

I would like to know how I can swap the row and column data It is original data I would like to show like this by SQL query
Jaeseo Lee's user avatar
0 votes
1 answer
118 views

SQL Query to get userCount who have visited the site more than 2 times before the instant when it is checked

I have a table where we keep the log every time a user visit the page. We want to get count of users who have already visited the site more than 1 times. Let say a user visited site on 1st and then on ...
Alok Singh's user avatar
1 vote
2 answers
234 views

Organizing data by month in grafana using psql

so im trying to create a Bar gauge dashboard and i have my code right the only problem is that the results given are by Month Name and in the dashboard it is not organized in the right order instead ...
Hugo Hora's user avatar
0 votes
1 answer
40 views

SQL query for determining which grouped row is True

I have the following database structure datetime:datetime|id:id|result:bool|s_num:string|name:string Sample of db Datetime |id |result | s_num |name __________________________________________ 12....
Aleksander Ikleiw's user avatar
1 vote
0 answers
636 views

Make a time series plot in grafana with multiple lines

I have a db with tables like: table1: | id | datetime | group | |---|---|---| |0|2022-07-14 06:03:05.000|1| |0|2022-07-14 05:02:05.000|1| |0|2022-07-14 05:01:05.000|2| |0|2022-07-14 04:03:05.000|1| |0|...
Dmitry's user avatar
  • 316
-3 votes
3 answers
771 views

Calculate Sum of Mean and Std dev in sql query on single column

I am having table name as "Table1" in mysql.I have to find Sum of Mean and Std dev on column "Open".I did it easily using python but I am unable to do it using sql. Select * from ...
Divyank's user avatar
  • 1,036
0 votes
2 answers
947 views

Grafana Status timeline not working with PostgresSQL and only one Query

I’m creating a dashboard in Grafana with data extracted from Google Servers and stored in a PostgresSQL Database. In one of the visualization I would like to create a Status Timeline: I have created ...
Jorge Lopez Marcos's user avatar
1 vote
1 answer
2k views

Unable to use SQL CASE statement in Grafana when plotting a time series?

Trying to use a SQL query in Grafana v8.3.3 to plot a time-series to alert if no orders recieved in a previous hour, but only during essentially business hours (i.e 8am - 10pm). Since the alert can ...
Basq's user avatar
  • 46