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

exporter cannot parse network_ip_availabilities_total metrics #205

Open
rrraditya opened this issue Oct 7, 2021 · 12 comments
Open

exporter cannot parse network_ip_availabilities_total metrics #205

rrraditya opened this issue Oct 7, 2021 · 12 comments

Comments

@rrraditya
Copy link

Openstack-exporter version used:

openstack-exporter, version 1.0.0 (branch: HEAD, revision: e6224ef)
build user: root@fd8bce58a223
build date: 20200327-21:44:22
go version: go1.13.9

What happened:
If there's a subnet with IPv6 with high allocation pools in the openstack cluster, the exporter fail to parse the value.
error was given :

Oct 7 10:42:23 prom01 openstack-exporter: time="2021-10-07T10:42:23+07:00" level=info msg="Collecting metrics for exporter: openstack_neutron, metric: network_ip_availabilities_total" source="exporter.go:88"
Oct 7 10:42:23 01prom01 openstack-exporter: time="2021-10-07T10:42:23+07:00" level=error msg="math/big: cannot unmarshal "1.1805916207174113e+21" into a *big.Int" source="exporter.go:96"

What you expected to happen:
no error found from openstack-exporter when there's IPv6 subnet in the openstack cluster

How to reproduce it:

  • create IPv6 subnet with 2001:db8::/58 or 2001:db8::/56
  • set gateway to 2001:db8::1
  • set allocation pools 2001:db8::2,2001:db8:0:3f:ffff:ffff:ffff:ffff
  • Validate openstack-exporter logs, look for error when it tries to collect network_ip_availabilities_total metrics
@niedbalski
Copy link
Member

Hey @alexeymyltsev is this something you have experienced with the network_ip_availabilities_total metric?

@rrraditya
Copy link
Author

hi @niedbalski
just adding our finding that this issue also occured in openstack-exporter latest release which is v1.4.0

/usr/local/bin/openstack-exporter-1.4 --version
openstack-exporter, version 1.4.0 (branch: HEAD, revision: adab1c3)
build user: root@7c71a7ee40cd
build date: 20210527-04:07:51
go version: go1.13.15

ps -ef | grep 53428
root 53428 1 3 02:41 ? 00:00:18 /usr/local/bin/openstack-exporter-1.4 --web.listen-address=:9181 --os-client-config="/etc/openstack/clouds.yaml" nc-region-1

Oct 08 02:47:49 prom02 openstack-exporter-1.4[53428]: time="2021-10-08T02:47:49Z" level=info msg="Collecting metrics for exporter: openstack_neutron, metric: network_ip_availabilities_total" source="exporter.go:96"
Oct 08 02:47:49 prom02 openstack-exporter-1.4[53428]: time="2021-10-08T02:47:49Z" level=error msg="Failed to collect metric for exporter: neutron, error: failed to collect metric: network_ip_availabilities_total, error: math/big: cannot unmarshal "4.722366482869645e+21" into a *big.Int" source="exporter.go:122"

hope this information helps.

Thank you.

Regards,
Reqi

@alexeymyltsev
Copy link
Collaborator

Hey @alexeymyltsev is this something you have experienced with the network_ip_availabilities_total metric?

Hi @niedbalski ! Unfortunately I didn't face with problem like that and we do no use IPv6, but I can try to reproduce this problem on our clusters.

@alexeymyltsev
Copy link
Collaborator

alexeymyltsev commented Oct 9, 2021

I have done several tests and I just find that cause of problem in gophercloud.
With CURL I got:
{"network_ip_availabilities": [{"network_id": "484e4bc5-902f-4637-bd90-38d0befafc9e", "network_name": "test-ipv6", "tenant_id": "281707607f27476e955432b1ed0e1f87", "project_id": "281707607f27476e955432b1ed0e1f87", "subnet_ip_availability": [{"subnet_id": "9464a1d1-be98-4408-89ee-5c125249b1b5", "ip_version": 6, "cidr": "2001:db8::/56", "subnet_name": "2001:db8::/56", "used_ips": 3, "total_ips": 4722366482869645213694}], "used_ips": 3, "total_ips": 4722366482869645213694}]}

But if I use gophercloud, I got:
{{{map[network_ip_availability:map[network_id:484e4bc5-902f-4637-bd90-38d0befafc9e network_name:test-ipv6 project_id:281707607f27476e955432b1ed0e1f87 subnet_ip_availability:[map[cidr:2001:db8::/56 ip_version:6 subnet_id:9464a1d1-be98-4408-89ee-5c125249b1b5 subnet_name:2001:db8::/56 total_ips:4.722366482869645e+21 used_ips:3]] tenant_id:281707607f27476e955432b1ed0e1f87 total_ips:4.722366482869645e+21 used_ips:3]] map[Content-Length:[472] Content-Type:[application/json] Date:[Sat, 09 Oct 2021 19:37:19 GMT] Vary:[Accept-Encoding] X-Openstack-Request-Id:[req-36b4d6c3-6db6-4493-ae92-177442d72d27]]

Unfortunately I have not find yet how this problem could be fixed.

Looks like this issue linked with https://tools.ietf.org/html/rfc7159#section-6

@rrraditya
Copy link
Author

hi @alexeymyltsev could you share how we can do the curl to get specific network_ip_availabilities for specific network_id? so we can test it too from our side.

@alexeymyltsev
Copy link
Collaborator

@rrraditya
curl -s -H "X-Auth-Token: $OS_TOKEN" https://api.example.com:9696/v2.0/network-ip-availabilities\?network_id\=484e4bc5-902f-4637-bd90-38d0befafc9e

@rrraditya
Copy link
Author

Thank you @alexeymyltsev
we'll test it on our side.

meanwhile, about this case, so there's still no plan whether this will be fixed from gophercloud side?
i mean, does this case will be marked as bug and will be fixed or else?

Thank you.

@alexeymyltsev
Copy link
Collaborator

Thank you @alexeymyltsev we'll test it on our side.

meanwhile, about this case, so there's still no plan whether this will be fixed from gophercloud side? i mean, does this case will be marked as bug and will be fixed or else?

Thank you.

I am planing create issue to gophercloud project.
I will add here link to issue for gothercloud.

@alexeymyltsev
Copy link
Collaborator

Issue for gophercloud
gophercloud/gophercloud#2233

@rrraditya
Copy link
Author

thank you @alexeymyltsev for the reference.
We'll keep an eye for updates on that ticket.

@curveds
Copy link

curveds commented Dec 28, 2023

Probably will help someone to avoid math/big error (workaround):

func ListNetworkIPAvailabilities(exporter *BaseOpenStackExporter, ch chan<- prometheus.Metric) error {
	var allNetworkIPAvailabilities []networkipavailabilities.NetworkIPAvailability

	allPagesNetworkIPAvailabilities, err := networkipavailabilities.List(exporter.Client, networkipavailabilities.ListOpts{
		IPVersion: "4", // Gather metrics only for IPv4
	}).AllPages()
	if err != nil {
		return err
	}

IPv6 subnets are big enough anyway.

Brittlejf added a commit to elastx/openstack-exporter-fork that referenced this issue Feb 6, 2024
@NamNH2393
Copy link

Hi team
This issue not resolve after many release version
Does we have any plan for this !?

Hope to receive feedback from team
Thanks team

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

No branches or pull requests

5 participants