Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the x axis in Graphite/Grafana (to graph by day)?

I would like to have a bar graph in graphite/grafana that has a single bar per day, over the week. Ideally we would have the days of the week (Monday,Tuesday...etc) on the x axis labels, and then seven bars in the graph, one for each day of the week. I can't seem to change the X axis at all though.

Thoughts: I could cook the time data, and send it a fixed time since epoch value, but this results in a very thin bar on the grafana page. I could write a script to send a huge amount of metrics with seconds since epoch values representing the entire day in order to make the semblance of a daily bar, but that still doesn't help me change x-axis labels and seems like a horrible way to use this tool.

Can this even be done with graphite, or is it strictly focused on real time graphs?

like image 339
user3037691 Avatar asked Feb 03 '15 22:02

user3037691


People also ask

How do I change axis in Grafana?

In the panel legend, click the colored line next to the name of the time series. In the Colors pop-up, click the Y-Axis tab, and enable Use right y-axis .

How do you use time range in Grafana?

You can select absolute time ranges (from 2021-12-02 00:00:00 to 2021-12-05 23:59:59) or relative time ranges (from 2 days ago until now), and changing a time range will automatically refresh all the panel queries with the new time range.

Is Grafana only for time series data?

Description. Grafana can graph time series data from many types of data sources extremely well. But sometimes you just want to graph, simple non time series data. I.e, data without timestamps, basic tables that show simple statistics.


1 Answers

Try using the Graphite summarize() function. In Grafana you can find it under the "transform" functions when adding a Graphite metric. Use "1d" for aggregating by day.

Then go to "Display Styles" and check only the "Bars" checkbox to get the bar plot.

This won't give you nice Mo-Su labels in the X axis though.

like image 160
dukebody Avatar answered Sep 28 '22 04:09

dukebody