
# FlowScan Makefile for graphs
# $Id: graphs.mf.in,v 1.24 2001/02/14 21:52:39 dplonka Exp $
#
# usage:
#    make -f graphs.mf [filetype=<png|gif>] [width=x] [height=y] [ioheight=y+n] [hours=h] [tag=_tagval] [events=public_events.txt] [organization='Foobar U - Springfield Campus']
#
# e.g.:
#
#    $ make -f graphs.mf hours=24 tag=_day
#
#    $ make -f graphs.mf filetype=gif hours=168 tag=_week
#
#    $ make -f graphs.mf width=320 height=100 ioheight=120 tag=_small
#
#
# Dave Plonka <plonka@doit.wisc.edu>

SHELL = @KSH_PATH@

perl = @PERL_PATH@
rrdtool = @RRDTOOL_PATH@
rrddir = .

event2vrule = @prefix@/bin/event2vrule

# { you might want to specify these on the make(1) command line:
width = 640
height = 150
hours = 48

# this specifies the heigth for the graphs named "io_*":
ioheight = 320

filetype = png
# filetype = gif

# this is a suffix that you can add to the end of the graph file names:
# e.g. make hours=24 tag=_1d
tag =

# this is a file containing events that you'd like to be displayed in the graph:
events = /dev/null

# this is the name of your organization for graph titles
organization = 'Campus'

past_hours = $$($(perl) -e 'print time - $(hours)*60*60')
# }

# Turn the filetype into uppercase - as rrdtool likes it with "--imgformat":
IMGFORMAT = "$$(typeset -u IMGFORMAT=$(filetype); print $${IMGFORMAT?})"

# This is the time before which you do not want to graph the data values,
# because they are unreliable:
# Fri Apr  9 10:30:00 1999
totals_last_error = 923671800

totals_past_hours = $$($(perl) -e '$$when = time - $(hours)*60*60; if (0 == $(totals_last_error) || $(totals_last_error) > $$when) { print "$(totals_last_error)" } else { print $$when } ')

all: services protocols io
protocols: protocols_Mbps$(tag).$(filetype) protocols_pkts$(tag).$(filetype) protocols_flows$(tag).$(filetype)
services: services_Mbps$(tag).$(filetype) services_flows$(tag).$(filetype) services_pkts$(tag).$(filetype)

# These are the 'i'nbound/'o'utbound graphs inspired by example graphs
# by Alexander Kunz <Alexander.Kunz@nextra.de>:
io: io_services_bits$(tag).$(filetype) io_services_pkts$(tag).$(filetype) io_services_flows$(tag).$(filetype) io_protocols_bits$(tag).$(filetype) io_protocols_pkts$(tag).$(filetype) io_protocols_flows$(tag).$(filetype)

DEF_total_out_bytes = DEF:total_out_bytes=$(rrddir)/total.rrd:out_bytes:AVERAGE
CDEF_total_out_bits = CDEF:total_out_bits=total_out_bytes,8,*
DEF_total_in_bytes = DEF:total_in_bytes=$(rrddir)/total.rrd:in_bytes:AVERAGE
CDEF_total_in_bits = CDEF:total_in_bits=total_in_bytes,8,*
CDEF_total_bytes = CDEF:total_bytes=total_out_bytes,total_in_bytes,+

DEF_total_out_flows = DEF:total_out_flows=$(rrddir)/total.rrd:out_flows:AVERAGE
DEF_total_in_flows = DEF:total_in_flows=$(rrddir)/total.rrd:in_flows:AVERAGE
CDEF_total_flows = CDEF:total_flows=total_out_flows,total_in_flows,+

DEF_total_out_pkts = DEF:total_out_pkts=$(rrddir)/total.rrd:out_pkts:AVERAGE
DEF_total_in_pkts = DEF:total_in_pkts=$(rrddir)/total.rrd:in_pkts:AVERAGE
CDEF_total_pkts = CDEF:total_pkts=total_out_pkts,total_in_pkts,+

DEF_MCAST_out_bytes = DEF:MCAST_out_bytes=$(rrddir)/MCAST.rrd:out_bytes:AVERAGE
CDEF_MCAST_out_bits = CDEF:MCAST_out_bits=MCAST_out_bytes,8,*
DEF_MCAST_in_bytes = DEF:MCAST_in_bytes=$(rrddir)/MCAST.rrd:in_bytes:AVERAGE
CDEF_MCAST_in_bits = CDEF:MCAST_in_bits=MCAST_in_bytes,8,*
CDEF_MCAST_out_Mbps = CDEF:MCAST_out_Mbps=MCAST_out_bytes,.000008,*
CDEF_MCAST_in_Mbps = CDEF:MCAST_in_Mbps=MCAST_in_bytes,.000008,*
CDEF_MCAST_Mbps = CDEF:MCAST_Mbps=MCAST_out_Mbps,MCAST_in_Mbps,+

CDEF_TOTAL_Mbps = CDEF:TOTAL_Mbps=MCAST_Mbps,total_Mbps,+
CDEF_TOTAL_in_bits = CDEF:TOTAL_in_bits=MCAST_in_bits,total_in_bits,+
CDEF_TOTAL_out_bits = CDEF:TOTAL_out_bits=MCAST_out_bits,total_out_bits,+       
CDEF_TOTAL_pkts = CDEF:TOTAL_pkts=MCAST_pkts,total_pkts,+
CDEF_TOTAL_in_pkts = CDEF:TOTAL_in_pkts=MCAST_in_pkts,total_in_pkts,+
CDEF_TOTAL_out_pkts = CDEF:TOTAL_out_pkts=MCAST_out_pkts,total_out_pkts,+
CDEF_TOTAL_flows = CDEF:TOTAL_flows=MCAST_flows,total_flows,+
CDEF_TOTAL_in_flows = CDEF:TOTAL_in_flows=MCAST_in_flows,total_in_flows,+
CDEF_TOTAL_out_flows = CDEF:TOTAL_out_flows=MCAST_out_flows,total_out_flows,+

DEF_MCAST_out_pkts = DEF:MCAST_out_pkts=$(rrddir)/MCAST.rrd:out_pkts:AVERAGE
DEF_MCAST_in_pkts = DEF:MCAST_in_pkts=$(rrddir)/MCAST.rrd:in_pkts:AVERAGE
CDEF_MCAST_pkts = CDEF:MCAST_pkts=MCAST_out_pkts,MCAST_in_pkts,+

DEF_MCAST_out_flows = DEF:MCAST_out_flows=$(rrddir)/MCAST.rrd:out_flows:AVERAGE
DEF_MCAST_in_flows = DEF:MCAST_in_flows=$(rrddir)/MCAST.rrd:in_flows:AVERAGE
CDEF_MCAST_flows = CDEF:MCAST_flows=MCAST_out_flows,MCAST_in_flows,+

DEF_128_104_out_bytes = DEF:x128_104_out_bytes=$(rrddir)/128.104.0.0_16.rrd:out_bytes:AVERAGE
DEF_128_104_in_bytes = DEF:x128_104_in_bytes=$(rrddir)/128.104.0.0_16.rrd:in_bytes:AVERAGE

DEF_128_105_out_bytes = DEF:x128_105_out_bytes=$(rrddir)/128.105.0.0_16.rrd:out_bytes:AVERAGE
DEF_128_105_in_bytes = DEF:x128_105_in_bytes=$(rrddir)/128.105.0.0_16.rrd:in_bytes:AVERAGE

DEF_144_92_out_bytes = DEF:x144_92_out_bytes=$(rrddir)/144.92.0.0_16.rrd:out_bytes:AVERAGE
DEF_144_92_in_bytes = DEF:x144_92_in_bytes=$(rrddir)/144.92.0.0_16.rrd:in_bytes:AVERAGE

DEF_146_151_out_bytes = DEF:x146_151_out_bytes=$(rrddir)/146.151.0.0_16.rrd:out_bytes:AVERAGE
DEF_146_151_in_bytes = DEF:x146_151_in_bytes=$(rrddir)/146.151.0.0_16.rrd:in_bytes:AVERAGE

CDEF_128_104_bytes = CDEF:x128_104_bytes=x128_104_out_bytes,x128_104_in_bytes,+
CDEF_128_105_bytes = CDEF:x128_105_bytes=x128_105_out_bytes,x128_105_in_bytes,+
CDEF_144_92_bytes = CDEF:x144_92_bytes=x144_92_out_bytes,x144_92_in_bytes,+
CDEF_146_151_bytes = CDEF:x146_151_bytes=x146_151_out_bytes,x146_151_in_bytes,+

CDEF_subnet_bytes = CDEF:subnet_bytes=x128_104_bytes,x128_105_bytes,+,x144_92_bytes,+,x146_151_bytes,+

CDEF_total_Mbps = CDEF:total_Mbps=total_bytes,.000008,*

CDEF_campus_Mbps = CDEF:campus_Mbps=x128_104_bytes,x144_92_bytes,+,.000008,*
CDEF_resnet_Mbps = CDEF:resnet_Mbps=x146_151_bytes,.000008,*
CDEF_compsci_Mbps = CDEF:compsci_Mbps=x128_105_bytes,.000008,*

red = ff0000
green = 00ff00
blue = 0000ff

totals$(tag).$(filetype): 128.104.0.0_16.rrd 128.105.0.0_16.rrd 144.92.0.0_16.rrd 146.151.0.0_16.rrd 198.150.1.0_24.rrd 198.150.2.0_23.rrd 198.150.4.0_22.rrd total.rrd unknown.rrd MCAST.rrd
	$(rrdtool) graph \
	$@ \
	--interlaced \
	--imgformat $(IMGFORMAT) \
	--width $(width) \
	--height $(height) \
	-v 'megabits/sec' \
	-t '$(organization) I/O by Network (Mb/s)' \
	-s $(totals_past_hours) \
	$(DEF_total_out_bytes) \
	$(DEF_total_in_bytes) \
	$(CDEF_total_bytes) \
	$(CDEF_total_Mbps) \
	$(DEF_128_104_out_bytes) \
	$(DEF_128_104_in_bytes) \
	$(CDEF_128_104_bytes) \
	$(DEF_128_105_out_bytes) \
	$(DEF_128_105_in_bytes) \
	$(DEF_144_92_out_bytes) \
	$(DEF_144_92_in_bytes) \
	$(DEF_146_151_out_bytes) \
	$(DEF_146_151_in_bytes) \
	$(CDEF_128_105_bytes) \
	$(CDEF_compsci_bytes) \
	$(CDEF_compsci_Mbps) \
	$(CDEF_144_92_bytes) \
	$(CDEF_campus_Mbps) \
	$(CDEF_146_151_bytes) \
	$(CDEF_resnet_Mbps) \
	$(DEF_MCAST_in_bytes) \
	$(DEF_MCAST_out_bytes) \
	$(CDEF_MCAST_in_Mbps) \
	$(CDEF_MCAST_out_Mbps) \
	$(CDEF_MCAST_Mbps) \
	$(CDEF_TOTAL_Mbps) \
	'CDEF:mcast_pct=MCAST_Mbps,TOTAL_Mbps,/,100,*' \
	'CDEF:resnet_pct=resnet_Mbps,total_Mbps,/,100,*' \
	'CDEF:compsci_pct=compsci_Mbps,total_Mbps,/,100,*' \
	'CDEF:other_pct=campus_Mbps,total_Mbps,/,100,*' \
	AREA:MCAST_Mbps#aaaa00:'MCAST I/O' \
	STACK:resnet_Mbps#ff0000:'ResNet I/O (146.151.0.0/16)' \
	STACK:compsci_Mbps#00ff00:'Computer Sciences I/O (128.105.0.0/16)' \
	STACK:campus_Mbps#0000ff:'other Campus I/O (128.104.0.0/16 & 144.92.0.0/16)' \
	LINE1:TOTAL_Mbps#880088:'TOTAL I/O' \
	COMMENT:'\n' \
	COMMENT:'\n' \
	GPRINT:mcast_pct:AVERAGE:'MCAST %.1lf%%' \
	GPRINT:resnet_pct:AVERAGE:'ResNet %.1lf%%' \
	GPRINT:compsci_pct:AVERAGE:'Computer Sciences %.1lf%%' \
	GPRINT:other_pct:AVERAGE:'other %.1lf%%'

DEF_tcp_out_bytes = DEF:tcp_out_bytes=$(rrddir)/tcp.rrd:out_bytes:AVERAGE
DEF_tcp_in_bytes = DEF:tcp_in_bytes=$(rrddir)/tcp.rrd:in_bytes:AVERAGE
CDEF_tcp_out_bits = CDEF:tcp_out_bits=tcp_out_bytes,8,*
CDEF_tcp_in_bits = CDEF:tcp_in_bits=tcp_in_bytes,8,*
CDEF_tcp_out_Mbps = CDEF:tcp_out_Mbps=tcp_out_bytes,.000008,*
CDEF_tcp_in_Mbps = CDEF:tcp_in_Mbps=tcp_in_bytes,.000008,*
CDEF_tcp_Mbps = CDEF:tcp_Mbps=tcp_out_Mbps,tcp_in_Mbps,+

DEF_udp_out_bytes = DEF:udp_out_bytes=$(rrddir)/udp.rrd:out_bytes:AVERAGE
DEF_udp_in_bytes = DEF:udp_in_bytes=$(rrddir)/udp.rrd:in_bytes:AVERAGE
CDEF_udp_out_bits = CDEF:udp_out_bits=udp_out_bytes,8,*
CDEF_udp_in_bits = CDEF:udp_in_bits=udp_in_bytes,8,*
CDEF_udp_out_Mbps = CDEF:udp_out_Mbps=udp_out_bytes,.000008,*
CDEF_udp_in_Mbps = CDEF:udp_in_Mbps=udp_in_bytes,.000008,*
CDEF_udp_Mbps = CDEF:udp_Mbps=udp_out_Mbps,udp_in_Mbps,+

DEF_icmp_out_bytes = DEF:icmp_out_bytes=$(rrddir)/icmp.rrd:out_bytes:AVERAGE
DEF_icmp_in_bytes = DEF:icmp_in_bytes=$(rrddir)/icmp.rrd:in_bytes:AVERAGE
CDEF_icmp_out_bits = CDEF:icmp_out_bits=icmp_out_bytes,8,*
CDEF_icmp_in_bits = CDEF:icmp_in_bits=icmp_in_bytes,8,*
CDEF_icmp_out_Mbps = CDEF:icmp_out_Mbps=icmp_out_bytes,.000008,*
CDEF_icmp_in_Mbps = CDEF:icmp_in_Mbps=icmp_in_bytes,.000008,*
CDEF_icmp_Mbps = CDEF:icmp_Mbps=icmp_out_Mbps,icmp_in_Mbps,+

protocols_Mbps$(tag).$(filetype): icmp.rrd tcp.rrd udp.rrd MCAST.rrd
	$(rrdtool) graph \
	$@ \
	--interlaced \
	--imgformat $(IMGFORMAT) \
	--width $(width) \
	--height $(height) \
	-v 'megabits per second' \
	-t '$(organization) I/O by IP Protocol, Bytes' \
	-s $(past_hours) \
	$(DEF_total_out_bytes) \
	$(DEF_total_in_bytes) \
	$(CDEF_total_bytes) \
	$(CDEF_total_Mbps) \
	$(DEF_tcp_out_bytes) \
	$(DEF_tcp_in_bytes) \
	$(CDEF_tcp_out_Mbps) \
	$(CDEF_tcp_in_Mbps) \
	$(CDEF_tcp_Mbps) \
	$(DEF_udp_out_bytes) \
	$(DEF_udp_in_bytes) \
	$(CDEF_udp_out_Mbps) \
	$(CDEF_udp_in_Mbps) \
	$(CDEF_udp_Mbps) \
	$(DEF_icmp_out_bytes) \
	$(DEF_icmp_in_bytes) \
	$(CDEF_icmp_out_Mbps) \
	$(CDEF_icmp_in_Mbps) \
	$(CDEF_icmp_Mbps) \
	$(DEF_MCAST_in_bytes) \
	$(DEF_MCAST_out_bytes) \
	$(CDEF_MCAST_in_Mbps) \
	$(CDEF_MCAST_out_Mbps) \
	$(CDEF_MCAST_Mbps) \
	$(CDEF_TOTAL_Mbps) \
	AREA:tcp_in_Mbps#ff0000:'TCP in' \
	STACK:tcp_out_Mbps#880000:'TCP out' \
	STACK:MCAST_in_Mbps#aaaa00:'MCAST in' \
	STACK:MCAST_out_Mbps#555500:'MCAST out' \
	STACK:udp_in_Mbps#00ff00:'UDP in' \
	STACK:udp_out_Mbps#008800:'UDP out' \
	STACK:icmp_in_Mbps#0000ff:'ICMP in' \
	STACK:icmp_out_Mbps#000088:'ICMP out' \
	LINE1:TOTAL_Mbps#880088:'TOTAL I/O'

io_protocols_bits$(tag).$(filetype): icmp.rrd tcp.rrd udp.rrd MCAST.rrd $(events)
	$(event2vrule) -h $(hours) $(events) $(rrdtool) graph \
	$@ \
	--interlaced \
	--imgformat $(IMGFORMAT) \
	-v 'bits per second' \
	-t '$(organization) I/O by IP Protocol, Bytes, +out/-in' \
	-s $(past_hours) \
	--width $(width) \
	--height $(height) \
	--alt-autoscale \
	$(DEF_total_out_bytes) \
	$(DEF_total_in_bytes) \
	$(CDEF_total_out_bits) \
	$(CDEF_total_in_bits),-1,* \
	$(DEF_tcp_out_bytes) \
	$(DEF_tcp_in_bytes) \
	$(CDEF_tcp_out_bits) \
	$(CDEF_tcp_in_bits),-1,* \
	$(DEF_udp_out_bytes) \
	$(DEF_udp_in_bytes) \
	$(CDEF_udp_out_bits) \
	$(CDEF_udp_in_bits),-1,* \
	$(DEF_icmp_out_bytes) \
	$(DEF_icmp_in_bytes) \
	$(CDEF_icmp_out_bits) \
	$(CDEF_icmp_in_bits),-1,* \
	$(DEF_MCAST_in_bytes) \
	$(DEF_MCAST_out_bytes) \
	$(CDEF_MCAST_in_bits),-1,* \
	$(CDEF_MCAST_out_bits) \
	$(CDEF_TOTAL_out_bits) \
	$(CDEF_TOTAL_in_bits) \
	AREA:tcp_out_bits#ff0000:'TCP out' \
	STACK:MCAST_out_bits#aaaa00:'MCAST out' \
	STACK:udp_out_bits#00ff00:'UDP out' \
	STACK:icmp_out_bits#0000ff:'ICMP out' \
	LINE1:TOTAL_out_bits#880088:'TOTAL out' \
	COMMENT:'\n' \
	AREA:tcp_in_bits#880000:'TCP in ' \
	STACK:MCAST_in_bits#555500:'MCAST in ' \
	STACK:udp_in_bits#008800:'UDP in ' \
	STACK:icmp_in_bits#000088:'ICMP in ' \
	LINE1:TOTAL_in_bits#880088:'TOTAL in ' \
	HRULE:0#f5f5f5

DEF_tcp_out_pkts = DEF:tcp_out_pkts=$(rrddir)/tcp.rrd:out_pkts:AVERAGE
DEF_tcp_in_pkts = DEF:tcp_in_pkts=$(rrddir)/tcp.rrd:in_pkts:AVERAGE
CDEF_tcp_pkts = CDEF:tcp_pkts=tcp_out_pkts,tcp_in_pkts,+

DEF_udp_out_pkts = DEF:udp_out_pkts=$(rrddir)/udp.rrd:out_pkts:AVERAGE
DEF_udp_in_pkts = DEF:udp_in_pkts=$(rrddir)/udp.rrd:in_pkts:AVERAGE
CDEF_udp_pkts = CDEF:udp_pkts=udp_out_pkts,udp_in_pkts,+

DEF_icmp_out_pkts = DEF:icmp_out_pkts=$(rrddir)/icmp.rrd:out_pkts:AVERAGE
DEF_icmp_in_pkts = DEF:icmp_in_pkts=$(rrddir)/icmp.rrd:in_pkts:AVERAGE
CDEF_icmp_pkts = CDEF:icmp_pkts=icmp_out_pkts,icmp_in_pkts,+

protocols_pkts$(tag).$(filetype): icmp.rrd tcp.rrd udp.rrd MCAST.rrd
	$(rrdtool) graph \
	$@ \
	--interlaced \
	--imgformat $(IMGFORMAT) \
	--width $(width) \
	--height $(height) \
	-v 'packets per second' \
	-t '$(organization) I/O by IP Protocol, Packets' \
	-s $(past_hours) \
	$(DEF_total_out_pkts) \
	$(DEF_total_in_pkts) \
	$(CDEF_total_pkts) \
	$(DEF_tcp_out_pkts) \
	$(DEF_tcp_in_pkts) \
	$(CDEF_tcp_pkts) \
	$(DEF_udp_out_pkts) \
	$(DEF_udp_in_pkts) \
	$(CDEF_udp_pkts) \
	$(DEF_icmp_out_pkts) \
	$(DEF_icmp_in_pkts) \
	$(CDEF_icmp_pkts) \
	$(DEF_MCAST_in_pkts) \
	$(DEF_MCAST_out_pkts) \
	$(CDEF_MCAST_pkts) \
	$(CDEF_TOTAL_pkts) \
	AREA:tcp_in_pkts#ff0000:'TCP in' \
	STACK:tcp_out_pkts#880000:'TCP out' \
	STACK:MCAST_in_pkts#aaaa00:'MCAST in' \
	STACK:MCAST_out_pkts#555500:'MCAST out' \
	STACK:udp_in_pkts#00ff00:'UDP in' \
	STACK:udp_out_pkts#008800:'UDP out' \
	STACK:icmp_in_pkts#0000ff:'ICMP in' \
	STACK:icmp_out_pkts#000088:'ICMP out' \
	LINE1:TOTAL_pkts#880088:'TOTAL I/O'

io_protocols_pkts$(tag).$(filetype): icmp.rrd tcp.rrd udp.rrd MCAST.rrd $(events)
	$(event2vrule) -h $(hours) $(events) $(rrdtool) graph \
	$@ \
	--interlaced \
	--imgformat $(IMGFORMAT) \
	--width $(width) \
	--height $(height) \
	--alt-autoscale \
	-v 'packets per second' \
	-t '$(organization) I/O by IP Protocol, Packets, +out/-in' \
	-s $(past_hours) \
	$(DEF_total_out_pkts) \
	$(DEF_total_in_pkts) \
	CDEF:total_in_pkts_neg=total_in_pkts,-1,* \
	$(DEF_tcp_out_pkts) \
	$(DEF_tcp_in_pkts) \
	CDEF:tcp_in_pkts_neg=tcp_in_pkts,-1,* \
	$(DEF_udp_out_pkts) \
	$(DEF_udp_in_pkts) \
	CDEF:udp_in_pkts_neg=udp_in_pkts,-1,* \
	$(DEF_icmp_out_pkts) \
	$(DEF_icmp_in_pkts) \
	CDEF:icmp_in_pkts_neg=icmp_in_pkts,-1,* \
	$(DEF_MCAST_in_pkts) \
	CDEF:MCAST_in_pkts_neg=MCAST_in_pkts,-1,* \
	$(DEF_MCAST_out_pkts) \
	$(CDEF_TOTAL_in_pkts),-1,* \
	$(CDEF_TOTAL_out_pkts) \
	AREA:tcp_out_pkts#ff0000:'TCP out' \
	STACK:MCAST_out_pkts#aaaa00:'MCAST out' \
	STACK:udp_out_pkts#00ff00:'UDP out' \
	STACK:icmp_out_pkts#0000ff:'ICMP out' \
	LINE1:TOTAL_out_pkts#880088:'TOTAL out' \
	COMMENT:'\n' \
	AREA:tcp_in_pkts_neg#880000:'TCP in ' \
	STACK:MCAST_in_pkts_neg#555500:'MCAST in ' \
	STACK:udp_in_pkts_neg#008800:'UDP in ' \
	STACK:icmp_in_pkts_neg#000088:'ICMP in ' \
	LINE1:TOTAL_in_pkts#880088:'TOTAL in ' \
	HRULE:0#f5f5f5

DEF_tcp_out_flows = DEF:tcp_out_flows=$(rrddir)/tcp.rrd:out_flows:AVERAGE
DEF_tcp_in_flows = DEF:tcp_in_flows=$(rrddir)/tcp.rrd:in_flows:AVERAGE
CDEF_tcp_flows = CDEF:tcp_flows=tcp_out_flows,tcp_in_flows,+

DEF_udp_out_flows = DEF:udp_out_flows=$(rrddir)/udp.rrd:out_flows:AVERAGE
DEF_udp_in_flows = DEF:udp_in_flows=$(rrddir)/udp.rrd:in_flows:AVERAGE
CDEF_udp_flows = CDEF:udp_flows=udp_out_flows,udp_in_flows,+

DEF_icmp_out_flows = DEF:icmp_out_flows=$(rrddir)/icmp.rrd:out_flows:AVERAGE
DEF_icmp_in_flows = DEF:icmp_in_flows=$(rrddir)/icmp.rrd:in_flows:AVERAGE
CDEF_icmp_flows = CDEF:icmp_flows=icmp_out_flows,icmp_in_flows,+

protocols_flows$(tag).$(filetype): icmp.rrd tcp.rrd udp.rrd MCAST.rrd
	$(rrdtool) graph \
	$@ \
	--interlaced \
	--imgformat $(IMGFORMAT) \
	--width $(width) \
	--height $(height) \
	-v 'flows per second' \
	-t '$(organization) I/O by IP Protocol, Flows' \
	-s $(past_hours) \
	$(DEF_total_out_flows) \
	$(DEF_total_in_flows) \
	$(CDEF_total_flows) \
	$(DEF_tcp_out_flows) \
	$(DEF_tcp_in_flows) \
	$(CDEF_tcp_flows) \
	$(DEF_udp_out_flows) \
	$(DEF_udp_in_flows) \
	$(CDEF_udp_flows) \
	$(DEF_icmp_out_flows) \
	$(DEF_icmp_in_flows) \
	$(CDEF_icmp_flows) \
	$(DEF_MCAST_in_flows) \
	$(DEF_MCAST_out_flows) \
	$(CDEF_MCAST_flows) \
	$(CDEF_TOTAL_flows) \
	AREA:tcp_in_flows#ff0000:'TCP in' \
	STACK:tcp_out_flows#880000:'TCP out' \
	STACK:MCAST_in_flows#aaaa00:'MCAST in' \
	STACK:MCAST_out_flows#555500:'MCAST out' \
	STACK:udp_in_flows#00ff00:'UDP in' \
	STACK:udp_out_flows#008800:'UDP out' \
	STACK:icmp_in_flows#0000ff:'ICMP in' \
	STACK:icmp_out_flows#000088:'ICMP out' \
	LINE1:TOTAL_flows#880088:'TOTAL I/O'

io_protocols_flows$(tag).$(filetype): icmp.rrd tcp.rrd udp.rrd MCAST.rrd $(events)
	$(event2vrule) -h $(hours) $(events) $(rrdtool) graph \
	$@ \
	--interlaced \
	--imgformat $(IMGFORMAT) \
	--width $(width) \
	--height $(height) \
	--alt-autoscale \
	-v 'flows per second' \
	-t '$(organization) I/O by IP Protocol, Flows, +out/-in' \
	-s $(past_hours) \
	$(DEF_total_out_flows) \
	$(DEF_total_in_flows) \
	CDEF:total_in_flows_neg=total_in_flows,-1,* \
	$(CDEF_total_flows) \
	$(DEF_tcp_out_flows) \
	$(DEF_tcp_in_flows) \
	CDEF:tcp_in_flows_neg=tcp_in_flows,-1,* \
	$(CDEF_tcp_flows) \
	$(DEF_udp_out_flows) \
	$(DEF_udp_in_flows) \
	CDEF:udp_in_flows_neg=udp_in_flows,-1,* \
	$(CDEF_udp_flows) \
	$(DEF_icmp_out_flows) \
	$(DEF_icmp_in_flows) \
	CDEF:icmp_in_flows_neg=icmp_in_flows,-1,* \
	$(CDEF_icmp_flows) \
	$(DEF_MCAST_in_flows) \
	CDEF:MCAST_in_flows_neg=MCAST_in_flows,-1,* \
	$(DEF_MCAST_out_flows) \
	$(CDEF_TOTAL_in_flows),-1,* \
	$(CDEF_TOTAL_out_flows) \
	AREA:tcp_out_flows#ff0000:'TCP out' \
	STACK:MCAST_out_flows#aaaa00:'MCAST out' \
	STACK:udp_out_flows#00ff00:'UDP out' \
	STACK:icmp_out_flows#0000ff:'ICMP out' \
	LINE1:TOTAL_out_flows#880088:'TOTAL out' \
	COMMENT:'\n' \
	AREA:tcp_in_flows_neg#880000:'TCP in ' \
	STACK:MCAST_in_flows_neg#555500:'MCAST in ' \
	STACK:udp_in_flows_neg#008800:'UDP in ' \
	STACK:icmp_in_flows_neg#000088:'ICMP in ' \
	LINE1:TOTAL_in_flows#880088:'TOTAL in ' \
	HRULE:0#f5f5f5

DEF_http_src_out_bytes = DEF:http_src_out_bytes=$(rrddir)/http_src.rrd:out_bytes:AVERAGE
CDEF_http_src_out_bits = CDEF:http_src_out_bits=http_src_out_bytes,8,*
DEF_http_src_in_bytes = DEF:http_src_in_bytes=$(rrddir)/http_src.rrd:in_bytes:AVERAGE
CDEF_http_src_in_bits = CDEF:http_src_in_bits=http_src_in_bytes,8,*
CDEF_http_src_Mbps = CDEF:http_src_Mbps=http_src_out_bytes,http_src_in_bytes,+,.000008,*

DEF_http_dst_out_bytes = DEF:http_dst_out_bytes=$(rrddir)/http_dst.rrd:out_bytes:AVERAGE
CDEF_http_dst_out_bits = CDEF:http_dst_out_bits=http_dst_out_bytes,8,*
DEF_http_dst_in_bytes = DEF:http_dst_in_bytes=$(rrddir)/http_dst.rrd:in_bytes:AVERAGE
CDEF_http_dst_in_bits = CDEF:http_dst_in_bits=http_dst_in_bytes,8,*
CDEF_http_dst_Mbps = CDEF:http_dst_Mbps=http_dst_out_bytes,http_dst_in_bytes,+,.000008,*

DEF_ftp_data_src_out_bytes = DEF:ftp_data_src_out_bytes=$(rrddir)/ftp-data_src.rrd:out_bytes:AVERAGE
CDEF_ftp_data_src_out_bits = CDEF:ftp_data_src_out_bits=ftp_data_src_out_bytes,8,*
DEF_ftp_data_src_in_bytes = DEF:ftp_data_src_in_bytes=$(rrddir)/ftp-data_src.rrd:in_bytes:AVERAGE
CDEF_ftp_data_src_in_bits = CDEF:ftp_data_src_in_bits=ftp_data_src_in_bytes,8,*
CDEF_ftp_data_src_Mbps = CDEF:ftp_data_src_Mbps=ftp_data_src_out_bytes,ftp_data_src_in_bytes,+,.000008,*

DEF_ftp_data_dst_out_bytes = DEF:ftp_data_dst_out_bytes=$(rrddir)/ftp-data_dst.rrd:out_bytes:AVERAGE
CDEF_ftp_data_dst_out_bits = CDEF:ftp_data_dst_out_bits=ftp_data_dst_out_bytes,8,*
DEF_ftp_data_dst_in_bytes = DEF:ftp_data_dst_in_bytes=$(rrddir)/ftp-data_dst.rrd:in_bytes:AVERAGE
CDEF_ftp_data_dst_in_bits = CDEF:ftp_data_dst_in_bits=ftp_data_dst_in_bytes,8,*
CDEF_ftp_data_dst_Mbps = CDEF:ftp_data_dst_Mbps=ftp_data_dst_out_bytes,ftp_data_dst_in_bytes,+,.000008,*

DEF_ftpPASV_src_out_bytes = DEF:ftpPASV_src_out_bytes=$(rrddir)/ftpPASV_src.rrd:out_bytes:AVERAGE
CDEF_ftpPASV_src_out_bits = CDEF:ftpPASV_src_out_bits=ftpPASV_src_out_bytes,8,*
DEF_ftpPASV_src_in_bytes = DEF:ftpPASV_src_in_bytes=$(rrddir)/ftpPASV_src.rrd:in_bytes:AVERAGE
CDEF_ftpPASV_src_in_bits = CDEF:ftpPASV_src_in_bits=ftpPASV_src_in_bytes,8,*
CDEF_ftpPASV_src_Mbps = CDEF:ftpPASV_src_Mbps=ftpPASV_src_out_bytes,ftpPASV_src_in_bytes,+,.000008,*

DEF_ftpPASV_dst_out_bytes = DEF:ftpPASV_dst_out_bytes=$(rrddir)/ftpPASV_dst.rrd:out_bytes:AVERAGE
CDEF_ftpPASV_dst_out_bits = CDEF:ftpPASV_dst_out_bits=ftpPASV_dst_out_bytes,8,*
DEF_ftpPASV_dst_in_bytes = DEF:ftpPASV_dst_in_bytes=$(rrddir)/ftpPASV_dst.rrd:in_bytes:AVERAGE
CDEF_ftpPASV_dst_in_bits = CDEF:ftpPASV_dst_in_bits=ftpPASV_dst_in_bytes,8,*
CDEF_ftpPASV_dst_Mbps = CDEF:ftpPASV_dst_Mbps=ftpPASV_dst_out_bytes,ftpPASV_dst_in_bytes,+,.000008,*

CDEF_ftpDATA_src_Mbps = CDEF:ftpDATA_src_Mbps=ftp_data_src_Mbps,ftpPASV_src_Mbps,+
CDEF_ftpDATA_dst_Mbps = CDEF:ftpDATA_dst_Mbps=ftp_data_dst_Mbps,ftpPASV_dst_Mbps,+
CDEF_ftpDATA_src_in_bits = CDEF:ftpDATA_src_in_bits=ftp_data_src_in_bits,ftpPASV_src_in_bits,+
CDEF_ftpDATA_dst_in_bits = CDEF:ftpDATA_dst_in_bits=ftp_data_dst_in_bits,ftpPASV_dst_in_bits,+
CDEF_ftpDATA_src_out_bits = CDEF:ftpDATA_src_out_bits=ftp_data_src_out_bits,ftpPASV_src_out_bits,+
CDEF_ftpDATA_dst_out_bits = CDEF:ftpDATA_dst_out_bits=ftp_data_dst_out_bits,ftpPASV_dst_out_bits,+

DEF_nntp_src_out_bytes = DEF:nntp_src_out_bytes=$(rrddir)/nntp_src.rrd:out_bytes:AVERAGE
CDEF_nntp_src_out_bits = CDEF:nntp_src_out_bits=nntp_src_out_bytes,8,*
DEF_nntp_src_in_bytes = DEF:nntp_src_in_bytes=$(rrddir)/nntp_src.rrd:in_bytes:AVERAGE
CDEF_nntp_src_in_bits = CDEF:nntp_src_in_bits=nntp_src_in_bytes,8,*
CDEF_nntp_src_Mbps = CDEF:nntp_src_Mbps=nntp_src_out_bytes,nntp_src_in_bytes,+,.000008,*

DEF_nntp_dst_out_bytes = DEF:nntp_dst_out_bytes=$(rrddir)/nntp_dst.rrd:out_bytes:AVERAGE
CDEF_nntp_dst_out_bits = CDEF:nntp_dst_out_bits=nntp_dst_out_bytes,8,*
DEF_nntp_dst_in_bytes = DEF:nntp_dst_in_bytes=$(rrddir)/nntp_dst.rrd:in_bytes:AVERAGE
CDEF_nntp_dst_in_bits = CDEF:nntp_dst_in_bits=nntp_dst_in_bytes,8,*
CDEF_nntp_dst_Mbps = CDEF:nntp_dst_Mbps=nntp_dst_out_bytes,nntp_dst_in_bytes,+,.000008,*

DEF_smtp_src_out_bytes = DEF:smtp_src_out_bytes=$(rrddir)/smtp_src.rrd:out_bytes:AVERAGE
CDEF_smtp_src_out_bits = CDEF:smtp_src_out_bits=smtp_src_out_bytes,8,*
DEF_smtp_src_in_bytes = DEF:smtp_src_in_bytes=$(rrddir)/smtp_src.rrd:in_bytes:AVERAGE
CDEF_smtp_src_in_bits = CDEF:smtp_src_in_bits=smtp_src_in_bytes,8,*
CDEF_smtp_src_Mbps = CDEF:smtp_src_Mbps=smtp_src_out_bytes,smtp_src_in_bytes,+,.000008,*

DEF_smtp_dst_out_bytes = DEF:smtp_dst_out_bytes=$(rrddir)/smtp_dst.rrd:out_bytes:AVERAGE
CDEF_smtp_dst_out_bits = CDEF:smtp_dst_out_bits=smtp_dst_out_bytes,8,*
DEF_smtp_dst_in_bytes = DEF:smtp_dst_in_bytes=$(rrddir)/smtp_dst.rrd:in_bytes:AVERAGE
CDEF_smtp_dst_in_bits = CDEF:smtp_dst_in_bits=smtp_dst_in_bytes,8,*
CDEF_smtp_dst_Mbps = CDEF:smtp_dst_Mbps=smtp_dst_out_bytes,smtp_dst_in_bytes,+,.000008,*

DEF_7070_src_out_bytes = DEF:x7070_src_out_bytes=$(rrddir)/7070_src.rrd:out_bytes:AVERAGE
CDEF_7070_src_out_bits = CDEF:x7070_src_out_bits=x7070_src_out_bytes,8,*
DEF_7070_src_in_bytes = DEF:x7070_src_in_bytes=$(rrddir)/7070_src.rrd:in_bytes:AVERAGE
CDEF_7070_src_in_bits = CDEF:x7070_src_in_bits=x7070_src_in_bytes,8,*
CDEF_7070_src_Mbps = CDEF:x7070_src_Mbps=x7070_src_out_bytes,x7070_src_in_bytes,+,.000008,*

DEF_7070_dst_out_bytes = DEF:x7070_dst_out_bytes=$(rrddir)/7070_dst.rrd:out_bytes:AVERAGE
CDEF_7070_dst_out_bits = CDEF:x7070_dst_out_bits=x7070_dst_out_bytes,8,*
DEF_7070_dst_in_bytes = DEF:x7070_dst_in_bytes=$(rrddir)/7070_dst.rrd:in_bytes:AVERAGE
CDEF_7070_dst_in_bits = CDEF:x7070_dst_in_bits=x7070_dst_in_bytes,8,*
CDEF_7070_dst_Mbps = CDEF:x7070_dst_Mbps=x7070_dst_out_bytes,x7070_dst_in_bytes,+,.000008,*

DEF_554_src_out_bytes = DEF:x554_src_out_bytes=$(rrddir)/554_src.rrd:out_bytes:AVERAGE
CDEF_554_src_out_bits = CDEF:x554_src_out_bits=x554_src_out_bytes,8,*
DEF_554_src_in_bytes = DEF:x554_src_in_bytes=$(rrddir)/554_src.rrd:in_bytes:AVERAGE
CDEF_554_src_in_bits = CDEF:x554_src_in_bits=x554_src_in_bytes,8,*
CDEF_554_src_Mbps = CDEF:x554_src_Mbps=x554_src_out_bytes,x554_src_in_bytes,+,.000008,*

DEF_554_dst_out_bytes = DEF:x554_dst_out_bytes=$(rrddir)/554_dst.rrd:out_bytes:AVERAGE
CDEF_554_dst_out_bits = CDEF:x554_dst_out_bits=x554_dst_out_bytes,8,*
DEF_554_dst_in_bytes = DEF:x554_dst_in_bytes=$(rrddir)/554_dst.rrd:in_bytes:AVERAGE
CDEF_554_dst_in_bits = CDEF:x554_dst_in_bits=x554_dst_in_bytes,8,*
CDEF_554_dst_Mbps = CDEF:x554_dst_Mbps=x554_dst_out_bytes,x554_dst_in_bytes,+,.000008,*

DEF_real_out_bytes = DEF:real_out_bytes=$(rrddir)/RealAudio.rrd:out_bytes:AVERAGE
CDEF_real_out_bits = CDEF:real_out_bits=real_out_bytes,8,*
DEF_real_in_bytes = DEF:real_in_bytes=$(rrddir)/RealAudio.rrd:in_bytes:AVERAGE
CDEF_real_in_bits = CDEF:real_in_bits=real_in_bytes,8,*
CDEF_real_Mbps = CDEF:real_Mbps=real_out_bytes,real_in_bytes,+,.000008,*,x7070_dst_Mbps,+,x7070_src_Mbps,+,x554_dst_Mbps,+,x554_src_Mbps,+

DEF_napster_out_bytes = DEF:napster_out_bytes=$(rrddir)/NapUser.rrd:out_bytes:AVERAGE
CDEF_napster_out_bits = CDEF:napster_out_bits=napster_out_bytes,8,*
DEF_napster_in_bytes = DEF:napster_in_bytes=$(rrddir)/NapUser.rrd:in_bytes:AVERAGE
CDEF_napster_in_bits = CDEF:napster_in_bits=napster_in_bytes,8,*
CDEF_napster_Mbps = CDEF:napster_Mbps=napster_out_bytes,napster_in_bytes,+,.000008,*

services_Mbps$(tag).$(filetype): ftp-data_dst.rrd ftp-data_src.rrd ftpPASV_dst.rrd ftpPASV_src.rrd ftp_dst.rrd ftp_src.rrd http_dst.rrd http_src.rrd nntp_dst.rrd nntp_src.rrd smtp_dst.rrd smtp_src.rrd total.rrd 554_src.rrd 554_dst.rrd 7070_src.rrd 7070_dst.rrd RealAudio.rrd icmp.rrd MCAST.rrd NapUser.rrd
	$(rrdtool) graph \
	$@ \
	--interlaced \
	--imgformat $(IMGFORMAT) \
	-v 'megabits/sec' \
	-t '$(organization) Well Known Services Mb/s' \
	-s $(past_hours) \
	--width $(width) \
	--height $(height) \
	$(DEF_MCAST_in_bytes) \
	$(DEF_MCAST_out_bytes) \
	$(CDEF_MCAST_in_Mbps) \
	$(CDEF_MCAST_out_Mbps) \
	$(CDEF_MCAST_Mbps) \
	$(DEF_total_out_bytes) \
	$(DEF_total_in_bytes) \
	$(CDEF_total_bytes) \
	$(CDEF_total_Mbps) \
	$(CDEF_TOTAL_Mbps) \
	$(DEF_http_src_out_bytes) \
	$(DEF_http_src_in_bytes) \
	$(CDEF_http_src_Mbps) \
	$(DEF_http_dst_out_bytes) \
	$(DEF_http_dst_in_bytes) \
	$(CDEF_http_dst_Mbps) \
	$(DEF_ftp_data_src_out_bytes) \
	$(DEF_ftp_data_src_in_bytes) \
	$(CDEF_ftp_data_src_Mbps) \
	$(DEF_ftp_data_dst_out_bytes) \
	$(DEF_ftp_data_dst_in_bytes) \
	$(CDEF_ftp_data_dst_Mbps) \
	$(DEF_ftpPASV_src_out_bytes) \
	$(DEF_ftpPASV_src_in_bytes) \
	$(CDEF_ftpPASV_src_Mbps) \
	$(DEF_ftpPASV_dst_out_bytes) \
	$(DEF_ftpPASV_dst_in_bytes) \
	$(CDEF_ftpPASV_dst_Mbps) \
	$(CDEF_ftpDATA_src_Mbps) \
	$(CDEF_ftpDATA_dst_Mbps) \
	$(DEF_nntp_src_out_bytes) \
	$(DEF_nntp_src_in_bytes) \
	$(CDEF_nntp_src_Mbps) \
	$(DEF_nntp_dst_out_bytes) \
	$(DEF_nntp_dst_in_bytes) \
	$(CDEF_nntp_dst_Mbps) \
	$(DEF_smtp_src_out_bytes) \
	$(DEF_smtp_src_in_bytes) \
	$(CDEF_smtp_src_Mbps) \
	$(DEF_smtp_dst_out_bytes) \
	$(DEF_smtp_dst_in_bytes) \
	$(CDEF_smtp_dst_Mbps) \
	$(DEF_7070_src_out_bytes) \
	$(DEF_7070_src_in_bytes) \
	$(CDEF_7070_src_Mbps) \
	$(DEF_7070_dst_out_bytes) \
	$(DEF_7070_dst_in_bytes) \
	$(CDEF_7070_dst_Mbps) \
	$(DEF_554_src_out_bytes) \
	$(DEF_554_src_in_bytes) \
	$(CDEF_554_src_Mbps) \
	$(DEF_554_dst_out_bytes) \
	$(DEF_554_dst_in_bytes) \
	$(CDEF_554_dst_Mbps) \
	$(DEF_real_out_bytes) \
	$(DEF_real_in_bytes) \
	$(CDEF_real_Mbps) \
	$(DEF_icmp_out_bytes) \
	$(DEF_icmp_in_bytes) \
	$(CDEF_icmp_out_Mbps) \
	$(CDEF_icmp_in_Mbps) \
	$(CDEF_icmp_Mbps) \
	$(DEF_napster_out_bytes) \
	$(DEF_napster_in_bytes) \
	$(CDEF_napster_Mbps) \
	'CDEF:http_pct=http_src_Mbps,http_dst_Mbps,+,TOTAL_Mbps,/,100,*' \
	'CDEF:ftp_pct=ftpDATA_src_Mbps,ftpDATA_dst_Mbps,+,TOTAL_Mbps,/,100,*' \
	'CDEF:nntp_pct=nntp_src_Mbps,nntp_dst_Mbps,+,TOTAL_Mbps,/,100,*' \
	'CDEF:real_pct=real_Mbps,TOTAL_Mbps,/,100,*' \
	'CDEF:smtp_pct=smtp_src_Mbps,smtp_dst_Mbps,+,TOTAL_Mbps,/,100,*' \
	'CDEF:icmp_pct=icmp_Mbps,TOTAL_Mbps,/,100,*' \
	'CDEF:mcast_pct=MCAST_Mbps,TOTAL_Mbps,/,100,*' \
	'CDEF:napster_pct=napster_Mbps,TOTAL_Mbps,/,100,*' \
	'CDEF:other_pct=100,http_pct,-,ftp_pct,-,nntp_pct,-,real_pct,-,smtp_pct,-,icmp_pct,-,mcast_pct,-,napster_pct,-' \
	AREA:napster_Mbps#880088:'Napster* I/O' \
	STACK:http_src_Mbps#ff0000:'HTTP src I/O' \
	STACK:http_dst_Mbps#880000:'HTTP dst I/O' \
	STACK:ftpDATA_src_Mbps#00ff00:'FTP DATA src I/O' \
	STACK:ftpDATA_dst_Mbps#008800:'FTP DATA dst I/O' \
	STACK:MCAST_Mbps#aaaa00:'MCAST I/O' \
	STACK:nntp_src_Mbps#0000ff:'NNTP src I/O' \
	STACK:nntp_dst_Mbps#000088:'NNTP dst I/O' \
	STACK:real_Mbps#00ffff:'RealServer I/O' \
	STACK:smtp_src_Mbps#888888:'SMTP src I/O' \
	STACK:smtp_dst_Mbps#000000:'SMTP dst I/O' \
	STACK:icmp_Mbps#ff8888:'ICMP' \
	LINE1:TOTAL_Mbps#880088:'TOTAL I/O' \
	COMMENT:'\n' \
	COMMENT:'\n' \
	GPRINT:napster_pct:AVERAGE:'Napster* %.1lf%%' \
	GPRINT:http_pct:AVERAGE:'HTTP %.1lf%%' \
	GPRINT:ftp_pct:AVERAGE:'FTP DATA %.1lf%%' \
	GPRINT:mcast_pct:AVERAGE:'MCAST %.1lf%%' \
	GPRINT:nntp_pct:AVERAGE:'NNTP %.1lf%%' \
	GPRINT:real_pct:AVERAGE:'Real %.1lf%%' \
	GPRINT:smtp_pct:AVERAGE:'SMTP %.1lf%%' \
	GPRINT:icmp_pct:AVERAGE:'ICMP %.1lf%%' \
	GPRINT:other_pct:AVERAGE:'other %.1lf%%'

io_services_bits$(tag).$(filetype): ftp-data_dst.rrd ftp-data_src.rrd ftpPASV_dst.rrd ftpPASV_src.rrd ftp_dst.rrd ftp_src.rrd http_dst.rrd http_src.rrd nntp_dst.rrd nntp_src.rrd smtp_dst.rrd smtp_src.rrd total.rrd 554_src.rrd 554_dst.rrd 7070_src.rrd 7070_dst.rrd RealAudio.rrd icmp.rrd MCAST.rrd NapUser.rrd $(events)
	$(event2vrule) -h $(hours) $(events) $(rrdtool) graph \
	$@ \
	--interlaced \
	--imgformat $(IMGFORMAT) \
	-v 'bits per second' \
	-t '$(organization) Well Known Services, +out/-in' \
	-s $(past_hours) \
	--width $(width) \
	--height $(ioheight) \
	--alt-autoscale \
	$(DEF_MCAST_in_bytes) \
	$(DEF_MCAST_out_bytes) \
	$(CDEF_MCAST_in_bits),-1,* \
	$(CDEF_MCAST_out_bits) \
	$(CDEF_MCAST_in_Mbps) \
	$(CDEF_MCAST_out_Mbps) \
	$(CDEF_MCAST_Mbps) \
	$(DEF_total_out_bytes) \
	$(DEF_total_in_bytes) \
	$(CDEF_total_out_bits) \
	$(CDEF_total_in_bits),-1,* \
	$(CDEF_total_bytes) \
	$(CDEF_total_Mbps) \
	$(CDEF_TOTAL_Mbps) \
	$(CDEF_TOTAL_out_bits) \
	$(CDEF_TOTAL_in_bits) \
	$(DEF_http_src_out_bytes) \
	$(DEF_http_src_in_bytes),-1,* \
	$(CDEF_http_src_out_bits) \
	$(CDEF_http_src_in_bits),-1,* \
	$(CDEF_http_src_Mbps) \
	$(DEF_http_dst_out_bytes) \
	$(DEF_http_dst_in_bytes) \
	$(CDEF_http_dst_out_bits) \
	$(CDEF_http_dst_in_bits),-1,* \
	$(CDEF_http_dst_Mbps) \
	$(DEF_ftp_data_src_out_bytes) \
	$(DEF_ftp_data_src_in_bytes) \
	$(CDEF_ftp_data_src_out_bits) \
	$(CDEF_ftp_data_src_in_bits),-1,* \
	$(CDEF_ftp_data_src_Mbps) \
	$(DEF_ftp_data_dst_out_bytes) \
	$(DEF_ftp_data_dst_in_bytes) \
	$(CDEF_ftp_data_dst_out_bits) \
	$(CDEF_ftp_data_dst_in_bits),-1,* \
	$(CDEF_ftp_data_dst_Mbps) \
	$(DEF_ftpPASV_src_out_bytes) \
	$(DEF_ftpPASV_src_in_bytes) \
	$(CDEF_ftpPASV_src_out_bits) \
	$(CDEF_ftpPASV_src_in_bits),-1,* \
	$(CDEF_ftpPASV_src_Mbps) \
	$(DEF_ftpPASV_dst_out_bytes) \
	$(DEF_ftpPASV_dst_in_bytes) \
	$(CDEF_ftpPASV_dst_out_bits) \
	$(CDEF_ftpPASV_dst_in_bits),-1,* \
	$(CDEF_ftpPASV_dst_Mbps) \
	$(CDEF_ftpDATA_src_Mbps) \
	$(CDEF_ftpDATA_dst_Mbps) \
	$(CDEF_ftpDATA_src_in_bits) \
	$(CDEF_ftpDATA_src_out_bits) \
	$(CDEF_ftpDATA_dst_in_bits) \
	$(CDEF_ftpDATA_dst_out_bits) \
	$(DEF_nntp_src_out_bytes) \
	$(DEF_nntp_src_in_bytes) \
	$(CDEF_nntp_src_out_bits) \
	$(CDEF_nntp_src_in_bits),-1,* \
	$(CDEF_nntp_src_Mbps) \
	$(DEF_nntp_dst_out_bytes) \
	$(DEF_nntp_dst_in_bytes) \
	$(CDEF_nntp_dst_out_bits) \
	$(CDEF_nntp_dst_in_bits),-1,* \
	$(CDEF_nntp_dst_Mbps) \
	$(DEF_smtp_src_out_bytes) \
	$(DEF_smtp_src_in_bytes) \
	$(CDEF_smtp_src_out_bits) \
	$(CDEF_smtp_src_in_bits),-1,* \
	$(CDEF_smtp_src_Mbps) \
	$(DEF_smtp_dst_out_bytes) \
	$(DEF_smtp_dst_in_bytes) \
	$(CDEF_smtp_dst_out_bits) \
	$(CDEF_smtp_dst_in_bits),-1,* \
	$(CDEF_smtp_dst_Mbps) \
	$(DEF_7070_src_out_bytes) \
	$(DEF_7070_src_in_bytes) \
	$(CDEF_7070_src_out_bits) \
	$(CDEF_7070_src_in_bits),-1,* \
	$(CDEF_7070_src_Mbps) \
	$(DEF_7070_dst_out_bytes) \
	$(DEF_7070_dst_in_bytes) \
	$(CDEF_7070_dst_out_bits) \
	$(CDEF_7070_dst_in_bits),-1,* \
	$(CDEF_7070_dst_Mbps) \
	$(DEF_554_src_out_bytes) \
	$(DEF_554_src_in_bytes) \
	$(CDEF_554_src_out_bits) \
	$(CDEF_554_src_in_bits),-1,* \
	$(CDEF_554_src_Mbps) \
	$(DEF_554_dst_out_bytes) \
	$(DEF_554_dst_in_bytes) \
	$(CDEF_554_dst_out_bits) \
	$(CDEF_554_dst_in_bits),-1,* \
	$(CDEF_554_dst_Mbps) \
	$(DEF_real_out_bytes) \
	$(DEF_real_in_bytes) \
	$(CDEF_real_out_bits) \
	$(CDEF_real_in_bits),-1,* \
	$(CDEF_real_Mbps) \
	$(DEF_icmp_out_bytes) \
	$(DEF_icmp_in_bytes) \
	$(CDEF_icmp_out_bits) \
	$(CDEF_icmp_in_bits),-1,* \
	$(CDEF_icmp_out_Mbps) \
	$(CDEF_icmp_in_Mbps) \
	$(CDEF_icmp_Mbps) \
	$(DEF_napster_out_bytes) \
	$(DEF_napster_in_bytes) \
	$(CDEF_napster_out_bits) \
	$(CDEF_napster_in_bits),-1,* \
	$(CDEF_napster_Mbps) \
	'CDEF:http_in_pct=http_src_in_bits,http_dst_in_bits,+,TOTAL_in_bits,/,100,*' \
	'CDEF:ftp_in_pct=ftpDATA_src_in_bits,ftpDATA_dst_in_bits,+,TOTAL_in_bits,/,100,*' \
	'CDEF:nntp_in_pct=nntp_src_in_bits,nntp_dst_in_bits,+,TOTAL_in_bits,/,100,*' \
	'CDEF:real_in_pct=real_in_bits,TOTAL_in_bits,/,100,*' \
	'CDEF:smtp_in_pct=smtp_src_in_bits,smtp_dst_in_bits,+,TOTAL_in_bits,/,100,*' \
	'CDEF:icmp_in_pct=icmp_in_bits,TOTAL_in_bits,/,100,*' \
	'CDEF:mcast_in_pct=MCAST_in_bits,TOTAL_in_bits,/,100,*' \
	'CDEF:napster_in_pct=napster_in_bits,TOTAL_in_bits,/,100,*,' \
	'CDEF:other_in_pct=100,http_in_pct,-,ftp_in_pct,-,nntp_in_pct,-,real_in_pct,-,smtp_in_pct,-,icmp_in_pct,-,mcast_in_pct,-,napster_in_pct,-' \
	'CDEF:http_out_pct=http_src_out_bits,http_dst_out_bits,+,TOTAL_out_bits,/,100,*' \
	'CDEF:ftp_out_pct=ftpDATA_src_out_bits,ftpDATA_dst_out_bits,+,TOTAL_out_bits,/,100,*' \
	'CDEF:nntp_out_pct=nntp_src_out_bits,nntp_dst_out_bits,+,TOTAL_out_bits,/,100,*' \
	'CDEF:real_out_pct=real_out_bits,TOTAL_out_bits,/,100,*' \
	'CDEF:smtp_out_pct=smtp_src_out_bits,smtp_dst_out_bits,+,TOTAL_out_bits,/,100,*' \
	'CDEF:icmp_out_pct=icmp_out_bits,TOTAL_out_bits,/,100,*' \
	'CDEF:mcast_out_pct=MCAST_out_bits,TOTAL_out_bits,/,100,*' \
	'CDEF:napster_out_pct=napster_out_bits,TOTAL_out_bits,/,100,*,' \
	'CDEF:other_out_pct=100,http_out_pct,-,ftp_out_pct,-,nntp_out_pct,-,real_out_pct,-,smtp_out_pct,-,icmp_out_pct,-,mcast_out_pct,-,napster_out_pct,-' \
	AREA:napster_out_bits#880088:'Napster*' \
	GPRINT:napster_out_pct:AVERAGE:'%.1lf%% Out' \
	GPRINT:napster_in_pct:AVERAGE:'%.1lf%% In\n' \
	STACK:http_src_out_bits#ff0000:'HTTP src     +' \
	STACK:http_dst_out_bits#880000:'HTTP dst    ' \
	GPRINT:http_out_pct:AVERAGE:'%.1lf%% Out' \
	GPRINT:http_in_pct:AVERAGE:'%.1lf%% In\n' \
	STACK:ftpDATA_src_out_bits#00ff00:'FTP DATA src +' \
	STACK:ftpDATA_dst_out_bits#008800:'FTP DATA dst' \
	GPRINT:ftp_out_pct:AVERAGE:'%.1lf%% Out' \
	GPRINT:ftp_in_pct:AVERAGE:'%.1lf%% In\n' \
	STACK:MCAST_out_bits#aaaa00:'MCAST' \
	GPRINT:mcast_out_pct:AVERAGE:'%.1lf%% Out' \
	GPRINT:mcast_in_pct:AVERAGE:'%.1lf%% In\n' \
	STACK:nntp_src_out_bits#0000ff:'NNTP src     +' \
	STACK:nntp_dst_out_bits#000088:'NNTP dst    ' \
	GPRINT:nntp_out_pct:AVERAGE:'%.1lf%% Out' \
	GPRINT:nntp_in_pct:AVERAGE:'%.1lf%% In\n' \
	STACK:real_out_bits#00ffff:'RealServer' \
	GPRINT:real_out_pct:AVERAGE:'%.1lf%% Out' \
	GPRINT:real_in_pct:AVERAGE:'%.1lf%% In\n' \
	STACK:smtp_src_out_bits#888888:'SMTP src     +' \
	STACK:smtp_dst_out_bits#000000:'SMTP dst    ' \
	GPRINT:smtp_out_pct:AVERAGE:'%.1lf%% Out' \
	GPRINT:smtp_in_pct:AVERAGE:'%.1lf%% In\n' \
	STACK:icmp_out_bits#ff8888:'ICMP' \
	GPRINT:icmp_out_pct:AVERAGE:'%.1lf%% Out' \
	GPRINT:icmp_in_pct:AVERAGE:'%.1lf%% In\n' \
	GPRINT:other_out_pct:AVERAGE:'Other %.1lf%% Out' \
	GPRINT:other_in_pct:AVERAGE:'%.1lf%% In\n' \
	LINE1:TOTAL_out_bits#880088:'TOTAL' \
	AREA:napster_in_bits#880088 \
	STACK:http_src_in_bits#ff0000 \
	STACK:http_dst_in_bits#880000 \
	STACK:ftpDATA_src_in_bits#00ff00 \
	STACK:ftpDATA_dst_in_bits#008800 \
	STACK:MCAST_in_bits#aaaa00 \
	STACK:nntp_src_in_bits#0000ff \
	STACK:nntp_dst_in_bits#000088 \
	STACK:real_in_bits#00ffff \
	STACK:smtp_src_in_bits#888888 \
	STACK:smtp_dst_in_bits#000000 \
	STACK:icmp_in_bits#ff8888 \
	LINE1:TOTAL_in_bits#880088 \
	HRULE:0#f5f5f5

DEF_http_src_out_flows = DEF:http_src_out_flows=$(rrddir)/http_src.rrd:out_flows:AVERAGE
DEF_http_src_in_flows = DEF:http_src_in_flows=$(rrddir)/http_src.rrd:in_flows:AVERAGE
CDEF_http_src_flows = CDEF:http_src_flows=http_src_out_flows,http_src_in_flows,+
DEF_http_dst_out_flows = DEF:http_dst_out_flows=$(rrddir)/http_dst.rrd:out_flows:AVERAGE
DEF_http_dst_in_flows = DEF:http_dst_in_flows=$(rrddir)/http_dst.rrd:in_flows:AVERAGE
CDEF_http_dst_flows = CDEF:http_dst_flows=http_dst_out_flows,http_dst_in_flows,+

DEF_ftp_data_src_out_flows = DEF:ftp_data_src_out_flows=$(rrddir)/ftp-data_src.rrd:out_flows:AVERAGE
DEF_ftp_data_src_in_flows = DEF:ftp_data_src_in_flows=$(rrddir)/ftp-data_src.rrd:in_flows:AVERAGE
CDEF_ftp_data_src_flows = CDEF:ftp_data_src_flows=ftp_data_src_out_flows,ftp_data_src_in_flows,+
DEF_ftp_data_dst_out_flows = DEF:ftp_data_dst_out_flows=$(rrddir)/ftp-data_dst.rrd:out_flows:AVERAGE
DEF_ftp_data_dst_in_flows = DEF:ftp_data_dst_in_flows=$(rrddir)/ftp-data_dst.rrd:in_flows:AVERAGE
CDEF_ftp_data_dst_flows = CDEF:ftp_data_dst_flows=ftp_data_dst_out_flows,ftp_data_dst_in_flows,+
DEF_ftpPASV_src_out_flows = DEF:ftpPASV_src_out_flows=$(rrddir)/ftpPASV_src.rrd:out_flows:AVERAGE
DEF_ftpPASV_src_in_flows = DEF:ftpPASV_src_in_flows=$(rrddir)/ftpPASV_src.rrd:in_flows:AVERAGE
CDEF_ftpPASV_src_flows = CDEF:ftpPASV_src_flows=ftpPASV_src_out_flows,ftpPASV_src_in_flows,+
DEF_ftpPASV_dst_out_flows = DEF:ftpPASV_dst_out_flows=$(rrddir)/ftpPASV_dst.rrd:out_flows:AVERAGE
DEF_ftpPASV_dst_in_flows = DEF:ftpPASV_dst_in_flows=$(rrddir)/ftpPASV_dst.rrd:in_flows:AVERAGE
CDEF_ftpPASV_dst_flows = CDEF:ftpPASV_dst_flows=ftpPASV_dst_out_flows,ftpPASV_dst_in_flows,+
CDEF_ftpDATA_src_flows = CDEF:ftpDATA_src_flows=ftp_data_src_flows,ftpPASV_src_flows,+
CDEF_ftpDATA_dst_flows = CDEF:ftpDATA_dst_flows=ftp_data_dst_flows,ftpPASV_dst_flows,+

DEF_nntp_src_out_flows = DEF:nntp_src_out_flows=$(rrddir)/nntp_src.rrd:out_flows:AVERAGE
DEF_nntp_src_in_flows = DEF:nntp_src_in_flows=$(rrddir)/nntp_src.rrd:in_flows:AVERAGE
CDEF_nntp_src_flows = CDEF:nntp_src_flows=nntp_src_out_flows,nntp_src_in_flows,+
DEF_nntp_dst_out_flows = DEF:nntp_dst_out_flows=$(rrddir)/nntp_dst.rrd:out_flows:AVERAGE
DEF_nntp_dst_in_flows = DEF:nntp_dst_in_flows=$(rrddir)/nntp_dst.rrd:in_flows:AVERAGE
CDEF_nntp_dst_flows = CDEF:nntp_dst_flows=nntp_dst_out_flows,nntp_dst_in_flows,+

DEF_smtp_src_out_flows = DEF:smtp_src_out_flows=$(rrddir)/smtp_src.rrd:out_flows:AVERAGE
DEF_smtp_src_in_flows = DEF:smtp_src_in_flows=$(rrddir)/smtp_src.rrd:in_flows:AVERAGE
CDEF_smtp_src_flows = CDEF:smtp_src_flows=smtp_src_out_flows,smtp_src_in_flows,+
DEF_smtp_dst_out_flows = DEF:smtp_dst_out_flows=$(rrddir)/smtp_dst.rrd:out_flows:AVERAGE
DEF_smtp_dst_in_flows = DEF:smtp_dst_in_flows=$(rrddir)/smtp_dst.rrd:in_flows:AVERAGE
CDEF_smtp_dst_flows = CDEF:smtp_dst_flows=smtp_dst_out_flows,smtp_dst_in_flows,+

DEF_7070_src_out_flows = DEF:x7070_src_out_flows=$(rrddir)/7070_src.rrd:out_flows:AVERAGE
DEF_7070_src_in_flows = DEF:x7070_src_in_flows=$(rrddir)/7070_src.rrd:in_flows:AVERAGE
CDEF_7070_src_flows = CDEF:x7070_src_flows=x7070_src_out_flows,x7070_src_in_flows,+
DEF_7070_dst_out_flows = DEF:x7070_dst_out_flows=$(rrddir)/7070_dst.rrd:out_flows:AVERAGE
DEF_7070_dst_in_flows = DEF:x7070_dst_in_flows=$(rrddir)/7070_dst.rrd:in_flows:AVERAGE
CDEF_7070_dst_flows = CDEF:x7070_dst_flows=x7070_dst_out_flows,x7070_dst_in_flows,+

DEF_554_src_out_flows = DEF:x554_src_out_flows=$(rrddir)/554_src.rrd:out_flows:AVERAGE
DEF_554_src_in_flows = DEF:x554_src_in_flows=$(rrddir)/554_src.rrd:in_flows:AVERAGE
CDEF_554_src_flows = CDEF:x554_src_flows=x554_src_out_flows,x554_src_in_flows,+
DEF_554_dst_out_flows = DEF:x554_dst_out_flows=$(rrddir)/554_dst.rrd:out_flows:AVERAGE
DEF_554_dst_in_flows = DEF:x554_dst_in_flows=$(rrddir)/554_dst.rrd:in_flows:AVERAGE
CDEF_554_dst_flows = CDEF:x554_dst_flows=x554_dst_out_flows,x554_dst_in_flows,+

DEF_real_out_flows = DEF:real_out_flows=$(rrddir)/RealAudio.rrd:out_flows:AVERAGE
DEF_real_in_flows = DEF:real_in_flows=$(rrddir)/RealAudio.rrd:in_flows:AVERAGE
CDEF_REAL_in_flows = CDEF:REAL_in_flows=real_in_flows,x7070_src_in_flows,+,x7070_dst_in_flows,+,x554_src_in_flows,+,x554_dst_in_flows,+
CDEF_REAL_out_flows = CDEF:REAL_out_flows=real_out_flows,x7070_src_out_flows,+,x7070_dst_out_flows,+,x554_src_out_flows,+,x554_dst_out_flows,+
CDEF_REAL_flows = CDEF:REAL_flows=real_out_flows,real_in_flows,+,x7070_src_flows,+,x7070_dst_flows,+,x554_src_flows,+,x554_dst_flows,+

DEF_napster_out_flows = DEF:napster_out_flows=$(rrddir)/NapUser.rrd:out_flows:AVERAGE
DEF_napster_in_flows = DEF:napster_in_flows=$(rrddir)/NapUser.rrd:in_flows:AVERAGE
CDEF_napster_flows = CDEF:napster_flows=napster_out_flows,napster_in_flows,+

services_flows$(tag).$(filetype): ftp-data_dst.rrd ftp-data_src.rrd ftp_dst.rrd ftp_src.rrd http_dst.rrd http_src.rrd nntp_dst.rrd nntp_src.rrd smtp_dst.rrd smtp_src.rrd total.rrd 554_src.rrd 554_dst.rrd 7070_src.rrd 7070_dst.rrd RealAudio.rrd icmp.rrd MCAST.rrd NapUser.rrd
	$(rrdtool) graph \
	$@ \
	--interlaced \
	--imgformat $(IMGFORMAT) \
	-v 'flows/sec' \
	-t '$(organization) Well Known Services Flows' \
	-s $(past_hours) \
	--width $(width) \
	--height $(height)  \
	$(DEF_total_out_flows) \
	$(DEF_total_in_flows) \
	$(CDEF_total_flows) \
	$(DEF_http_src_out_flows) \
	$(DEF_http_src_in_flows) \
	$(CDEF_http_src_flows) \
	$(DEF_http_dst_out_flows) \
	$(DEF_http_dst_in_flows) \
	$(CDEF_http_dst_flows) \
	$(DEF_ftp_data_src_out_flows) \
	$(DEF_ftp_data_src_in_flows) \
	$(CDEF_ftp_data_src_flows) \
	$(DEF_ftp_data_dst_out_flows) \
	$(DEF_ftp_data_dst_in_flows) \
	$(CDEF_ftp_data_dst_flows) \
	$(DEF_ftpPASV_src_out_flows) \
	$(DEF_ftpPASV_src_in_flows) \
	$(CDEF_ftpPASV_src_flows) \
	$(DEF_ftpPASV_dst_out_flows) \
	$(DEF_ftpPASV_dst_in_flows) \
	$(CDEF_ftpPASV_dst_flows) \
	$(CDEF_ftpDATA_src_flows) \
	$(CDEF_ftpDATA_dst_flows) \
	$(DEF_nntp_src_out_flows) \
	$(DEF_nntp_src_in_flows) \
	$(CDEF_nntp_src_flows) \
	$(DEF_nntp_dst_out_flows) \
	$(DEF_nntp_dst_in_flows) \
	$(CDEF_nntp_dst_flows) \
	$(DEF_smtp_src_out_flows) \
	$(DEF_smtp_src_in_flows) \
	$(CDEF_smtp_src_flows) \
	$(DEF_smtp_dst_out_flows) \
	$(DEF_smtp_dst_in_flows) \
	$(CDEF_smtp_dst_flows) \
	$(DEF_7070_src_out_flows) \
	$(DEF_7070_src_in_flows) \
	$(CDEF_7070_src_flows) \
	$(DEF_7070_dst_out_flows) \
	$(DEF_7070_dst_in_flows) \
	$(CDEF_7070_dst_flows) \
	$(DEF_554_src_out_flows) \
	$(DEF_554_src_in_flows) \
	$(CDEF_554_src_flows) \
	$(DEF_554_dst_out_flows) \
	$(DEF_554_dst_in_flows) \
	$(CDEF_554_dst_flows) \
	$(DEF_real_out_flows) \
	$(DEF_real_in_flows) \
	$(CDEF_REAL_flows) \
	$(DEF_napster_out_flows) \
	$(DEF_napster_in_flows) \
	$(CDEF_napster_flows) \
	$(DEF_icmp_out_flows) \
	$(DEF_icmp_in_flows) \
	$(CDEF_icmp_flows) \
	$(DEF_MCAST_in_flows) \
	$(DEF_MCAST_out_flows) \
	$(CDEF_MCAST_flows) \
	$(CDEF_TOTAL_flows) \
	AREA:napster_flows#880088:'Napster* I/O' \
	STACK:http_src_flows#ff0000:'HTTP src I/O' \
	STACK:http_dst_flows#880000:'HTTP dst I/O' \
	STACK:ftpDATA_src_flows#00ff00:'FTP DATA src I/O' \
	STACK:ftpDATA_dst_flows#008800:'FTP DATA dst I/O' \
	STACK:nntp_src_flows#0000ff:'NNTP src I/O' \
	STACK:nntp_dst_flows#000088:'NNTP dst I/O' \
	STACK:REAL_flows#00ffff:'RealServer I/O' \
	STACK:smtp_src_flows#888888:'SMTP src I/O' \
	STACK:smtp_dst_flows#000000:'SMTP dst I/O' \
	STACK:icmp_flows#ff8888:'ICMP' \
	STACK:MCAST_in_flows#aaaa00:'MCAST in' \
	STACK:MCAST_out_flows#555500:'MCAST out' \
	LINE1:TOTAL_flows#880088:'TOTAL I/O'

io_services_flows$(tag).$(filetype): ftp-data_dst.rrd ftp-data_src.rrd ftp_dst.rrd ftp_src.rrd http_dst.rrd http_src.rrd nntp_dst.rrd nntp_src.rrd smtp_dst.rrd smtp_src.rrd total.rrd 554_src.rrd 554_dst.rrd 7070_src.rrd 7070_dst.rrd RealAudio.rrd icmp.rrd MCAST.rrd NapUser.rrd $(events)
	$(event2vrule) -h $(hours) $(events) $(rrdtool) graph \
	$@ \
	--interlaced \
	--imgformat $(IMGFORMAT) \
	-v 'flows per second' \
	-t '$(organization) Well Known Services Flows, +out/-in' \
	-s $(past_hours) \
	--width $(width) \
	--height $(ioheight) \
	--alt-autoscale \
	$(DEF_total_out_flows) \
	$(DEF_total_in_flows) \
	CDEF:total_in_flows_neg=total_in_flows,-1,* \
	$(CDEF_total_flows) \
	$(DEF_http_src_out_flows) \
	$(DEF_http_src_in_flows) \
	CDEF:http_src_in_flows_neg=http_src_in_flows,-1,* \
	$(CDEF_http_src_flows) \
	$(DEF_http_dst_out_flows) \
	$(DEF_http_dst_in_flows) \
	CDEF:http_dst_in_flows_neg=http_dst_in_flows,-1,* \
	$(CDEF_http_dst_flows) \
	$(DEF_ftp_data_src_out_flows) \
	$(DEF_ftp_data_src_in_flows) \
	CDEF:ftp_data_src_in_flows_neg=ftp_data_src_in_flows,-1,* \
	$(CDEF_ftp_data_src_flows) \
	$(DEF_ftp_data_dst_out_flows) \
	$(DEF_ftp_data_dst_in_flows) \
	CDEF:ftp_data_dst_in_flows_neg=ftp_data_dst_in_flows,-1,* \
	$(CDEF_ftp_data_dst_flows) \
	$(DEF_ftpPASV_src_out_flows) \
	$(DEF_ftpPASV_src_in_flows) \
	CDEF:ftpPASV_src_in_flows_neg=ftpPASV_src_in_flows,-1,* \
	$(CDEF_ftpPASV_src_flows) \
	$(DEF_ftpPASV_dst_out_flows) \
	$(DEF_ftpPASV_dst_in_flows) \
	CDEF:ftpPASV_dst_in_flows_neg=ftpPASV_dst_in_flows,-1,* \
	$(CDEF_ftpPASV_dst_flows) \
	$(CDEF_ftpDATA_src_flows) \
	$(CDEF_ftpDATA_dst_flows) \
	CDEF:ftpDATA_dst_out_flows=ftp_data_dst_out_flows,ftpPASV_dst_out_flows,+ \
	CDEF:ftpDATA_src_out_flows=ftp_data_src_out_flows,ftpPASV_src_out_flows,+ \
	CDEF:ftpDATA_dst_in_flows=ftp_data_dst_in_flows,ftpPASV_dst_in_flows,+ \
	CDEF:ftpDATA_dst_in_flows_neg=ftpDATA_dst_in_flows,-1,* \
	CDEF:ftpDATA_src_in_flows=ftp_data_src_in_flows,ftpPASV_src_in_flows,+ \
	CDEF:ftpDATA_src_in_flows_neg=ftpDATA_src_in_flows,-1,* \
	$(DEF_nntp_src_out_flows) \
	$(DEF_nntp_src_in_flows) \
	CDEF:nntp_src_in_flows_neg=nntp_src_in_flows,-1,* \
	$(CDEF_nntp_src_flows) \
	$(DEF_nntp_dst_out_flows) \
	$(DEF_nntp_dst_in_flows) \
	CDEF:nntp_dst_in_flows_neg=nntp_dst_in_flows,-1,* \
	$(CDEF_nntp_dst_flows) \
	$(DEF_smtp_src_out_flows) \
	$(DEF_smtp_src_in_flows) \
	CDEF:smtp_src_in_flows_neg=smtp_src_in_flows,-1,* \
	$(CDEF_smtp_src_flows) \
	$(DEF_smtp_dst_out_flows) \
	$(DEF_smtp_dst_in_flows) \
	CDEF:smtp_dst_in_flows_neg=smtp_dst_in_flows,-1,* \
	$(CDEF_smtp_dst_flows) \
	$(DEF_7070_src_out_flows) \
	$(DEF_7070_src_in_flows) \
	$(CDEF_7070_src_flows) \
	$(DEF_7070_dst_out_flows) \
	$(DEF_7070_dst_in_flows) \
	$(CDEF_7070_dst_flows) \
	$(DEF_554_src_out_flows) \
	$(DEF_554_src_in_flows) \
	$(CDEF_554_src_flows) \
	$(DEF_554_dst_out_flows) \
	$(DEF_554_dst_in_flows) \
	$(CDEF_554_dst_flows) \
	$(DEF_real_out_flows) \
	$(DEF_real_in_flows) \
	$(CDEF_REAL_in_flows) \
	CDEF:REAL_in_flows_neg=REAL_in_flows,-1,* \
	$(CDEF_REAL_out_flows) \
	$(CDEF_REAL_flows) \
	$(DEF_napster_out_flows) \
	$(DEF_napster_in_flows) \
	CDEF:napster_in_flows_neg=napster_in_flows,-1,* \
	$(CDEF_napster_flows) \
	$(DEF_icmp_out_flows) \
	$(DEF_icmp_in_flows) \
	CDEF:icmp_in_flows_neg=icmp_in_flows,-1,* \
	$(CDEF_icmp_flows) \
	$(DEF_MCAST_in_flows) \
	CDEF:MCAST_in_flows_neg=MCAST_in_flows,-1,* \
	$(DEF_MCAST_out_flows) \
	$(CDEF_MCAST_flows) \
	$(CDEF_TOTAL_in_flows) \
	CDEF:TOTAL_in_flows_neg=TOTAL_in_flows,-1,* \
	$(CDEF_TOTAL_out_flows) \
	$(CDEF_TOTAL_flows) \
	AREA:napster_out_flows#880088:'Napster*' \
	STACK:http_src_out_flows#ff0000:'HTTP src' \
	STACK:http_dst_out_flows#880000:'HTTP dst' \
	STACK:ftpDATA_src_out_flows#00ff00:'FTP DATA src' \
	STACK:ftpDATA_dst_out_flows#008800:'FTP DATA dst' \
	STACK:nntp_src_out_flows#0000ff:'NNTP src' \
	STACK:nntp_dst_out_flows#000088:'NNTP dst' \
	STACK:REAL_out_flows#00ffff:'RealServer' \
	STACK:smtp_src_out_flows#888888:'SMTP src' \
	STACK:smtp_dst_out_flows#000000:'SMTP dst' \
	STACK:icmp_out_flows#ff8888:'ICMP' \
	STACK:MCAST_out_flows#aaaa00:'MCAST' \
	LINE1:TOTAL_out_flows#880088:'TOTAL' \
	AREA:napster_in_flows_neg#880088 \
	STACK:http_src_in_flows_neg#ff0000 \
	STACK:http_dst_in_flows_neg#880000 \
	STACK:ftpDATA_src_in_flows_neg#00ff00 \
	STACK:ftpDATA_dst_in_flows_neg#008800 \
	STACK:nntp_src_in_flows_neg#0000ff \
	STACK:nntp_dst_in_flows_neg#000088 \
	STACK:REAL_in_flows_neg#00ffff \
	STACK:smtp_src_in_flows_neg#888888 \
	STACK:smtp_dst_in_flows_neg#000000 \
	STACK:icmp_in_flows_neg#ff8888 \
	STACK:MCAST_in_flows_neg#aaaa00 \
	LINE1:TOTAL_in_flows_neg#880088 \
	HRULE:0#f5f5f5

DEF_http_src_out_pkts = DEF:http_src_out_pkts=$(rrddir)/http_src.rrd:out_pkts:AVERAGE
DEF_http_src_in_pkts = DEF:http_src_in_pkts=$(rrddir)/http_src.rrd:in_pkts:AVERAGE
CDEF_http_src_pkts = CDEF:http_src_pkts=http_src_out_pkts,http_src_in_pkts,+
DEF_http_dst_out_pkts = DEF:http_dst_out_pkts=$(rrddir)/http_dst.rrd:out_pkts:AVERAGE
DEF_http_dst_in_pkts = DEF:http_dst_in_pkts=$(rrddir)/http_dst.rrd:in_pkts:AVERAGE
CDEF_http_dst_pkts = CDEF:http_dst_pkts=http_dst_out_pkts,http_dst_in_pkts,+

DEF_ftp_data_src_out_pkts = DEF:ftp_data_src_out_pkts=$(rrddir)/ftp-data_src.rrd:out_pkts:AVERAGE
DEF_ftp_data_src_in_pkts = DEF:ftp_data_src_in_pkts=$(rrddir)/ftp-data_src.rrd:in_pkts:AVERAGE
CDEF_ftp_data_src_pkts = CDEF:ftp_data_src_pkts=ftp_data_src_out_pkts,ftp_data_src_in_pkts,+
DEF_ftp_data_dst_out_pkts = DEF:ftp_data_dst_out_pkts=$(rrddir)/ftp-data_dst.rrd:out_pkts:AVERAGE
DEF_ftp_data_dst_in_pkts = DEF:ftp_data_dst_in_pkts=$(rrddir)/ftp-data_dst.rrd:in_pkts:AVERAGE
CDEF_ftp_data_dst_pkts = CDEF:ftp_data_dst_pkts=ftp_data_dst_out_pkts,ftp_data_dst_in_pkts,+
DEF_ftpPASV_src_out_pkts = DEF:ftpPASV_src_out_pkts=$(rrddir)/ftpPASV_src.rrd:out_pkts:AVERAGE
DEF_ftpPASV_src_in_pkts = DEF:ftpPASV_src_in_pkts=$(rrddir)/ftpPASV_src.rrd:in_pkts:AVERAGE
CDEF_ftpPASV_src_pkts = CDEF:ftpPASV_src_pkts=ftpPASV_src_out_pkts,ftp_data_src_in_pkts,+
DEF_ftpPASV_dst_out_pkts = DEF:ftpPASV_dst_out_pkts=$(rrddir)/ftpPASV_dst.rrd:out_pkts:AVERAGE
DEF_ftpPASV_dst_in_pkts = DEF:ftpPASV_dst_in_pkts=$(rrddir)/ftpPASV_dst.rrd:in_pkts:AVERAGE
CDEF_ftpPASV_dst_pkts = CDEF:ftpPASV_dst_pkts=ftpPASV_dst_out_pkts,ftpPASV_dst_in_pkts,+
CDEF_ftpDATA_src_pkts = CDEF:ftpDATA_src_pkts=ftp_data_src_pkts,ftp_data_src_pkts,+
CDEF_ftpDATA_dst_pkts = CDEF:ftpDATA_dst_pkts=ftp_data_dst_pkts,ftp_data_dst_pkts,+


DEF_nntp_src_out_pkts = DEF:nntp_src_out_pkts=$(rrddir)/nntp_src.rrd:out_pkts:AVERAGE
DEF_nntp_src_in_pkts = DEF:nntp_src_in_pkts=$(rrddir)/nntp_src.rrd:in_pkts:AVERAGE
CDEF_nntp_src_pkts = CDEF:nntp_src_pkts=nntp_src_out_pkts,nntp_src_in_pkts,+
DEF_nntp_dst_out_pkts = DEF:nntp_dst_out_pkts=$(rrddir)/nntp_dst.rrd:out_pkts:AVERAGE
DEF_nntp_dst_in_pkts = DEF:nntp_dst_in_pkts=$(rrddir)/nntp_dst.rrd:in_pkts:AVERAGE
CDEF_nntp_dst_pkts = CDEF:nntp_dst_pkts=nntp_dst_out_pkts,nntp_dst_in_pkts,+

DEF_smtp_src_out_pkts = DEF:smtp_src_out_pkts=$(rrddir)/smtp_src.rrd:out_pkts:AVERAGE
DEF_smtp_src_in_pkts = DEF:smtp_src_in_pkts=$(rrddir)/smtp_src.rrd:in_pkts:AVERAGE
CDEF_smtp_src_pkts = CDEF:smtp_src_pkts=smtp_src_out_pkts,smtp_src_in_pkts,+
DEF_smtp_dst_out_pkts = DEF:smtp_dst_out_pkts=$(rrddir)/smtp_dst.rrd:out_pkts:AVERAGE
DEF_smtp_dst_in_pkts = DEF:smtp_dst_in_pkts=$(rrddir)/smtp_dst.rrd:in_pkts:AVERAGE
CDEF_smtp_dst_pkts = CDEF:smtp_dst_pkts=smtp_dst_out_pkts,smtp_dst_in_pkts,+

DEF_7070_src_out_pkts = DEF:x7070_src_out_pkts=$(rrddir)/7070_src.rrd:out_pkts:AVERAGE
DEF_7070_src_in_pkts = DEF:x7070_src_in_pkts=$(rrddir)/7070_src.rrd:in_pkts:AVERAGE
CDEF_7070_src_pkts = CDEF:x7070_src_pkts=x7070_src_out_pkts,x7070_src_in_pkts,+
DEF_7070_dst_out_pkts = DEF:x7070_dst_out_pkts=$(rrddir)/7070_dst.rrd:out_pkts:AVERAGE
DEF_7070_dst_in_pkts = DEF:x7070_dst_in_pkts=$(rrddir)/7070_dst.rrd:in_pkts:AVERAGE
CDEF_7070_dst_pkts = CDEF:x7070_dst_pkts=x7070_dst_out_pkts,x7070_dst_in_pkts,+

DEF_554_src_out_pkts = DEF:x554_src_out_pkts=$(rrddir)/554_src.rrd:out_pkts:AVERAGE
DEF_554_src_in_pkts = DEF:x554_src_in_pkts=$(rrddir)/554_src.rrd:in_pkts:AVERAGE
CDEF_554_src_pkts = CDEF:x554_src_pkts=x554_src_out_pkts,x554_src_in_pkts,+
DEF_554_dst_out_pkts = DEF:x554_dst_out_pkts=$(rrddir)/554_dst.rrd:out_pkts:AVERAGE
DEF_554_dst_in_pkts = DEF:x554_dst_in_pkts=$(rrddir)/554_dst.rrd:in_pkts:AVERAGE
CDEF_554_dst_pkts = CDEF:x554_dst_pkts=x554_dst_out_pkts,x554_dst_in_pkts,+

DEF_real_out_pkts = DEF:real_out_pkts=$(rrddir)/RealAudio.rrd:out_pkts:AVERAGE
DEF_real_in_pkts = DEF:real_in_pkts=$(rrddir)/RealAudio.rrd:in_pkts:AVERAGE
CDEF_REAL_in_pkts = CDEF:REAL_in_pkts=real_in_pkts,x7070_src_in_pkts,+,x7070_dst_in_pkts,+,x554_src_in_pkts,+,x554_dst_in_pkts,+
CDEF_REAL_out_pkts = CDEF:REAL_out_pkts=real_out_pkts,x7070_src_out_pkts,+,x7070_dst_out_pkts,+,x554_src_out_pkts,+,x554_dst_out_pkts,+
CDEF_REAL_pkts = CDEF:REAL_pkts=real_out_pkts,real_in_pkts,+,x7070_src_pkts,+,x7070_dst_pkts,+,x554_src_pkts,+,x554_dst_pkts,+

DEF_napster_out_pkts = DEF:napster_out_pkts=$(rrddir)/NapUser.rrd:out_pkts:AVERAGE
DEF_napster_in_pkts = DEF:napster_in_pkts=$(rrddir)/NapUser.rrd:in_pkts:AVERAGE
CDEF_napster_pkts = CDEF:napster_pkts=napster_out_pkts,napster_in_pkts,+

services_pkts$(tag).$(filetype): ftp-data_dst.rrd ftp-data_src.rrd ftp_dst.rrd ftp_src.rrd http_dst.rrd http_src.rrd nntp_dst.rrd nntp_src.rrd smtp_dst.rrd smtp_src.rrd total.rrd 554_src.rrd 554_dst.rrd 7070_src.rrd 7070_dst.rrd RealAudio.rrd icmp.rrd MCAST.rrd NapUser.rrd
	$(rrdtool) graph \
	$@ \
	--interlaced \
	--imgformat $(IMGFORMAT) \
	-v 'packets/sec' \
	-t '$(organization) Well Known Services Packets' \
	-s $(past_hours) \
	--width $(width) \
	--height $(height) \
	$(DEF_total_out_pkts) \
	$(DEF_total_in_pkts) \
	$(CDEF_total_pkts) \
	$(DEF_http_src_out_pkts) \
	$(DEF_http_src_in_pkts) \
	$(CDEF_http_src_pkts) \
	$(DEF_http_dst_out_pkts) \
	$(DEF_http_dst_in_pkts) \
	$(CDEF_http_dst_pkts) \
	$(DEF_ftp_data_src_out_pkts) \
	$(DEF_ftp_data_src_in_pkts) \
	$(CDEF_ftp_data_src_pkts) \
	$(DEF_ftp_data_dst_out_pkts) \
	$(DEF_ftp_data_dst_in_pkts) \
	$(CDEF_ftp_data_dst_pkts) \
	$(DEF_ftpPASV_src_out_pkts) \
	$(DEF_ftpPASV_src_in_pkts) \
	$(CDEF_ftpPASV_src_pkts) \
	$(DEF_ftpPASV_dst_out_pkts) \
	$(DEF_ftpPASV_dst_in_pkts) \
	$(CDEF_ftpPASV_dst_pkts) \
	$(CDEF_ftpDATA_src_pkts) \
	$(CDEF_ftpDATA_dst_pkts) \
	$(DEF_nntp_src_out_pkts) \
	$(DEF_nntp_src_in_pkts) \
	$(CDEF_nntp_src_pkts) \
	$(DEF_nntp_dst_out_pkts) \
	$(DEF_nntp_dst_in_pkts) \
	$(CDEF_nntp_dst_pkts) \
	$(DEF_smtp_src_out_pkts) \
	$(DEF_smtp_src_in_pkts) \
	$(CDEF_smtp_src_pkts) \
	$(DEF_smtp_dst_out_pkts) \
	$(DEF_smtp_dst_in_pkts) \
	$(CDEF_smtp_dst_pkts) \
	$(DEF_7070_src_out_pkts) \
	$(DEF_7070_src_in_pkts) \
	$(CDEF_7070_src_pkts) \
	$(DEF_7070_dst_out_pkts) \
	$(DEF_7070_dst_in_pkts) \
	$(CDEF_7070_dst_pkts) \
	$(DEF_554_src_out_pkts) \
	$(DEF_554_src_in_pkts) \
	$(CDEF_554_src_pkts) \
	$(DEF_554_dst_out_pkts) \
	$(DEF_554_dst_in_pkts) \
	$(CDEF_554_dst_pkts) \
	$(DEF_real_out_pkts) \
	$(DEF_real_in_pkts) \
	$(CDEF_REAL_pkts) \
	$(DEF_napster_out_pkts) \
	$(DEF_napster_in_pkts) \
	$(CDEF_napster_pkts) \
	$(DEF_icmp_out_pkts) \
	$(DEF_icmp_in_pkts) \
	$(CDEF_icmp_pkts) \
	$(DEF_MCAST_in_pkts) \
	$(DEF_MCAST_out_pkts) \
	$(CDEF_MCAST_pkts) \
	$(CDEF_TOTAL_pkts) \
	AREA:napster_pkts#880088:'Napster* I/O' \
	STACK:http_src_pkts#ff0000:'HTTP src I/O' \
	STACK:http_dst_pkts#880000:'HTTP dst I/O' \
	STACK:ftpDATA_src_pkts#00ff00:'FTP DATA src I/O' \
	STACK:ftpDATA_dst_pkts#008800:'FTP DATA dst I/O' \
	STACK:nntp_src_pkts#0000ff:'NNTP src I/O' \
	STACK:nntp_dst_pkts#000088:'NNTP dst I/O' \
	STACK:REAL_pkts#00ffff:'RealServer I/O' \
	STACK:smtp_src_pkts#888888:'SMTP src I/O' \
	STACK:smtp_dst_pkts#000000:'SMTP dst I/O' \
	STACK:icmp_pkts#ff8888:'ICMP' \
	STACK:MCAST_in_pkts#aaaa00:'MCAST in' \
	STACK:MCAST_out_pkts#555500:'MCAST out' \
	LINE1:TOTAL_pkts#880088:'TOTAL I/O'

io_services_pkts$(tag).$(filetype): ftp-data_dst.rrd ftp-data_src.rrd ftp_dst.rrd ftp_src.rrd http_dst.rrd http_src.rrd nntp_dst.rrd nntp_src.rrd smtp_dst.rrd smtp_src.rrd total.rrd 554_src.rrd 554_dst.rrd 7070_src.rrd 7070_dst.rrd RealAudio.rrd icmp.rrd MCAST.rrd NapUser.rrd $(events)
	$(event2vrule) -h $(hours) $(events) $(rrdtool) graph \
	$@ \
	--interlaced \
	--imgformat $(IMGFORMAT) \
	-v 'packets per second' \
	-t '$(organization) Well Known Services Packets, +out/-in' \
	-s $(past_hours) \
	--width $(width) \
	--height $(ioheight) \
	--alt-autoscale \
	$(DEF_total_out_pkts) \
	$(DEF_total_in_pkts) \
	CDEF:total_in_pkts_neg=total_in_pkts,-1,* \
	$(CDEF_total_pkts) \
	$(DEF_http_src_out_pkts) \
	$(DEF_http_src_in_pkts) \
	CDEF:http_src_in_pkts_neg=http_src_in_pkts,-1,* \
	$(CDEF_http_src_pkts) \
	$(DEF_http_dst_out_pkts) \
	$(DEF_http_dst_in_pkts) \
	CDEF:http_dst_in_pkts_neg=http_dst_in_pkts,-1,* \
	$(CDEF_http_dst_pkts) \
	$(DEF_ftp_data_src_out_pkts) \
	$(DEF_ftp_data_src_in_pkts) \
	CDEF:ftp_data_src_in_pkts_neg=ftp_data_src_in_pkts,-1,* \
	$(CDEF_ftp_data_src_pkts) \
	$(DEF_ftp_data_dst_out_pkts) \
	$(DEF_ftp_data_dst_in_pkts) \
	CDEF:ftp_data_dst_in_pkts_neg=ftp_data_dst_in_pkts,-1,* \
	$(CDEF_ftp_data_dst_pkts) \
	$(DEF_ftpPASV_src_out_pkts) \
	$(DEF_ftpPASV_src_in_pkts) \
	CDEF:ftpPASV_src_in_pkts_neg=ftpPASV_src_in_pkts,-1,* \
	$(CDEF_ftpPASV_src_pkts) \
	$(DEF_ftpPASV_dst_out_pkts) \
	$(DEF_ftpPASV_dst_in_pkts) \
	CDEF:ftpPASV_dst_in_pkts_neg=ftpPASV_dst_in_pkts,-1,* \
	$(CDEF_ftpPASV_dst_pkts) \
	$(CDEF_ftpDATA_src_pkts) \
	$(CDEF_ftpDATA_dst_pkts) \
	CDEF:ftpDATA_dst_out_pkts=ftp_data_dst_out_pkts,ftpPASV_dst_out_pkts,+ \
	CDEF:ftpDATA_src_out_pkts=ftp_data_src_out_pkts,ftpPASV_src_out_pkts,+ \
	CDEF:ftpDATA_dst_in_pkts=ftp_data_dst_in_pkts,ftpPASV_dst_in_pkts,+ \
	CDEF:ftpDATA_dst_in_pkts_neg=ftpDATA_dst_in_pkts,-1,* \
	CDEF:ftpDATA_src_in_pkts=ftp_data_src_in_pkts,ftpPASV_src_in_pkts,+ \
	CDEF:ftpDATA_src_in_pkts_neg=ftpDATA_src_in_pkts,-1,* \
	$(DEF_nntp_src_out_pkts) \
	$(DEF_nntp_src_in_pkts) \
	CDEF:nntp_src_in_pkts_neg=nntp_src_in_pkts,-1,* \
	$(CDEF_nntp_src_pkts) \
	$(DEF_nntp_dst_out_pkts) \
	$(DEF_nntp_dst_in_pkts) \
	CDEF:nntp_dst_in_pkts_neg=nntp_dst_in_pkts,-1,* \
	$(CDEF_nntp_dst_pkts) \
	$(DEF_smtp_src_out_pkts) \
	$(DEF_smtp_src_in_pkts) \
	CDEF:smtp_src_in_pkts_neg=smtp_src_in_pkts,-1,* \
	$(CDEF_smtp_src_pkts) \
	$(DEF_smtp_dst_out_pkts) \
	$(DEF_smtp_dst_in_pkts) \
	CDEF:smtp_dst_in_pkts_neg=smtp_dst_in_pkts,-1,* \
	$(CDEF_smtp_dst_pkts) \
	$(DEF_7070_src_out_pkts) \
	$(DEF_7070_src_in_pkts) \
	$(CDEF_7070_src_pkts) \
	$(DEF_7070_dst_out_pkts) \
	$(DEF_7070_dst_in_pkts) \
	$(CDEF_7070_dst_pkts) \
	$(DEF_554_src_out_pkts) \
	$(DEF_554_src_in_pkts) \
	$(CDEF_554_src_pkts) \
	$(DEF_554_dst_out_pkts) \
	$(DEF_554_dst_in_pkts) \
	$(CDEF_554_dst_pkts) \
	$(DEF_real_out_pkts) \
	$(DEF_real_in_pkts) \
	$(CDEF_REAL_in_pkts) \
	CDEF:REAL_in_pkts_neg=REAL_in_pkts,-1,* \
	$(CDEF_REAL_out_pkts) \
	$(CDEF_REAL_pkts) \
	$(DEF_napster_out_pkts) \
	$(DEF_napster_in_pkts) \
	CDEF:napster_in_pkts_neg=napster_in_pkts,-1,* \
	$(CDEF_napster_pkts) \
	$(DEF_icmp_out_pkts) \
	$(DEF_icmp_in_pkts) \
	CDEF:icmp_in_pkts_neg=icmp_in_pkts,-1,* \
	$(CDEF_icmp_pkts) \
	$(DEF_MCAST_in_pkts) \
	CDEF:MCAST_in_pkts_neg=MCAST_in_pkts,-1,* \
	$(DEF_MCAST_out_pkts) \
	$(CDEF_MCAST_pkts) \
	$(CDEF_TOTAL_in_pkts) \
	CDEF:TOTAL_in_pkts_neg=TOTAL_in_pkts,-1,* \
	$(CDEF_TOTAL_out_pkts) \
	$(CDEF_TOTAL_pkts) \
	AREA:napster_out_pkts#880088:'Napster*' \
	STACK:http_src_out_pkts#ff0000:'HTTP src' \
	STACK:http_dst_out_pkts#880000:'HTTP dst' \
	STACK:ftpDATA_src_out_pkts#00ff00:'FTP DATA src' \
	STACK:ftpDATA_dst_out_pkts#008800:'FTP DATA dst' \
	STACK:nntp_src_out_pkts#0000ff:'NNTP src' \
	STACK:nntp_dst_out_pkts#000088:'NNTP dst' \
	STACK:REAL_out_pkts#00ffff:'RealServer' \
	STACK:smtp_src_out_pkts#888888:'SMTP src' \
	STACK:smtp_dst_out_pkts#000000:'SMTP dst' \
	STACK:icmp_out_pkts#ff8888:'ICMP' \
	STACK:MCAST_out_pkts#aaaa00:'MCAST' \
	LINE1:TOTAL_out_pkts#880088:'TOTAL' \
	AREA:napster_in_pkts_neg#880088 \
	STACK:http_src_in_pkts_neg#ff0000 \
	STACK:http_dst_in_pkts_neg#880000 \
	STACK:ftpDATA_src_in_pkts_neg#00ff00 \
	STACK:ftpDATA_dst_in_pkts_neg#008800 \
	STACK:nntp_src_in_pkts_neg#0000ff \
	STACK:nntp_dst_in_pkts_neg#000088 \
	STACK:REAL_in_pkts_neg#00ffff \
	STACK:smtp_src_in_pkts_neg#888888 \
	STACK:smtp_dst_in_pkts_neg#000000 \
	STACK:icmp_in_pkts_neg#ff8888 \
	STACK:MCAST_in_pkts_neg#aaaa00 \
	LINE1:TOTAL_in_pkts_neg#880088 \
	HRULE:0#f5f5f5

# AS to AS stuff:
DEF_vBNS2WiscNet_bytes = DEF:vBNS2WiscNet_bytes=$(rrddir)/vBNS2WiscNet.rrd:bytes:AVERAGE
CDEF_vBNS2WiscNet_Mbps = CDEF:vBNS2WiscNet_Mbps=vBNS2WiscNet_bytes,.000008,*

DEF_WiscNet2vBNS_bytes = DEF:WiscNet2vBNS_bytes=$(rrddir)/WiscNet2vBNS.rrd:bytes:AVERAGE
CDEF_WiscNet2vBNS_Mbps = CDEF:WiscNet2vBNS_Mbps=WiscNet2vBNS_bytes,.000008,*

DEF_vBNS2Campus_bytes = DEF:vBNS2Campus_bytes=$(rrddir)/vBNS2Campus.rrd:bytes:AVERAGE
CDEF_vBNS2Campus_Mbps = CDEF:vBNS2Campus_Mbps=vBNS2Campus_bytes,.000008,*

DEF_Campus2vBNS_bytes = DEF:Campus2vBNS_bytes=$(rrddir)/Campus2vBNS.rrd:bytes:AVERAGE
CDEF_Campus2vBNS_Mbps = CDEF:Campus2vBNS_Mbps=Campus2vBNS_bytes,.000008,*

DEF_WiscNet2Campus_bytes = DEF:WiscNet2Campus_bytes=$(rrddir)/WiscNet2Campus.rrd:bytes:AVERAGE
CDEF_WiscNet2Campus_Mbps = CDEF:WiscNet2Campus_Mbps=WiscNet2Campus_bytes,.000008,*

DEF_Campus2WiscNet_bytes = DEF:Campus2WiscNet_bytes=$(rrddir)/Campus2WiscNet.rrd:bytes:AVERAGE
CDEF_Campus2WiscNet_Mbps = CDEF:Campus2WiscNet_Mbps=Campus2WiscNet_bytes,.000008,*

DEF_Campus2Campus_bytes = DEF:Campus2Campus_bytes=$(rrddir)/Campus2Campus.rrd:bytes:AVERAGE
CDEF_Campus2Campus_Mbps = CDEF:Campus2Campus_Mbps=Campus2Campus_bytes,.000008,*

DEF_Campus2Berbee_bytes = DEF:Campus2Berbee_bytes=$(rrddir)/Campus2Berbee.rrd:bytes:AVERAGE
CDEF_Campus2Berbee_Mbps = CDEF:Campus2Berbee_Mbps=Campus2Berbee_bytes,.000008,*

DEF_Berbee2Campus_bytes = DEF:Berbee2Campus_bytes=$(rrddir)/Berbee2Campus.rrd:bytes:AVERAGE
CDEF_Berbee2Campus_Mbps = CDEF:Berbee2Campus_Mbps=Berbee2Campus_bytes,.000008,*

DEF_Campus2Chorus_bytes = DEF:Campus2Chorus_bytes=$(rrddir)/Campus2Chorus.rrd:bytes:AVERAGE
CDEF_Campus2Chorus_Mbps = CDEF:Campus2Chorus_Mbps=Campus2Chorus_bytes,.000008,*

DEF_Chorus2Campus_bytes = DEF:Chorus2Campus_bytes=$(rrddir)/Chorus2Campus.rrd:bytes:AVERAGE
CDEF_Chorus2Campus_Mbps = CDEF:Chorus2Campus_Mbps=Chorus2Campus_bytes,.000008,*

DEF_Campus2TDS_bytes = DEF:Campus2TDS_bytes=$(rrddir)/Campus2TDS.rrd:bytes:AVERAGE
CDEF_Campus2TDS_Mbps = CDEF:Campus2TDS_Mbps=Campus2TDS_bytes,.000008,*

DEF_TDS2Campus_bytes = DEF:TDS2Campus_bytes=$(rrddir)/TDS2Campus.rrd:bytes:AVERAGE
CDEF_TDS2Campus_Mbps = CDEF:TDS2Campus_Mbps=TDS2Campus_bytes,.000008,*

DEF_Campus2ESnet_bytes = DEF:Campus2ESnet_bytes=$(rrddir)/Campus2ESnet.rrd:bytes:AVERAGE
CDEF_Campus2ESnet_Mbps = CDEF:Campus2ESnet_Mbps=Campus2ESnet_bytes,.000008,*

DEF_ESnet2Campus_bytes = DEF:ESnet2Campus_bytes=$(rrddir)/ESnet2Campus.rrd:bytes:AVERAGE
CDEF_ESnet2Campus_Mbps = CDEF:ESnet2Campus_Mbps=ESnet2Campus_bytes,.000008,*

as2as_Mbps$(tag).$(filetype): total.rrd Berbee2Campus.rrd Campus2Berbee.rrd Campus2Campus.rrd Campus2Chorus.rrd Campus2ESnet.rrd Campus2TDS.rrd Campus2WiscNet.rrd Campus2vBNS.rrd Chorus2Campus.rrd ESnet2Campus.rrd TDS2Campus.rrd WiscNet2Campus.rrd vBNS2Campus.rrd MCAST.rrd
	$(rrdtool) graph \
	$@ \
	--interlaced \
	--imgformat $(IMGFORMAT) \
	-v 'megabits per second' \
	-t '$(organization) AS to AS, Mb/s' \
	-s $(past_hours) \
	--width $(width) \
	--height $(height) \
	$(DEF_total_out_bytes) \
	$(DEF_total_in_bytes) \
	$(CDEF_total_bytes) \
	$(CDEF_total_Mbps) \
	$(DEF_vBNS2WiscNet_bytes) \
	$(CDEF_vBNS2WiscNet_Mbps) \
	$(DEF_WiscNet2vBNS_bytes) \
	$(CDEF_WiscNet2vBNS_Mbps) \
	$(DEF_WiscNet2Campus_bytes) \
	$(CDEF_WiscNet2Campus_Mbps) \
	$(DEF_Campus2WiscNet_bytes) \
	$(CDEF_Campus2WiscNet_Mbps) \
	$(DEF_vBNS2Campus_bytes) \
	$(CDEF_vBNS2Campus_Mbps) \
	$(DEF_Campus2vBNS_bytes) \
	$(CDEF_Campus2vBNS_Mbps) \
	$(DEF_Campus2Campus_bytes) \
	$(CDEF_Campus2Campus_Mbps) \
	$(DEF_Campus2Berbee_bytes) \
	$(CDEF_Campus2Berbee_Mbps) \
	$(DEF_Berbee2Campus_bytes) \
	$(CDEF_Berbee2Campus_Mbps) \
	$(DEF_Campus2Chorus_bytes) \
	$(CDEF_Campus2Chorus_Mbps) \
	$(DEF_Chorus2Campus_bytes) \
	$(CDEF_Chorus2Campus_Mbps) \
	$(DEF_Campus2TDS_bytes) \
	$(CDEF_Campus2TDS_Mbps) \
	$(DEF_TDS2Campus_bytes) \
	$(CDEF_TDS2Campus_Mbps) \
	$(DEF_Campus2ESnet_bytes) \
	$(CDEF_Campus2ESnet_Mbps) \
	$(DEF_ESnet2Campus_bytes) \
	$(CDEF_ESnet2Campus_Mbps) \
	$(DEF_MCAST_in_bytes) \
	$(DEF_MCAST_out_bytes) \
	$(CDEF_MCAST_in_Mbps) \
	$(CDEF_MCAST_out_Mbps) \
	$(CDEF_MCAST_Mbps) \
	$(CDEF_TOTAL_Mbps) \
	'CDEF:mcast_pct=MCAST_Mbps,TOTAL_Mbps,/,100,*' \
	'CDEF:WiscNet_pct=WiscNet2Campus_Mbps,Campus2WiscNet_Mbps,+,TOTAL_Mbps,/,100,*' \
	'CDEF:vBNS_pct=vBNS2Campus_Mbps,Campus2vBNS_Mbps,+,MCAST_Mbps,+,TOTAL_Mbps,/,100,*' \
	'CDEF:Berbee_pct=Berbee2Campus_Mbps,Campus2Berbee_Mbps,+,TOTAL_Mbps,/,100,*' \
	'CDEF:Chorus_pct=Chorus2Campus_Mbps,Campus2Chorus_Mbps,+,TOTAL_Mbps,/,100,*' \
	'CDEF:TDS_pct=TDS2Campus_Mbps,Campus2TDS_Mbps,+,TOTAL_Mbps,/,100,*' \
	'CDEF:ESnet_pct=ESnet2Campus_Mbps,Campus2ESnet_Mbps,+,TOTAL_Mbps,/,100,*' \
	AREA:MCAST_Mbps#aaaa00:'MCAST I/O' \
	STACK:Campus2WiscNet_Mbps#00ff00:'Campus to WiscNet' \
	STACK:WiscNet2Campus_Mbps#008800:'WiscNet to Campus' \
	STACK:Campus2vBNS_Mbps#0000ff:'Campus to vBNS' \
	STACK:vBNS2Campus_Mbps#000088:'vBNS to Campus' \
	STACK:Campus2ESnet_Mbps#00ffff:'Campus to ESnet' \
	STACK:ESnet2Campus_Mbps#008888:'ESnet to Campus' \
	STACK:Campus2Chorus_Mbps#ff00ff:'Campus to Chorus' \
	STACK:Chorus2Campus_Mbps#880088:'Chorus to Campus' \
	STACK:Campus2TDS_Mbps#ffa500:'Campus to TDS' \
	STACK:TDS2Campus_Mbps#885200:'TDS to Campus' \
	STACK:Campus2Berbee_Mbps#ff7f50:'Campus to Berbee' \
	STACK:Berbee2Campus_Mbps#884225:'Berbee to Campus' \
	LINE1:TOTAL_Mbps#ff0000:'TOTAL Inter-AS & MCAST' \
	STACK:Campus2Campus_Mbps#880000:'Intra-Campus (at the peering point, in addition to Inter-AS)' \
	COMMENT:'\n' \
	COMMENT:'\n' \
	GPRINT:WiscNet_pct:AVERAGE:'WiscNet %.1lf%%' \
	GPRINT:vBNS_pct:AVERAGE:'vBNS+MCAST %.1lf%%' \
	GPRINT:ESnet_pct:AVERAGE:'ESnet %.1lf%%' \
	GPRINT:Chorus_pct:AVERAGE:'Chorus %.1lf%%' \
	GPRINT:TDS_pct:AVERAGE:'TDS %.1lf%%' \
	GPRINT:Berbee_pct:AVERAGE:'Berbee %.1lf%%'

.SUFFIXES: .rrd .xml

.rrd.xml:
	$(rrdtool) dump $< > $@ || rm -f $@
