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

Mismatch Between Prometheus Metrics in Goflow2 and Grafana Dashboard #360

Closed
firasrasmy-thg opened this issue Dec 4, 2024 · 6 comments · Fixed by #361
Closed

Mismatch Between Prometheus Metrics in Goflow2 and Grafana Dashboard #360

firasrasmy-thg opened this issue Dec 4, 2024 · 6 comments · Fixed by #361
Assignees
Labels
bug Something isn't working compose Related to compose/pipeline stacks

Comments

@firasrasmy-thg
Copy link

The prometheus metrics exposed by goflow2 (as seen in the source code) do not match most of the target metrics in the Grafana dashboard at https://github.com/netsampler/goflow2/blob/main/compose/kcg/grafana/dashboards/perfs.json. This is in addition to the fact that target metrics in perfs.json lacks the prefix namespace (goflow2).

@firasrasmy-thg firasrasmy-thg added the bug Something isn't working label Dec 4, 2024
@lspgn
Copy link
Member

lspgn commented Dec 4, 2024

@firasrasmy-thg thank you for reporting, could you have a look at #361?

@lspgn lspgn self-assigned this Dec 4, 2024
@lspgn lspgn added the compose Related to compose/pipeline stacks label Dec 4, 2024
@firasrasmy-thg
Copy link
Author

@lspgn thank you for your prompt response. Based on this PR, it looks much better now:

Metrics exposed by goflow2:
goflow2_flow_dropped_packets_total
goflow2_flow_dropped_bytes_total
goflow2_flow_traffic_bytes_total
goflow2_flow_traffic_packets_total
goflow2_flow_traffic_size_bytes
goflow2_flow_decoder_error_total
goflow2_flow_decoding_time_seconds
goflow2_flow_process_nf_total
goflow2_flow_process_nf_errors_total
goflow2_flow_process_nf_flowset_records_total
goflow2_flow_process_nf_flowset_total
goflow2_flow_process_nf_delay_seconds
goflow2_flow_process_nf_templates_total
goflow2_flow_process_sf_total
goflow2_flow_process_sf_samples_total
goflow2_flow_process_sf_samples_records_total

Metrics targeted by Grafana dashboard:
goflow2_flow_decoding_time_seconds
goflow2_flow_process_nf_delay_seconds
goflow2_flow_process_nf_errors_total
goflow2_flow_process_nf_flowset_records_total
goflow2_flow_process_nf_templates_total
goflow2_flow_process_sf_samples_records_total
goflow2_flow_process_sf_samples_total
goflow2_flow_traffic_bytes_total
goflow2_flow_traffic_packets_total
goflow2_flow_traffic_size_bytes_count
goflow2_flow_traffic_size_bytes_sum

I noticed the last two metrics (goflow2_flow_traffic_size_bytes_count and goflow2_flow_traffic_size_bytes_sum) are not exposed by goflow2. Additionally, these goflow2 metrics are not targeted by the Grafana dashboard: goflow2_flow_dropped_packets_total, goflow2_flow_dropped_bytes_total, goflow2_flow_traffic_size_bytes, goflow2_flow_decoder_error_total, goflow2_flow_process_nf_total, goflow2_flow_process_nf_flowset_total, goflow2_flow_process_sf_total

I'd like to take this opportunity to ask you the following: I have goflow2 deployed in two setups, both receiving IMON flows. One of them is exposing all the goflow2_flow_process_nf_ metrics while the other one is not. I haven't had the chance to check the source code to determine whether this behavior is intentional. I would greatly appreciate your thoughts on this.

@lspgn
Copy link
Member

lspgn commented Dec 5, 2024

I noticed the last two metrics (goflow2_flow_traffic_size_bytes_count and goflow2_flow_traffic_size_bytes_sum) are not exposed by goflow2

Unless I'm mistaken, that's a summary which provides _sum and _count metrics:

MetricPacketSizeSum = prometheus.NewSummaryVec(
prometheus.SummaryOpts{
Name: "flow_traffic_size_bytes",
Help: "Summary of packet size.",
Namespace: NAMESPACE, Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001},
},
[]string{"remote_ip", "local_ip", "local_port", "type"},
)

Additionally, these goflow2 metrics are not targeted by the Grafana dashboard

Ah yes, the compose directory is to provide some boilerplate but it's far from being a fully maintained suite.

One of them is exposing all the goflow2_flow_process_nf_ metrics while the other one is not

Running the same versions? If it's missing, it did not process any NetFlow packet. Was there any output?

@firasrasmy-thg
Copy link
Author

Unless I'm mistaken, that's a summary which provides _sum and _count metrics:

Ah yes you are right, my mistake! I just quickly searched for prometheus.NewCounterVec in metrics.go and missed prometheus.NewSummaryVec. I see both my goflow2 instances are exposing the '_sum' and '_count' metrics.

Running the same versions? If it's missing, it did not process any NetFlow packet. Was there any output?

Yes, both of them are running the same version (GoFlow2 v2.2.1-4-gbf8b794) and receiving exactly the same IMON flows. Both setups produce exactly the same results. The goflow2 instance exposing the goflow2_flow_process_nf_ metrics is running in a Docker container, while the other instance is deployed in a Kubernetes cluster utilizing an OpenStack Octavia load balancer to expose the goflow2 port externally.

@lspgn
Copy link
Member

lspgn commented Dec 6, 2024

Hmm unless each instance received part of the traffic and in the case of NetFlow/IPFIX, if one of the two nodes does not have the templates, it won't be able to decode and the metric won't be created.

@lspgn lspgn closed this as completed in #361 Dec 6, 2024
@firasrasmy-thg
Copy link
Author

It turned out that the template packets were being forwarded to another goflow2 pod. After modifying the loadbalancer algorithm, they are now delivered to the same pod and I see all metrics are available now. Thanks for your support on this, Louis!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compose Related to compose/pipeline stacks
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants