Grafana graph bars uneven - grafana

I wanted to show the number and status of Redmine bugs per day through Grafana. My X-axis is time, and as time goes on, my bar graph is sometimes uneven, and I don't know what's going on. Does anyone know how to do to make my bar graph even?
My SQL:
SELECT
$__timeGroup(created_on, "1400m") AS time_sec,
count(*) as value,
is2.name
FROM issues i
left join issue_statuses is2 on is2.id = i.status_id
WHERE
$__timeFilter(created_on) and to_days(now())-to_days(created_on)<7
group by time_sec,is2.name

Your dashboard time range has To: now - so, that's current time.
Use now/d in To - that's end of current day (and also now-7d/d will be good From in this case).

Related

I can't show to Grafana what time field it should use for chart building

I have a Postgresql DataSource with the following table:
It's kinda logs. All I want is to show on a chart how many successful records (with http_status == 200) do I have per each hour. Sounds simple, right? I wrote this query:
SELECT
count(http_status) AS "suuccess_total_count_per_hour",
date_trunc('hour', created_at) "log_date"
FROM logs
WHERE
http_status = 200
GROUP BY log_date
ORDER BY log_date
It gives me the following result:
Looks good to me. I'm going ahead and trying to put it into Grafana:
Ok, I get it, I have to help Grafana to understand where is the field for time count.
I go to Query Builder and I see that it breaks me query at all. And since that moment I got lost completely. Here is the Query Builder screen:
How to explain to Grafana what do I want? I want just a simple chart like:
Sorry for the rough picture, but I think you got the idea. Thanks for any help.
Your time column (e.g. created_at) should be TIMESTAMP WITH TIME ZONE type*
Use time condition, Grafana has macro so it will be easy, e.g. WHERE $__timeFilter(created_at)
You want to have hourly grouping, so you need to write select for that. Again Grafana has macro: $__timeGroupAlias(created_at,1h,0)
So final Grafana SQL query (not tested, so it may need some minor tweaks):
SELECT
$__timeGroupAlias(created_at,1h,0),
count(*) AS value,
'succcess_total_count_per_hour' as metric
FROM logs
WHERE
$__timeFilter(created_at)
AND http_status = 200
GROUP BY 1
ORDER BY 1
*See Grafana doc: https://grafana.com/docs/grafana/latest/datasources/postgres/
There are documented macros. There are also macros for the case, when your time column is UNIX timestamp.

How to find the percentage of records that are over X in InfluxDB/Grafana?

Okay, not the greatest title, but hopefully it covers enough. I will try to explain as best I can...
I have data going to InfluxDB that tracks how long that a specific action takes to respond and I want to add a Grafana chart that shows me the percent of actions that take over 1000ms but I'm struggling to figure that out.
InfluxDb Structure :
time = the time the request was made
last = the amount of time in ms the request took.
So for example, the following would chart the time each request took...
SELECT ("last") FROM "metrics"."autogen"."application_timer" WHERE time > :dashboardTime: AND time < :upperDashboardTime: FILL(null)
What I want though, is to track the percentage of requests that take over 1000ms. I'm extremely unfamiliar with Influx/Grafana so my pseudo code looks something like this...
select ((select count(last) > 1000) / (select count(last)) FROM "metrics"."autogen"."application_timer" WHERE time > :dashboardTime: AND time < :upperDashboardTime: FILL(null)
Could someone push me in the right direction with this? I'm sure its something simple, but I've read through a handful of tutorials on the internet and just can't seem to get my query right.
Thank you!
InfluxQL is not SQL, so you can't do that with your current data structure. See InfluxDB doc - https://docs.influxdata.com/influxdb/v1.8/guides/calculate_percentages/ where are also example data.

Tableau Maximum of a Sum

I am relatively new to Tableau and this problem has been a real head scratcher.
I have a database table with a similar layout to:
ID INT (Unique ID)
create_ts DateTime
What I want is a bar graph that is bucketed for each hour (0-23.) This was easy enough to accomplish with Tableau's Datepart function. But for the height of the bars, I want the maximum count(*) that happened during that hour on any given day. So for hour 1 (1 AM) I want to see the highest number of count(ID) with a create_ts in the 1 AM hour calculated by day of create_ts. Hopefully that makes sense. Basically looking for peak numbers.
I have looked into "Level of Detail" calculations for Tableau, but was unable to make this work. I am on Tableau v10
Hope this helps!
Create calculated field maxIDCount having definition as below and use it as the vertical bar field.
{fixed[datepart_hour_field]: countd([ID])}
Don't forget to let us know if it solved your problem:)

Eclipse BIRT Timeline for one Day in minutes

I am building reports with Eclipse BIRT and got to a problem with the scales of the x-axis. I am getting my input with a select-string out of a database table. There I have events from a Nagios-log-file, with timestamps for every events begin and end. Out of them I create a time like hh:mm, this is enough, it doesn't have to have the seconds or the date (These I select somewhere else). For every event I get a 1 or a 0, representing up- and downtimes.
Now I want to built the report so that I have the scaling of the x-axis for all 1440 Minutes of the day, just changing the state (to 0) when there is a downtime. I've already tried to format the scale, but it doesn't work at all. After days of searching and 'try and error' I am now asking for help. Is there a way to format the chart the way I need and how could it be done?
The last idea of mine was to have another table with every minute inculded from which I select the data and to update this table with the event-data from the nagios-log-table, but this doens't seem to be an adequate solution. Maybe there is something simple I am just not able to see right now.
P.S.: I am fairly new in this and the eclipse manual did not help me with this specific problem. I also know that there are easy, simply and amazing ways to get those kinds of report out of nagios, but I have to do it with BIRT...
I finally found a way to get the report the way I needed.
I am joining my data_table with "generate_series" to get the missing data for every minute.
The postgresql statement looks like:
select *, coalesce(updown, 1)
from generate_series ('19.12.2015 00:00'::timestamp, '19.12.2015 23:59', '1 minute')
left join data_table
on date_trunc('minute',to_timestamp(date_ts)) = generate_series
and host like '%host%';
This may not be the best way to do it, but it worked for me and maybe it is also helpful for others. To usw this with BIRT I just replaced the host and the dates with the parameter-sgn "?".

Backward looking back log report

I'm trying to write a backlog report in Crystal Reports XI attached to Fluke Met/Track database (Sybase back-end)
I have it running between a start & end date, then grouped by Month and then Day.
I need it to show all of the units that were in the lab on the days between the start & end dates
October Units
2
22525
22526
3
22525
22526
22527
4
22526
22527
22530
The order of the units doesn't matter, just that the units are showing up.
Maybe I'm just having a rough day, but I'm not seeing how this can be accomplished.
You can accomplish this by adding a group for your date, opening up the Group Expert, click your Group click Options, then you should see something along the lines of "The section will be printed:" and you can select: for each day.. This should allow grouping for each day.