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

早过忘川 提交于 2019-12-23 10:04:55

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/28309710/how-to-change-the-x-axis-in-graphite-grafana-to-graph-by-day

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!