RPi-Monitor icon indicating copy to clipboard operation
RPi-Monitor copied to clipboard

Graph question

Open 4k3or3et opened this issue 4 years ago • 1 comments

Hi All

i am monitoring number of established connection with RPi-Monitor like this:

dynamic.1.name=test
dynamic.1.source=netstat -natu | grep 'ESTABLISHED' | grep -v "127.0.0.1" | grep -c $
dynamic.1.regexp=(.*)
dynamic.1.rrd=GAUGE

web.status.1.content.1.name=test1
web.status.1.content.1.line.1='Established Connections: <b>' + data.test + '</b>'

web.statistics.1.content.1.name=test1
web.statistics.1.content.1.graph.1=test
web.statistics.1.content.1.ds_graph_options.test.label=Established Connections

What i can't understand is why graph has values with decimal places when output is always a full number with no decimal places at all. It looks like that:

Annotation 2020-05-31 121539

Is there anything i can do to round up the values on the graph?

Thank you.

4k3or3et avatar May 31 '20 10:05 4k3or3et

Hello. The RRD graphic do some interpolation with value between two measure. On my side, I did the following to have rounded value :

# Be sure the number is converted to a numeric
dynamic.NN.postprocess=$1+0
(...)
# Change tooltip display on graph
web.statistics.NN.content.ZZ.graph_options.tooltipOpts={ content: "<h4>%s</h4> Value: %y.0<br/>At: %x", dateFormat:"%y-%0m-%0d %H:%M"}

The trick is to use "%y.0" in the tooltip window to not display decimal number.

psa-jforestier avatar Aug 27 '21 16:08 psa-jforestier