bandwhich icon indicating copy to clipboard operation
bandwhich copied to clipboard

Can you create a Prometheus exporter so I can write data to the Prometheus database?

Open kof8855 opened this issue 9 months ago • 3 comments

I mainly want to use Grafana to track the incoming and outgoing traffic for each IP address.

kof8855 avatar Jul 03 '25 07:07 kof8855

TBH I got neither the prerequisite experience with Prometheus nor the abundance of time. So unfortunately I think you'll have to DIY, but I would welcome PRs.

cyqsimon avatar Jul 03 '25 07:07 cyqsimon

The easiest way to do it yourself is to parse bandwhich --raw output, ideally it would output json or something but the current format is not that bad either, and then map that to Grafana

sigmaSd avatar Jul 03 '25 12:07 sigmaSd

TBH I got neither the prerequisite experience with Prometheus nor the abundance of time. So unfortunately I think you'll have to DIY, but I would welcome PRs.

I have completed the secondary development of bandwhich, implementing a Prometheus exporter-like functionality.

The command execution remains unchanged when no parameters are provided, preserving the original features. By adding the --enable-metrics flag, Prometheus exporter support is activated, and the --metrics-port option allows specifying a custom port (default set to 9200).

Example:

./bandwhich --enable-metrics --metrics-port 9300

Finally, Grafana connects to the Prometheus database for visualization.

Image

Image

Image

kof8855 avatar Jul 04 '25 07:07 kof8855