Search code examples
grafanaprometheus-node-exporter

How to plot curve smoothly in grafana with Prometheus


I have a Grafana dashboard which plot the data of Premethus/node-exportor. But the line looks like a lot of mountain peaks, how do I set the metrics so that the line looks smooth?

e.g. to get cpu utility, the current metrics I use is below. How to make the curve show as a line:   100 - avg by (instance) (irate(node_cpu_seconds_total{mode="idle",project="$project"}[5m])) * 100

it looks like this: enter image description here


Solution

  • You may smooth the plot be increasing the observed time span that you use for averaging

    100 - avg by (instance) (irate(node_cpu_seconds_total{mode="idle",project="$project"}[<time_span>])) * 100
    

    in your case time_span=5m try to increase it to time_span=30m