mirror of https://github.com/minio/minio.git
fix: return error when requested interface has no stats available (#17666)
This commit is contained in:
parent
d118031ed6
commit
9b5c2c386a
|
@ -18,6 +18,8 @@
|
||||||
package net
|
package net
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"github.com/prometheus/procfs"
|
"github.com/prometheus/procfs"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -31,5 +33,9 @@ func GetInterfaceNetStats(interf string) (procfs.NetDevLine, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return procfs.NetDevLine{}, err
|
return procfs.NetDevLine{}, err
|
||||||
}
|
}
|
||||||
return netDev[interf], nil
|
ndl, ok := netDev[interf]
|
||||||
|
if !ok {
|
||||||
|
return procfs.NetDevLine{}, fmt.Errorf("%v interface not found", interf)
|
||||||
|
}
|
||||||
|
return ndl, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue