Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

basic PF prometheus metrics (packets, bytes, banned ip count) #349

Merged
merged 6 commits into from
Jan 19, 2024
Merged

Conversation

mmetc
Copy link
Contributor

@mmetc mmetc commented Jan 5, 2024

No description provided.

@mmetc mmetc force-pushed the pf-metrics branch 3 times, most recently from 17a18b7 to bb99a7d Compare January 8, 2024 13:43
@mmetc mmetc marked this pull request as ready for review January 8, 2024 13:52
@mmetc mmetc changed the title pf metrics basic PF prometheus metrics (packets, bytes, banned ip count) Jan 8, 2024
@mmetc mmetc requested a review from sabban January 8, 2024 14:24
@mmetc mmetc added this to the 0.0.29 milestone Jan 8, 2024
@nferch
Copy link
Contributor

nferch commented Jan 9, 2024

I can confirm this works on my box with the following change. My tables are named crowdsec-blacklists and crowdsec6-blacklists.

--- a/pkg/pf/metrics.go
+++ b/pkg/pf/metrics.go
@@ -19,7 +19,7 @@ type counter struct {
 }

 var (
-       rexpTable   = regexp.MustCompile(`^block .* from <(?P<table>\w+)> .*"$`)
+       rexpTable   = regexp.MustCompile(`^block .* from <(?P<table>[^ ]+)>`)
        rexpMetrics = regexp.MustCompile(`^\s+\[.*Packets: (?P<packets>\d+)\s+Bytes: (?P<bytes>\d+).*\]$`)
 )

@mmetc
Copy link
Contributor Author

mmetc commented Jan 9, 2024

Oh yes, I forgot outside pfsense we use the dash character. Ok. Thanks for testing!

Copy link
Contributor

@sabban sabban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mmetc mmetc merged commit eb7094b into main Jan 19, 2024
4 checks passed
@mmetc mmetc deleted the pf-metrics branch January 19, 2024 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants