-- coding: utf-8 --
#!/usr/bin/env python
import rrdtool
import time
title = "server network traffic ("+time.strftime('%Y-%m-d%', time.localtime(time.time()))+")"
rrdtool.graph("flow.png", "--start", "-1d", "--vertical-label=Bytes/s",\
"--x-grid", "MINUTE:15:HOUR:1:HOUR:1:0:%H", \
"--width", "650", "--height", "230", "--title", title,
"DEF:inoctets=Flow.rrd:eth1_in:AVERAGE",
"DEF:outoctets=Flow.rrd:eth1_out:AVERAGE",
"CDEF:total=inoctets,outoctets,+",
"LINE1:total#FF8833:Total traffic",
"AREA:inoctets#00ff00:IN traffic",
"LINE1:outoctets#0000ff:OUT traffic",
"HRULE:6144#FF0000:Alarm line\r",
"CDEF:inbits=inoctets,8,",
"CDEF:outbits=outoctets,8,",
"COMMENT:\r",
"COMMENT:\r",
#"GPRINT:inbits:AVERAGE:Avg In traffic\: %6.21f %Sbps",
"COMMENT: ",
#"GPRINT:inbits:MAX:MAX In traffic\: %6.21f %Sbps",
"COMMENT: ",
#"GPRINT:inbits:MIN:MIN In traffic\: %6.21f %Sbps\r",
"COMMENT: ",
#"GPRINT:outbits:AVERAGE:Avg OUT traffic\: %6.21f %Sbps",
"COMMENT: ",
#"GPRINT:outbits:MAX:MAX out traffic\: %6.21f %Sbps",
"COMMENT: ",
#"GPRINT:outbits:MIN:MIN out traffic\: %6.21f %Sbps\r"
)