-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Advanced ICMP options #240
Conversation
config/config.go
Outdated
@@ -96,7 +96,8 @@ type TCPProbe struct { | |||
|
|||
type ICMPProbe struct { | |||
PreferredIPProtocol string `yaml:"preferred_ip_protocol,omitempty"` // Defaults to "ip6". | |||
|
|||
Payload int `yaml:"payload,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PayloadSize would make more sense
config/config.go
Outdated
@@ -96,7 +96,8 @@ type TCPProbe struct { | |||
|
|||
type ICMPProbe struct { | |||
PreferredIPProtocol string `yaml:"preferred_ip_protocol,omitempty"` // Defaults to "ip6". | |||
|
|||
Payload int `yaml:"payload,omitempty"` | |||
DontFragment bool `yaml:"dontfragment,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dont_fragment
prober/icmp.go
Outdated
copy(data, "Prometheus Blackbox Exporter") | ||
} else { | ||
data = []byte("Prometheus Blackbox Exporter") | ||
payload = 1500 // The usual MTU size. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this used?
prober/icmp.go
Outdated
@@ -136,3 +132,96 @@ func ProbeICMP(ctx context.Context, target string, module config.Module, registr | |||
} | |||
} | |||
} | |||
|
|||
func getICMPSocket( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you're buying much by breaking this out, and it also makes it more difficult to review what has changed in the code
} | ||
|
||
func (c *dfConn) ReadFrom(b []byte) (int, net.Addr, error) { | ||
h, p, _, err := c.c.ReadFrom(b) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't work on Windows, which is a supported platform.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do you propose I move about this? Different files for nix and windows? Or error when reading config?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First see if this can be done with Windows, we should be aiming for feature parity
Feature idea seems good to me. |
6a6d3ca
to
cebe76f
Compare
Updated to incorporate feedback and to error if |
Signed-off-by: Goutham Veeramachaneni <[email protected]>
cebe76f
to
482d59b
Compare
CONFIGURATION.md
Outdated
@@ -168,6 +168,12 @@ validate_additional_rrs: | |||
# The preferred IP protocol of the ICMP probe (ip4, ip6). | |||
[ preferred_ip_protocol: <string> | default = "ip6" ] | |||
|
|||
# Set the DF-Bit in the IP-header. Only works with ip4 and on *nix systems. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bit
prober/icmp.go
Outdated
copy(data[:], "Prometheus Blackbox Exporter") | ||
if module.ICMP.PayloadSize != 0 { | ||
data = make([]byte, module.ICMP.PayloadSize) | ||
copy(data, "Prometheus Blackbox Exporter") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the payload size is smaller than this string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://play.golang.org/p/qrDFrlW6He Then only the payload size will be sen't with truncated string.
Signed-off-by: Goutham Veeramachaneni <[email protected]>
a00c3ad
to
00d6bae
Compare
var data []byte | ||
if module.ICMP.PayloadSize != 0 { | ||
data = make([]byte, module.ICMP.PayloadSize) | ||
copy(data, "Prometheus Blackbox Exporter") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick, but it might make sense to include the exporter version in here.
@RichiH wanted to add the payload size and DF-bit to be configurable in the ICMP prober. While I had fun implementing this, I would like to know if this is okay before I put in more effort.
cc/ @brian-brazil @SuperQ
This change is