Project

General

Profile

Actions

Feature #12658

closed

Adding prometheus metrics to darkstat

Added by Karim Elatov about 2 years ago. Updated about 1 month ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
darkstat
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Plus Target Version:

Description

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:

https://unix4lyfe.org/gitweb/darkstat/commit/e7e6652113099e33930ab0f39630bf280e38f769

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 https://www.unix4lyfe.org/git/darkstat
> 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 192.168.56.1 -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="0.0.0.0",mac="cc:4e:24:XX:XX:XX",dir="in"} 0
host_bytes_total{interface="re0",ip="0.0.0.0",mac="cc:4e:24:XX:XX:XX",dir="out"} 114
host_bytes_total{interface="re0",ip="162.142.125.75",mac="cc:4e:24:XX:XX:XX",dir="in"} 0
host_bytes_total{interface="re0",ip="162.142.125.75",mac="cc:4e:24:XX:XX:XX",dir="out"} 44
host_bytes_total{interface="re0",ip="79.7.143.146",mac="cc:4e:24:XX:XX:XX",dir="in"} 86
host_bytes_total{interface="re0",ip="79.7.143.146",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 2 years 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 2 years ago

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

https://docs.freebsd.org/en/books/porters-handbook/upgrading/

Thanks,
-Karim

Actions #4

Updated by Karim Elatov about 2 years ago

It looks like a commit had been made to the main branch: https://cgit.freebsd.org/ports/commit/?id=038bcb21cbd11930ab3317a137ec012c3ff3f6f4 . 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 2 years ago

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

https://freebsd.pkgs.org/13/freebsd-amd64/darkstat-3.0.721.pkg.html

The direct download is from:

https://pkg.freebsd.org/FreeBSD:13:amd64/latest/All/darkstat-3.0.721.pkg

Does this help with our efforts?

Thanks,
-Karim

Actions #6

Updated by Karim Elatov almost 2 years ago

I think the package is in the FreeBSD ports:

> pkg -vv | tail

Repositories:
  FreeBSD: {
    url             : "pkg+http://pkg.FreeBSD.org/FreeBSD:12:amd64/quarterly",
    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.

Thanks,
-Karim

Actions #7

Updated by Karim Elatov over 1 year ago

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

Thank you.

Actions #8

Updated by Karim Elatov about 1 month ago

I think we can close this out:

[2.7.2-RELEASE][root@pf.kar.int]/root: cat /etc/version
2.7.2-RELEASE
[2.7.2-RELEASE][root@pf.kar.int]/root: pkg search darkstat
darkstat-3.0.721               Network statistics gatherer and reporter
pfSense-pkg-darkstat-3.1.3_6   pfSense package darkstat

Thank you.

Actions #9

Updated by Jim Pingle about 1 month ago

  • Status changed from New to Closed
Actions

Also available in: Atom PDF