问题
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