mirror of
https://github.com/prometheus/node_exporter.git
synced 2024-11-12 16:44:18 -08:00
Update github.com/prometheus/procfs dependency
Fix IPVS ipv6 parsing, see also prometheus/procfs#40
This commit is contained in:
parent
d31c29490e
commit
2e9758564e
44
vendor/github.com/prometheus/procfs/ipvs.go
generated
vendored
44
vendor/github.com/prometheus/procfs/ipvs.go
generated
vendored
|
@ -33,6 +33,8 @@ type IPVSBackendStatus struct {
|
||||||
LocalAddress net.IP
|
LocalAddress net.IP
|
||||||
// The local (virtual) port.
|
// The local (virtual) port.
|
||||||
LocalPort uint16
|
LocalPort uint16
|
||||||
|
// The local firewall mark
|
||||||
|
LocalMark string
|
||||||
// The transport protocol (TCP, UDP).
|
// The transport protocol (TCP, UDP).
|
||||||
Proto string
|
Proto string
|
||||||
// The remote (real) IP address.
|
// The remote (real) IP address.
|
||||||
|
@ -142,6 +144,7 @@ func parseIPVSBackendStatus(file io.Reader) ([]IPVSBackendStatus, error) {
|
||||||
status []IPVSBackendStatus
|
status []IPVSBackendStatus
|
||||||
scanner = bufio.NewScanner(file)
|
scanner = bufio.NewScanner(file)
|
||||||
proto string
|
proto string
|
||||||
|
localMark string
|
||||||
localAddress net.IP
|
localAddress net.IP
|
||||||
localPort uint16
|
localPort uint16
|
||||||
err error
|
err error
|
||||||
|
@ -160,10 +163,19 @@ func parseIPVSBackendStatus(file io.Reader) ([]IPVSBackendStatus, error) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
proto = fields[0]
|
proto = fields[0]
|
||||||
|
localMark = ""
|
||||||
localAddress, localPort, err = parseIPPort(fields[1])
|
localAddress, localPort, err = parseIPPort(fields[1])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
case fields[0] == "FWM":
|
||||||
|
if len(fields) < 2 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
proto = fields[0]
|
||||||
|
localMark = fields[1]
|
||||||
|
localAddress = nil
|
||||||
|
localPort = 0
|
||||||
case fields[0] == "->":
|
case fields[0] == "->":
|
||||||
if len(fields) < 6 {
|
if len(fields) < 6 {
|
||||||
continue
|
continue
|
||||||
|
@ -187,6 +199,7 @@ func parseIPVSBackendStatus(file io.Reader) ([]IPVSBackendStatus, error) {
|
||||||
status = append(status, IPVSBackendStatus{
|
status = append(status, IPVSBackendStatus{
|
||||||
LocalAddress: localAddress,
|
LocalAddress: localAddress,
|
||||||
LocalPort: localPort,
|
LocalPort: localPort,
|
||||||
|
LocalMark: localMark,
|
||||||
RemoteAddress: remoteAddress,
|
RemoteAddress: remoteAddress,
|
||||||
RemotePort: remotePort,
|
RemotePort: remotePort,
|
||||||
Proto: proto,
|
Proto: proto,
|
||||||
|
@ -200,22 +213,31 @@ func parseIPVSBackendStatus(file io.Reader) ([]IPVSBackendStatus, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseIPPort(s string) (net.IP, uint16, error) {
|
func parseIPPort(s string) (net.IP, uint16, error) {
|
||||||
tmp := strings.SplitN(s, ":", 2)
|
var (
|
||||||
|
ip net.IP
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
|
||||||
if len(tmp) != 2 {
|
switch len(s) {
|
||||||
return nil, 0, fmt.Errorf("invalid IP:Port: %s", s)
|
case 13:
|
||||||
}
|
ip, err = hex.DecodeString(s[0:8])
|
||||||
|
|
||||||
if len(tmp[0]) != 8 && len(tmp[0]) != 32 {
|
|
||||||
return nil, 0, fmt.Errorf("invalid IP: %s", tmp[0])
|
|
||||||
}
|
|
||||||
|
|
||||||
ip, err := hex.DecodeString(tmp[0])
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, 0, err
|
return nil, 0, err
|
||||||
}
|
}
|
||||||
|
case 46:
|
||||||
|
ip = net.ParseIP(s[1:40])
|
||||||
|
if ip == nil {
|
||||||
|
return nil, 0, fmt.Errorf("invalid IPv6 address: %s", s[1:40])
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return nil, 0, fmt.Errorf("unexpected IP:Port: %s", s)
|
||||||
|
}
|
||||||
|
|
||||||
port, err := strconv.ParseUint(tmp[1], 16, 16)
|
portString := s[len(s)-4:]
|
||||||
|
if len(portString) != 4 {
|
||||||
|
return nil, 0, fmt.Errorf("unexpected port string format: %s", portString)
|
||||||
|
}
|
||||||
|
port, err := strconv.ParseUint(portString, 16, 16)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, 0, err
|
return nil, 0, err
|
||||||
}
|
}
|
||||||
|
|
14
vendor/vendor.json
vendored
14
vendor/vendor.json
vendored
|
@ -129,22 +129,22 @@
|
||||||
"revisionTime": "2017-02-20T10:38:46Z"
|
"revisionTime": "2017-02-20T10:38:46Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "dA8hiwcAbubYRxTnpocR5VZkqAY=",
|
"checksumSHA1": "my9sP6myQbSinzWZwxa4Q1V6awU=",
|
||||||
"path": "github.com/prometheus/procfs",
|
"path": "github.com/prometheus/procfs",
|
||||||
"revision": "6ac8c5d890d415025dd5aae7595bcb2a6e7e2fad",
|
"revision": "d098ca18df8bc825079013daf7bacefbb1ee877e",
|
||||||
"revisionTime": "2017-04-24T20:45:52Z"
|
"revisionTime": "2017-05-01T09:11:53Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "eiBAd4edewJTOtTwxh/ubJdjd+I=",
|
"checksumSHA1": "eiBAd4edewJTOtTwxh/ubJdjd+I=",
|
||||||
"path": "github.com/prometheus/procfs/sysfs",
|
"path": "github.com/prometheus/procfs/sysfs",
|
||||||
"revision": "6ac8c5d890d415025dd5aae7595bcb2a6e7e2fad",
|
"revision": "d098ca18df8bc825079013daf7bacefbb1ee877e",
|
||||||
"revisionTime": "2017-04-24T20:45:52Z"
|
"revisionTime": "2017-05-01T09:11:53Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "xCiFAAwVTrjsfZT1BIJQ3DgeNCY=",
|
"checksumSHA1": "xCiFAAwVTrjsfZT1BIJQ3DgeNCY=",
|
||||||
"path": "github.com/prometheus/procfs/xfs",
|
"path": "github.com/prometheus/procfs/xfs",
|
||||||
"revision": "6ac8c5d890d415025dd5aae7595bcb2a6e7e2fad",
|
"revision": "d098ca18df8bc825079013daf7bacefbb1ee877e",
|
||||||
"revisionTime": "2017-04-24T20:45:52Z"
|
"revisionTime": "2017-05-01T09:11:53Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "uozMgPjB4AggpuuJkGq3FgAs4CA=",
|
"checksumSHA1": "uozMgPjB4AggpuuJkGq3FgAs4CA=",
|
||||||
|
|
Loading…
Reference in a new issue