綠色小羊: OpenBSD 4.2安裝pfstat
RSS

OpenBSD 4.2安裝pfstat

因為OpenBSD 4.2把一些安裝pfstat所需要的工具放在xbase42中,而我們在安裝openbsd時又因沒使用到圖形界面,所以安裝pfstat時會遇到此困難.....

首先安裝xbase42.tgz --參考FAQ 4.10 - Adding a file set after install
cd /
tar xzvphf xbase42.taz
再來
ldconfig -m /usr/X11R6/lib

安裝gd-2.0.35.tgz
pkg_add -v gd-2.0.35.tgz

安裝pfstat-2.2p0.tgz
pkg_add -v pfstat-2.2p0.tgz

crontab -e 增加二個工作
#pfstat
* * * * * /usr/local/bin/pfstat -q
*/5 * * * * /usr/local/bin/pfstat -p
0 1 * * 0 /usr/local/bin/pfstat -t 7:31


設定httpd服務
cd /var/www/htdocs/ 新增一個pfstat資料夾
mkdir pfstat
cd /pfstat
自行新增一個網頁index.html,用html編寫,將圖形顯示出來
vi index.html



修改/etc/pfstat.conf
# $Id: pfstat.conf.example,v 1.2 2006/05/17 13:50:44 dhartmei Exp $
#
# /etc/pfstat.conf example
#

# collect
# global
# states entriessearchesinsertsremovals [diff]
# counters matchbad-offsetfragment...synproxy [diff]
# (see pfctl -si output, same strings)
# interface name passblock packetsbytes inout v4v6 [diff]
# queue name passeddroppedother packetsbytesnumber [diff]

collect 1 = interface "em0" pass bytes in ipv4 diff
collect 2 = interface "em0" pass bytes out ipv4 diff
collect 3 = global states entries

image "/var/www/htdocs/pfstat/pfstat.jpg" {
from 1 days to now
width 980 height 300
left
graph 1 bps "in" "bits/s" color 0 192 0 filled,
graph 2 bps "out" "bits/s" color 0 0 255
right
graph 3 "states" "entries" color 192 192 0
}

collect 4 = interface "em0" pass packets in ipv4 diff
collect 5 = interface "em0" pass packets out ipv4 diff
collect 6 = interface "em0" block packets in ipv4 diff
collect 7 = interface "em0" block packets out ipv4 diff

image "/var/www/htdocs/pfstat/pfstat-packets.jpg" {
from 1 days to now
width 980 height 300
left
graph 4 "pass in" "packets/s" color 0 192 0 filled,
graph 5 "pass out" "packets/s" color 0 0 255
right
graph 6 "block in" "packets/s" color 255 0 0,
graph 7 "block out" "packets/s" color 192 192 0
}

collect 8 = global states inserts diff
collect 9 = global states removals diff
collect 10 = global states searches diff

image "/var/www/htdocs/pfstat/pfstat-states.jpg" {
from 1 days to now
width 980 height 300
left
graph 8 "inserts" "states/s" color 0 192 0 filled,
graph 9 "removals" "states/s" color 0 0 255
right
graph 10 "searches" "states/s" color 255 0 0
}

collect 11 = queue "q_max" pass bytes diff
collect 12 = queue "q_hig" pass bytes diff
collect 13 = queue "q_def" pass bytes diff
collect 14 = queue "q_low" pass bytes diff

image "/var/www/htdocs/pfstat/pfstat-queues.jpg" {
from 1 days to now
width 980 height 300
left
graph 11 bps "max" "bits/s" color 255 0 0,
graph 12 bps "hig" "bits/s" color 192 192 0,
graph 13 bps "def" "bits/s" color 0 192 0,
graph 14 bps "low" "bits/s" color 0 0 255
}

collect 15 = global counters match diff
collect 16 = global counters bad-offset diff
collect 17 = global counters fragment diff
collect 18 = global counters short diff
collect 19 = global counters normalize diff
collect 20 = global counters memory diff
collect 21 = global counters bad-timestamp diff
collect 22 = global counters congestion diff
collect 23 = global counters ip-option diff
collect 24 = global counters proto-cksum diff
collect 25 = global counters state-mismatch diff
collect 26 = global counters state-insert diff
collect 27 = global counters state-limit diff
collect 28 = global counters src-limit diff
collect 29 = global counters synproxy diff

image "/var/www/htdocs/pfstat/pfstat-errors.jpg" {
from 1 days to now
width 980 height 300
left
graph 17 "frag" "/s" color 192 0 192,
graph 22 "cong" "/s" color 0 192 192,
graph 23 "iopt" "/s" color 0 0 255,
graph 24 "csum" "/s" color 192 192 0,
graph 25 "mism" "/s" color 255 0 0
# others are usually all zero here
right
graph 15 "match" "/s" color 0 192 0
}

這樣排程時間到時會在/var/www/htdocs/pfstat/中產生檔案如pfstat-packets.jpg pfstat-states.jpg pfstat/errors.jpg

啟動apache
apachectl start

打開網頁http://www.xxxx.com/pfstat/index.html
就可以看到pfstat的圖形了
---
---
---

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

0 意見: