pfstats/README.md

130 lines
2.5 KiB
Markdown
Raw Permalink Normal View History

2021-07-27 21:12:35 +00:00
# pfstats
2021-07-27 21:46:13 +00:00
## Description
dataviz projet to view the images created by [pfstat](https://www.benzedrine.ch/pfstat.html) project.
*BSD Licensed 2-Clause*
2021-07-27 21:46:13 +00:00
⇒ pfstat.conf: personnal config files for IPv4, IPv6 (no Queue), for pfstat
2021-07-27 23:38:44 +00:00
- network interface: **em0**
- directory web: `/var/www/htdocs/pfstat`
2021-07-27 21:46:13 +00:00
⇒ pfstat.html: Responsive web page for project pfstat
2021-07-27 21:47:26 +00:00
- CSS: pure-min.css, styles.css
- JS: ui.js — short JS to manipulate UI correctly.
- based on PureCSS Framework
2021-07-27 21:46:13 +00:00
⇒ convert-img.sh: script sh to convert JPEG image to Webp and Avif format
2021-07-27 21:50:52 +00:00
*(tested on pdksh, on OpenBSD 6.9)*
2021-07-27 21:46:13 +00:00
---
## 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
2021-07-27 23:38:44 +00:00
### PF
⇒ modify your `/etc/pf.conf` to add:
```
set loginterface em0
```
Restart your PF:
```
# pfctl -nf /etc/pf.conf && pfctl -f /etc/pf.conf
```
2021-07-27 21:46:13 +00:00
### 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
2021-07-27 23:40:45 +00:00
⇒ copy files html and needed css, js on the httpd directory.
2021-07-27 21:46:13 +00:00
* Yearly views:
It's possible to obtain and see yearly views. Uncomment blocks view on
2021-07-29 17:49:44 +00:00
both pfstat* files; this need to change too the crontab time to delete —
*(the third line).*
2021-07-27 21:46:13 +00:00
### crontab
```
### pfstat
* * * * * /usr/local/bin/pfstat -q -d /var/db/pfstat/pfstat.db
2021-07-29 17:49:44 +00:00
*/15 * * * * /usr/local/bin/pfstat -p -d /var/db/pfstat/pfstat.db; /dir/convert-img.sh ; chown -R www /var/www/htdocs/pfstat
2021-07-27 21:46:13 +00:00
30 0 * * * /usr/local/bin/pfstat -t 30 -d /var/db/pfstat/pfstat.db
```
Think to mkdir:
`# mkdir -p /var/db/pfstat/`
2021-07-27 21:46:13 +00:00
### convert-img.sh
1. chmod 0700
---
## Screenshot
2021-07-29 17:37:59 +00:00
![Screenshot about the PFstats page](pfstats.html.png "PFstats : Datawiz Project to analyse pfstat views!")
## 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‽
2021-07-27 21:46:13 +00:00
---
2021-07-29 17:37:59 +00:00
***Enjoy-ID!*** <br>
2021-07-27 21:46:13 +00:00
***Enjoy-IT!***