I would to like to get a Grafana/InfluxDB query to plot a graph which will be sum of per day data count. For example, Our application the current user session (scur) , i would like to get the total number of user session in each day through grafana. Could some one please help me.
@pradeep.verizon Thanks for the question!
This usecase is fairly common for users of InfluxDB. The first thing I would need to know is how you are persisting application data in InfluxDB. Using one of the Client Libraries to get that data out of the application is a common way.
If you already have the data you need in InfluxDB I need to know the measurement name, tag names and field names to help you construct a query.
Can you share any of that information?
Thank you for your response. The Below is the information you have asked.
measurement name = haproxy
tag names =“host” = ‘proxy.test.com’,“sv” = ‘FRONTEND’ ,“proxy” = 'https-server’
field Names = scur
Below is the query i tried to use to get the total value of a day
SELECT mean(“scur”) FROM “haproxy” WHERE “host” = ‘proxy.test.com’ AND “sv” = ‘FRONTEND’ AND “proxy” = ‘https-server’ AND $timeFilter GROUP BY time($__interval) fill(null)
@pradeep.verizon What is the value of the
scur field? Is it a counter, or an ID? If it is a counter or an ID (i.e. when a new session is started, a point is recorded) then a query that counts the points would give you that number:
SELECT count("scur") FROM "haproxy" WHERE "host" = 'proxy.test.com' AND "sv" = 'FRONTEND' AND "proxy" = 'https-server' AND $timeFilter GROUP BY time($__interval) fill(null)
Hope this helps!
Thanks for your response
scur is not a counter. scur is the “current webserver session”.We are trying to get a graph that has sum(total) of each days web server session
@pradeep.verizon With the way you are currently writing data that is not possible. The same session could be included in multiple different reports and therefore counted multiple times. You would need an individual point for each session.
Are you using the telegraf HAProxy plugin?
@jackzampolin. Yes We are using telegraf HAProxy Plugins to collect current Haproxy Session.
we have a Haproxy Server (haproxy01) which is connected to the application server (appserver01). We have using telegraf and collecting HAproxy Stats from haproxy01. Now are are using below query to collect the current session
SELECT distinct("scur") As "Confluence Current User Session" FROM "haproxy" WHERE "sv" = 'FRONTEND' AND "proxy" = 'https-confluence' AND $timeFilter GROUP BY time($interval) fill(null)
In the same way , we are trying to plot a graph which will give us total number of session of each day( 12:00 AM - 11:59 PM) and the time serous will be date instead of hours