Feature #12658


Adding prometheus metrics to darkstat

Added by Karim Elatov about 1 year ago. Updated 8 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 about 1 year 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 about 1 year ago

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


Actions #4

Updated by Karim Elatov about 1 year 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 about 1 year ago

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

The direct download is from:

Does this help with our efforts?


Actions #6

Updated by Karim Elatov 10 months ago

I think the package is in the FreeBSD ports:

> pkg -vv | tail

  FreeBSD: {
    url             : "pkg+",
    enabled         : yes,
    priority        : 0,
    mirror_type     : "SRV",
    signature_type  : "FINGERPRINTS",
    fingerprints    : "/usr/share/keys/pkg" 

And here is the version available:

> sudo pkg search darkstat
darkstat-3.0.721               Network statistics gatherer and reporter

Please let me know if that's what we needed to progress.


Actions #7

Updated by Karim Elatov 8 months ago

Sorry to keep pestering about this, but I am wondering what else needs to be done to include this?

Thank you.


Also available in: Atom PDF