03.09.2013 Views

Implementation of data collection tools using NetFlow for statistical ...

Implementation of data collection tools using NetFlow for statistical ...

Implementation of data collection tools using NetFlow for statistical ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

8 Appendix<br />

which<br />

# contain the <strong>data</strong> we want to save. In this case, the<br />

# destination AS, source IP, destination IP, destination port,<br />

protocol<br />

# and the number <strong>of</strong> packets and bytes sent.<br />

# Close the open handles be<strong>for</strong>e exiting.<br />

cursor.close()<br />

db.close()<br />

# Print the execution time <strong>of</strong> the script.<br />

print ("%s: Execution time: %s seconds." % (script_exec_time,<br />

(time.clock() - startTime)))<br />

8.10 RRDTOOL-script (rrdtool.sh)<br />

/usr/bin/rrdtool graph $1.png \<br />

--img<strong>for</strong>mat=PNG \<br />

--start=-7200 \<br />

--end=-60 \<br />

--title='Pmacct Graph' \<br />

--rigid \<br />

--base=1000 \<br />

--height=120 \<br />

--width=500 \<br />

--alt-autoscale-max \<br />

--lower-limit=0 \<br />

--vertical-label='bits/s' \<br />

--slope-mode \<br />

--font TITLE:12: \<br />

--font AXIS:8: \<br />

--font LEGEND:8: \<br />

--font UNIT:8: \<br />

DEF:a="/var/www/mrtg/$1.rrd":ds0:AVERAGE \<br />

CDEF:cdefa=a,8,* \<br />

DEF:b="/var/www/mrtg/$1.rrd":ds1:AVERAGE \<br />

CDEF:cdefb=b,8,* \<br />

AREA:cdefa#0000ffff:"Out Traffic" \<br />

GPRINT:cdefa:LAST:"Current\:%8.2lf %s" \<br />

GPRINT:cdefa:AVERAGE:"Average\:%8.2lf %s" \<br />

GPRINT:cdefa:MAX:"Maximum\:%8.2lf %s\n" \<br />

AREA:cdefb#00ff0099:"In traffic" \<br />

58

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!