-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Allow source interface binding for Graphite output #14614
Comments
Hello, @srebhan Sadly but it didn't work. Telegraf is in bootloop with this error:
I've tried to rebuild your branch changing back net.ResolveIPAddr("tcp", g.LocalAddr) to net.ResolveIPAddr("ip", g.LocalAddr) It started without errors now but no connection established for this IP.
after:
my config for reference: [[outputs.graphite]]
servers = ["192.168.109.237:42000"]
local_address = "192.168.125.73"
prefix = ""
graphite_tag_support = true
timeout = 2
[[outputs.graphite]]
servers = ["192.168.109.237:42001"]
prefix = ""
graphite_tag_support = true
timeout = 2 Seems like definition of localTCPAddr := net.TCPAddr{
IP: localAddr.IP,
} I will check few things and make more tests today, and get back to you with more info. |
@phuntik can you please try again with the binary in the updated PR?!? |
@srebhan thanks for update.
My belief regarding 5th is that if we allow user to define src port it should be full range of ports. Then it should be UInt16 (ParseUint) check, not Int16. But I'm almost fully sure it's just a typo :) Other cases are good for me, I just think you might want to add some explanation errors to stdout for 3rd and 6th if the same approach with src port binding might be used with other TCP-based outputs in future, but it is not mandatory for sure. Up to you. Especially if consider that 6th might be not so easy to check, so maybe user should be self-aware of using wrong IPs. |
There might be a potential problem, which I'd like to point your attention at. Lets say we use graphite cluster as dst listener. But even if the only regime of cluster connection is load-balancing, meaning there won't be a situation when two connections are being active simultaneously, I don't know exactly how much time will dialer need to fully close one connection before creating new one from the same port without scodling about already used port. And anyways it seems that connections will always be reinitialized, without ability to reuse existing connection. IDK for sure about all these but thought it is at least worse mentioning. Also I think it might be difficult to handle this all together in code an maybe even unnecessary if for the years I'm the only one who asked for this feature. So maybe just mentioning this in readme will be enough: that user should not use port defenition while using clusters. Or should use relay then, if there is a strong need in src port defenition. |
@phuntik thanks for testing. Yeah Regarding graphite cluster, I guess the solution would be to only provide a local IP address and let the dialer choose the port... |
@phuntik would appreciate if you can take another look... |
@phuntik ping! Can you please test the binary in the updated PR and let me know if this now works as intended!? |
Dear @srebhan |
Use Case
Hello, Dears!
While using VRF routing it is not always obvious which interface will be chosen by kernel to route connection through.
There was a kinda similar issue years ago - 4287. And this functionality was not implemented, though it sounds like can be done easily.
I've found this simple piece of code and build Telegraf with it. It worked just as needed. Here you can see the changes: master...phuntik:telegraf:master
Please, consider such a functionality. Would be glad if this feature will appear in any form possible eventually.
p.s. Please assume I'm not a programmer. Just tested it out in this way and it worked for me, so I am opened for any critic. Cause even if it won't be implemented, seems like I will stick with permanent patching Telegraf by myself in future to be able to use binding.
Thanks for attention!
Expected behavior
be able to bind specific interface which Telegraf will send metrics through
Actual behavior
routing is ruled totally by kernel, while with VRF it is not always applicable
Additional info
No response
The text was updated successfully, but these errors were encountered: