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

Also available in: Atom PDF