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

Parse ipv6 addresses in ipvs backend status #40

Closed
filippog opened this issue Apr 19, 2017 · 10 comments
Closed

Parse ipv6 addresses in ipvs backend status #40

filippog opened this issue Apr 19, 2017 · 10 comments
Assignees

Comments

@filippog
Copy link

We are running ipvs collector from node_exporter on a machine receiving ipv6 traffic too, though node_exporter 0.13 fails with this:

time="2017-04-19T09:47:26Z" level=error msg="ERROR: ipvs collector failed after 0.000758s: could not get backend status: invalid IP: [2620" source="node_exporter.go:91"

And the /proc/net/ip_vs file looks like this (after redacting the addresses)

# cat /proc/net/ip_vs
IP Virtual Server version 1.2.1 (size=1048576)
Prot LocalAddress:Port Scheduler Flags
  -> RemoteAddress:Port Forward Weight ActiveConn InActConn
TCP  00000000:0050 sh  
  -> 00000000:0050      Route   1      33         10        
  -> 00000000:0050      Route   1      48         52        
  -> 00000000:0050      Route   1      56         92        
  -> 00000000:0050      Route   1      48         15        
  -> 00000000:0050      Route   1      32         52        
  -> 00000000:0050      Route   1      62         28        
  -> 00000000:0050      Route   1      19         30        
  -> 00000000:0050      Route   1      93         43        
TCP  [2620:0000:0000:0000:0000:0000:0000:0000]:01BB sh 
  -> [2620:0000:0000:0000:0000:0000:0000:0000]:01BB      Route   1      0          0         
  -> [2620:0000:0000:0000:0000:0000:0000:0000]:01BB      Route   1      2          0         
  -> [2620:0000:0000:0000:0000:0000:0000:0000]:01BB      Route   1      2          0         
  -> [2620:0000:0000:0000:0000:0000:0000:0000]:01BB      Route   1      0          0         
  -> [2620:0000:0000:0000:0000:0000:0000:0000]:01BB      Route   1      2          0         
  -> [2620:0000:0000:0000:0000:0000:0000:0000]:01BB      Route   1      1          3         
  -> [2620:0000:0000:0000:0000:0000:0000:0000]:01BB      Route   1      1          1         
  -> [2620:0000:0000:0000:0000:0000:0000:0000]:01BB      Route   1      1          3         
TCP  00000000:01BB sh  
  -> 00000000:01BB      Route   1      35         59        
  -> 00000000:01BB      Route   1      74         104       
  -> 00000000:01BB      Route   1      275        340       
  -> 00000000:01BB      Route   1      25         56        
  -> 00000000:01BB      Route   1      26         290       
  -> 00000000:01BB      Route   1      36         303       
  -> 00000000:01BB      Route   1      20         326       
  -> 00000000:01BB      Route   1      27         297       
TCP  [2620:0000:0000:0000:0000:0000:0000:0000]:0050 sh 
  -> [2620:0000:0000:0000:0000:0000:0000:0000]:0050      Route   1      0          0         
  -> [2620:0000:0000:0000:0000:0000:0000:0000]:0050      Route   1      0          0         
  -> [2620:0000:0000:0000:0000:0000:0000:0000]:0050      Route   1      1          1         
  -> [2620:0000:0000:0000:0000:0000:0000:0000]:0050      Route   1      0          0         
  -> [2620:0000:0000:0000:0000:0000:0000:0000]:0050      Route   1      0          0         
  -> [2620:0000:0000:0000:0000:0000:0000:0000]:0050      Route   1      0          2         
  -> [2620:0000:0000:0000:0000:0000:0000:0000]:0050      Route   1      0          0         
  -> [2620:0000:0000:0000:0000:0000:0000:0000]:0050      Route   1      0          2         
@SuperQ SuperQ self-assigned this Apr 20, 2017
@SuperQ
Copy link
Member

SuperQ commented Apr 20, 2017

Interesting, what kernel version are you using? The current code parses IPv6 via the same hex format.

@SuperQ
Copy link
Member

SuperQ commented Apr 20, 2017

@matthiasr, where did you find the sample of a /proc/net/ip_vs that contained an IPv6 in the format of DEADBEEF000000000000000000000001:1F90?

@matthiasr
Copy link

I don't remember I'm afraid. I hope I configured this on some machine and this is what I got …

@matthiasr
Copy link

Actually, reading prometheus/node_exporter#67 I don't think I did. I had no IPv6 example to work off and it probably never worked this way.

@matthiasr
Copy link

Paging @juliusv who, if I remember correctly, had a hand or two in the IPv6 support for IPVS :)

@filippog
Copy link
Author

@SuperQ these machines run a mix of 4.4 and 4.9 though IIRC we've seen the same with older kernels e.g. 3.16

@juliusv
Copy link
Member

juliusv commented Apr 24, 2017

@matthiasr I didnt touch this procfs file back then, but I added a Generic Netlink interface to read and write IPVS configs (which was needed because the old sockopt-based interface couldn't accommodate v6 addresses). You can take a look at what the Netlink interface looks like today, maybe it can give you the same answers: https://github.com/torvalds/linux/blob/ca78d3173cff3503bcd15723b049757f75762d15/net/netfilter/ipvs/ip_vs_ctl.c#L2836

https://github.com/torvalds/linux/blob/5924bbecd0267d87c24110cbe2041b5075173a25/include/uapi/linux/ip_vs.h#L279

@matthiasr
Copy link

Hokay, I have no idea what how to read those 😆

If the [aaaa:bbbb:…] format is what actually exists in the wild I'm inclined to just roll with it

@juliusv
Copy link
Member

juliusv commented Apr 25, 2017

SGTM

@filippog
Copy link
Author

filippog commented May 4, 2017

Confirmed working, thanks a lot @matthiasr ! I've opened prometheus/node_exporter#576 to add this to node_exporter

bobrik pushed a commit to bobrik/procfs that referenced this issue Jan 14, 2023
bobrik pushed a commit to bobrik/procfs that referenced this issue Jan 14, 2023
oblitorum pushed a commit to shatteredsilicon/node_exporter that referenced this issue Apr 9, 2024
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