Feature #12658


Adding prometheus metrics to darkstat

Added by Karim Elatov 5 months ago. Updated 3 months ago.

Target version:
Start date:
Due date:
% Done:


Estimated time:
Plus Target Version:


I wanted to get darkstat metrics in prometheus and it looks like a new commit (in 2017) has been created in the old darkstat repo:

I was able to compile the version from the master branch on a freebsd 12.2 machine and copying the binary worked as expected:

> sudo pkg install vim git autoconf
> git clone
> cd darkstat
> autoconf
> autoheader
> ./configure --prefix=/usr/local/darkstat
> make
> sudo mkdir /usr/local/darkstat
> sudo chown $USER /usr/local/darkstat
> make install
# copying to my pfsense machine
> scp /usr/local/darkstat/sbin/darkstat pfsense:
> ssh pfsense
> mv /usr/local/sbin/darkstat /usr/local/sbin/darkstat.orig
> mv darkstat /usr/local/sbin/.

Then starting service worked without issues:

[2.5.2-RELEASE][root@pfsense]/root: ps -auwwwx | grep dark
nobody  86380   0.1  0.1   14180   5384  -  Ss   14:22        0:02.40 /usr/local/sbin/darkstat -i re0 -b -p 9234
nobody  86644   0.0  0.1   12036   3100  -  Is   14:22        0:00.02 darkstat: DNS child (darkstat)

And I was able to get the metrics I wanted:

> curl http://pfsense:9234/metrics -s | head
# HELP host_bytes_total Total number of network bytes by host and direction.
# TYPE host_bytes_total counter
host_bytes_total{interface="re0",ip="",mac="cc:4e:24:XX:XX:XX",dir="in"} 0
host_bytes_total{interface="re0",ip="",mac="cc:4e:24:XX:XX:XX",dir="out"} 114
host_bytes_total{interface="re0",ip="",mac="cc:4e:24:XX:XX:XX",dir="in"} 0
host_bytes_total{interface="re0",ip="",mac="cc:4e:24:XX:XX:XX",dir="out"} 44
host_bytes_total{interface="re0",ip="",mac="cc:4e:24:XX:XX:XX",dir="in"} 86
host_bytes_total{interface="re0",ip="",mac="cc:4e:24:XX:XX:XX",dir="out"} 98

Can you please update the darkstat package on pfsense to include the new metrics feature?

Actions #1

Updated by Jim Pingle 5 months ago

If the FreeBSD port for Darkstat is out of date, the proper procedure is to ask the FreeBSD port maintainer to update the port. Once it's updated in FreeBSD, we can pull in the update from there.

Actions #2

Updated by Karim Elatov 5 months ago

Are you referring to following this process to submit a patch:


Actions #4

Updated by Karim Elatov 4 months ago

It looks like a commit had been made to the main branch: . I am not sure if you know this, but is there any sort of timeline from when the commit goes into freebsd ports to when it makes it way to pfsense ports? Sorry for the random questions, just kind of interested :)

Actions #5

Updated by Karim Elatov 3 months ago

I see that the package made it to FreeBSD version 13:

The direct download is from:

Does this help with our efforts?



Also available in: Atom PDF