I'm using RRDtool for graphing some monitoring information. One problem I faced when using rrd is using GRPINT
directive. I use following command to graph networking Rx/Tx data:
rrdtool graph out.png -v bytes -a PNG --start "-6 hour" --title "WLAN traffic" \
--vertical-label="Bit/s" \
'DEF:_rx=/root/ppp0.rrd:rx:AVERAGE' \
'DEF:_tx=/root/ppp0.rrd:tx:AVERAGE' \
'CDEF:tx=_tx,-8,*' \
'CDEF:rx=_rx,8,*' \
'COMMENT:WLAN traffic\j' \
"AREA:rx开发者_如何学运维#333333:WLAN Rx" \
"AREA:tx#990000:WLAN Tx" \
'GPRINT:rx:AVERAGE:"Rx average - %d"' \
'GPRINT:tx:AVERAGE:"Tx average - %d"'
I've got:
ERROR: bad format for GPRINT in 'Rx average - %d'
I tried to simplify format, but when I've got:
ERROR: bad format for GPRINT in '%d'
I understand that I doing something completely wrong. What's the problem?
Your %d
format is for integers. GPRINT
(and PRINT
) only support double formats ... see man sprintf
for inspiration. Try %.0lf
for starters.
精彩评论