27 April 2010

pfstat on OpenBSD

pfstat is a small utility that collects packet
filter statistics and produces graphs.


First, start the apache server:

* step 1 - Location of Apache configuration file
* step 2 - Starting httpd
* step 3 - Having httpd run at startup

1. Apache conf file /var/www/conf/httpd.conf file.

2. Starting the http daemon
~# apachectl start

A good rule of thumb is not to edit your /etc/rc.conf file.
Instead create then edit a file called /etc/rc.conf.local.
Settings specified in rc.conf.local will take precedence
over settings in the /etc/rc.conf file.

3. Edit your /etc/rc.conf.local file adding this entry
~# echo 'httpd_flags="" ' >> /etc/rc.conf.local

Install pfstat:


~# cd /usr/ports/net/pfstat
~# make install clean
~# mkdir /var/www/htdocs/pfstat

Get a pfstat.conf for example:

[*] http://www.benzedrine.cx/pfstat.conf
[*] https://calomel.org/downloads/pfstat.conf-calomel.org

~# mv /etc/pfstat.conf  /root/pfstat.conf.default
~# cp new-pfstat.conf /etc/pfstat.conf

Edit Your new pfstat.conf !!

Executing pfstat

~# pftstat -q

And put this on crontab:

#minute (0-59)
#|   hour (0-23)
#|   |    day of the month (1-31)
#|   |    |   month of the year (1-12)
#|   |    |   |   day of the week (0-6 with 0=Sun)
#|   |    |   |   |   commands
#|   |    |   |   |   |
#### Generate pfstat graphs
*    *    *   *   *   /usr/local/bin/pfstat -q -d /var/db/pfstat.db
10   6-19 *   *   *   /usr/local/bin/pfstat -p -d /var/db/pfstat.db
25   3    *   *   *   /usr/local/bin/pfstat -t 30 -d /var/db/pfstat.db
See Also:

man 8 pfstat
[1]
[2]


biOos

No comments: