# Layout to show pf usage

group	name="introduction";
text	"<div>
	The following graphs show:
	<ul><li>the number of pf states and the changes on this total. </li>
	    <li>pf states searches versus the number of packets routed in and out on the interfaces of my firewall.</li>
	    <li>the total bytes in/out as counted by pf per day. </li>
	</ul>
	</div>";
group	name="pf", pf_rrd=/symon/rrds/www/pf.rrd,
		   xl0_rrd=/symon/rrds/www/if_xl0.rrd,
		   dc0_rrd=/symon/rrds/www/if_dc0.rrd,
		   lo0_rrd=/symon/rrds/www/if_lo0.rrd;

# State addition and removals graph
graph	template='-v states
-w %width%
-h %heigth%
-s %start%
-e %end%
-t state stats
DEF:s=%pf_rrd%:states_entries:AVERAGE
DEF:si=%pf_rrd%:states_inserts:AVERAGE
DEF:sr=%pf_rrd%:states_removals:AVERAGE
DEF:ss=%pf_rrd%:states_searches:AVERAGE
CDEF:msr=-1,sr,*
COMMENT:                      min     avg     max     last\n
AREA:s#00FF00:entries         
GPRINT:s:MIN:%6.2lf
GPRINT:s:AVERAGE:%6.2lf
GPRINT:s:MAX:%6.2lf
GPRINT:s:LAST:%6.2lf\n
LINE1:msr#FF0000:removals        
GPRINT:sr:MIN:%6.2lf
GPRINT:sr:AVERAGE:%6.2lf
GPRINT:sr:MAX:%6.2lf
GPRINT:sr:LAST:%6.2lf\n
LINE1:si#0000FF:inserts         
GPRINT:si:MIN:%6.2lf
GPRINT:si:AVERAGE:%6.2lf
GPRINT:si:MAX:%6.2lf
GPRINT:si:LAST:%6.2lf\n
LINE2:ss#00FFFF:state searches 
GPRINT:ss:MIN: %6.2lf
GPRINT:ss:AVERAGE:%6.2lf
GPRINT:ss:MAX:%6.2lf
GPRINT:ss:LAST:%6.2lf\n
';
# State searches + how many packets from which interfaces
graph template='-v states
-w %width%
-h %heigth%
-s %start%
-e %end%
-t state searches vs packets
DEF:ss=%pf_rrd%:states_searches:AVERAGE
DEF:ipxl0=%xl0_rrd%:ipackets:AVERAGE
DEF:iplo0=%lo0_rrd%:ipackets:AVERAGE
DEF:ipdc0=%dc0_rrd%:ipackets:AVERAGE
DEF:opxl0=%xl0_rrd%:opackets:AVERAGE
DEF:oplo0=%lo0_rrd%:opackets:AVERAGE
DEF:opdc0=%dc0_rrd%:opackets:AVERAGE
COMMENT:packets via           min     avg     max     last\n
AREA:ipxl0#98449E:xl0 in         
GPRINT:ipxl0:MIN: %6.2lf
GPRINT:ipxl0:AVERAGE:%6.2lf
GPRINT:ipxl0:MAX:%6.2lf
GPRINT:ipxl0:LAST:%6.2lf\n
STACK:opxl0#CC449E:xl0 out        
GPRINT:opxl0:MIN: %6.2lf
GPRINT:opxl0:AVERAGE:%6.2lf
GPRINT:opxl0:MAX:%6.2lf
GPRINT:opxl0:LAST:%6.2lf\n
STACK:ipdc0#80C2B6:dc0 in         
GPRINT:ipdc0:MIN: %6.2lf
GPRINT:ipdc0:AVERAGE:%6.2lf
GPRINT:ipdc0:MAX:%6.2lf
GPRINT:ipdc0:LAST:%6.2lf\n
STACK:opdc0#66C2B6:dc0 out        
GPRINT:opdc0:MIN: %6.2lf
GPRINT:opdc0:AVERAGE:%6.2lf
GPRINT:opdc0:MAX:%6.2lf
GPRINT:opdc0:LAST:%6.2lf\n
STACK:iplo0#688CC0:lo0 in         
GPRINT:iplo0:MIN: %6.2lf
GPRINT:iplo0:AVERAGE:%6.2lf
GPRINT:iplo0:MAX:%6.2lf
GPRINT:iplo0:LAST:%6.2lf\n
STACK:oplo0#338CCC:lo0 out        
GPRINT:oplo0:MIN: %6.2lf
GPRINT:oplo0:AVERAGE:%6.2lf
GPRINT:oplo0:MAX:%6.2lf
GPRINT:oplo0:LAST:%6.2lf\n
LINE2:ss#00FFFF:state searches 
GPRINT:ss:MIN: %6.2lf
GPRINT:ss:AVERAGE:%6.2lf
GPRINT:ss:MAX:%6.2lf
GPRINT:ss:LAST:%6.2lf\n
';

graph template='-v data transfer per day
-w %width%
-h %heigth%
-s %start%
-e %end%
-t Data transfer
-U 1440
--no-minor
-S 86400
DEF:in_base=%pf_rrd%:bytes_v4_in:AVERAGE
DEF:out_base=%pf_rrd%:bytes_v4_out:AVERAGE
CDEF:in=86400,in_base,*
CDEF:nin=0,in,-
CDEF:out=86400,out_base,*
COMMENT:bytes per day         min        avg        max       last\n
AREA:out#ff0000:out            
GPRINT:out:MIN:%6.2lf %sb
GPRINT:out:AVERAGE:%6.2lf %sb
GPRINT:out:MAX:%6.2lf %sb
GPRINT:out:LAST:%6.2lf %sb\n
AREA:nin#00ff00:in             
GPRINT:in:MIN:%6.2lf %sb
GPRINT:in:AVERAGE:%6.2lf %sb
GPRINT:in:MAX:%6.2lf %sb
GPRINT:in:LAST:%6.2lf %sb\n
';
