RRDtool格式错误问题
我正在使用 RRDtool 来绘制一些监控信息。我在使用 rrd 时遇到的一个问题是使用 GRPINT 指令。我使用以下命令来绘制网络 Rx/Tx 数据图:
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"'
我已经得到:
ERROR: bad format for GPRINT in 'Rx average - %d'
我尝试简化格式,但是当我得到:
ERROR: bad format for GPRINT in '%d'
我明白我做的事情完全错误。有什么问题吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的
%d
格式适用于整数。GPRINT
(和PRINT
)仅支持双格式...请参阅man sprintf
获取灵感。首先尝试%.0lf
。Your
%d
format is for integers.GPRINT
(andPRINT
) only support double formats ... seeman sprintf
for inspiration. Try%.0lf
for starters.