pfstats/README.md

2.5 KiB

pfstats

Description

dataviz projet to view the images created by pfstat project.

BSD Licensed 2-Clause

⇒ pfstat.conf: personnal config files for IPv4, IPv6 (no Queue), for pfstat

  • network interface: em0
  • directory web: /var/www/htdocs/pfstat

⇒ pfstat.html: Responsive web page for project pfstat

  • CSS: pure-min.css, styles.css
  • JS: ui.js — short JS to manipulate UI correctly.
  • based on PureCSS Framework

⇒ convert-img.sh: script sh to convert JPEG image to Webp and Avif format (tested on pdksh, on OpenBSD 6.9)


Installation

  1. Install pfstat package: # pkg_add pfstat
  2. Copy pfstat.conf to /etc
  3. Set and active httpd
  4. Set crontab
  5. Install needed packages for convert-img.sh: # pkg_add libavif libwebp

Configuration

PF

⇒ modify your /etc/pf.conf to add:

set loginterface em0

Restart your PF:

# pfctl -nf /etc/pf.conf && pfctl -f /etc/pf.conf

httpd

⇒ create need directory to publish the pfstat images:

# mkdir -p /var/www/htdocs/pfstat/

⇒ create/copy httpd.conf file into /etc:

types {
    include "/usr/share/misc/mime.types"

    image/avif	avif
}

server "pfstat" {
	listen on 127.0.0.1 port 80
 
	location "/pfstat/" {
		directory auto index
		root "/htdocs/"
	}

}

⇒ check file config and start the daemon:

# httpd -n && rcctl start httpd

pfstat.(conf,html)

⇒ copy file config to /etc

⇒ copy files html and needed css, js on the httpd directory.

  • Yearly views:

It's possible to obtain and see yearly views. Uncomment blocks view on both pfstat* files; this need to change too the crontab time to delete — (the third line).

crontab

### pfstat
*  * * * * /usr/local/bin/pfstat -q -d /var/db/pfstat/pfstat.db
*/15 * * * * /usr/local/bin/pfstat -p -d /var/db/pfstat/pfstat.db; /dir/convert-img.sh ; chown -R www /var/www/htdocs/pfstat
30 0 * * * /usr/local/bin/pfstat -t 30 -d /var/db/pfstat/pfstat.db

Think to mkdir:

# mkdir -p /var/db/pfstat/

convert-img.sh

  1. chmod 0700

Screenshot

Screenshot about the PFstats page

Troubleshooting

ALTQ-style queues not supported anymore

It seems collectors on queues are not more supported. Comment or delete all relevent collectors and images lines.

dbopen: /var/db/pfstat/pfstat.db: No such file or directory

Have-you really created the needed directory‽


Enjoy-ID!
Enjoy-IT!