mirror of
https://github.com/minio/minio.git
synced 2025-11-08 21:24:55 -05:00
fear: Implement 'mc support top net' (#17598)
This commit is contained in:
@@ -23,6 +23,7 @@ import (
|
||||
|
||||
"github.com/minio/madmin-go/v3"
|
||||
"github.com/minio/minio/internal/disk"
|
||||
"github.com/minio/minio/internal/net"
|
||||
)
|
||||
|
||||
type collectMetricsOpts struct {
|
||||
@@ -69,6 +70,18 @@ func collectLocalMetrics(types madmin.MetricType, opts collectMetricsOpts) (m ma
|
||||
if types.Contains(madmin.MetricsSiteResync) {
|
||||
m.Aggregated.SiteResync = globalSiteResyncMetrics.report(opts.depID)
|
||||
}
|
||||
if types.Contains(madmin.MetricNet) {
|
||||
m.Aggregated.Net = &madmin.NetMetrics{
|
||||
CollectedAt: UTCNow(),
|
||||
InterfaceName: globalInternodeInterface,
|
||||
}
|
||||
netStats, err := net.GetInterfaceNetStats(globalInternodeInterface)
|
||||
if err != nil {
|
||||
m.Errors = append(m.Errors, err.Error())
|
||||
} else {
|
||||
m.Aggregated.Net.NetStats = netStats
|
||||
}
|
||||
}
|
||||
// Add types...
|
||||
|
||||
// ByHost is a shallow reference, so careful about sharing.
|
||||
|
||||
Reference in New Issue
Block a user