Skip to content

Commit

Permalink
Revert "Capture network info in health report" (#236)
Browse files Browse the repository at this point in the history
* Revert "Add HealthInfoVersion3 in list of supported versions (#235)"

This reverts commit 53a0ee4.

* Revert "Add required methods to HealthInfoV3 (#234)"

This reverts commit 59bc761.

* Revert "Capture network info in health report (#233)"

This reverts commit 4bedcdb.
  • Loading branch information
anjalshireesh authored Oct 13, 2023
1 parent 0d6ff9f commit b7c5192
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 187 deletions.
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ require (
github.com/prometheus/client_model v0.4.0
github.com/prometheus/procfs v0.9.0
github.com/prometheus/prom2json v1.3.3
github.com/safchain/ethtool v0.3.0
github.com/secure-io/sio-go v0.3.1
github.com/shirou/gopsutil/v3 v3.23.1
github.com/tinylib/msgp v1.1.8
Expand Down
3 changes: 0 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ github.com/prometheus/prom2json v1.3.3 h1:IYfSMiZ7sSOfliBoo89PcufjWO4eAR0gznGcET
github.com/prometheus/prom2json v1.3.3/go.mod h1:Pv4yIPktEkK7btWsrUTWDDDrnpUrAELaOCj+oFwlgmc=
github.com/rs/xid v1.5.0 h1:mKX4bl4iPYJtEIxp6CYiUuLQ/8DYMoz0PUdtGgMFRVc=
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/safchain/ethtool v0.3.0 h1:gimQJpsI6sc1yIqP/y8GYgiXn/NjgvpM0RNoWLVVmP0=
github.com/safchain/ethtool v0.3.0/go.mod h1:SA9BwrgyAqNo7M+uaL6IYbxpm5wk3L7Mm6ocLW+CJUs=
github.com/secure-io/sio-go v0.3.1 h1:dNvY9awjabXTYGsTF1PiCySl9Ltofk9GA3VdWlo7rRc=
github.com/secure-io/sio-go v0.3.1/go.mod h1:+xbkjDzPjwh4Axd07pRKSNriS9SCiYksWnZqdnfpQxs=
github.com/shirou/gopsutil/v3 v3.23.1 h1:a9KKO+kGLKEvcPIs4W62v0nu3sciVDOOOPUD0Hz7z/4=
Expand Down Expand Up @@ -111,7 +109,6 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
Expand Down
60 changes: 1 addition & 59 deletions health-old.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ type HealthInfoV2 struct {
Error string `json:"error,omitempty"`

TimeStamp time.Time `json:"timestamp,omitempty"`
Sys SysInfoV1 `json:"sys,omitempty"`
Sys SysInfo `json:"sys,omitempty"`
Perf PerfInfo `json:"perf,omitempty"`
Minio MinioHealthInfo `json:"minio,omitempty"`
}
Expand Down Expand Up @@ -86,51 +86,6 @@ func (info HealthInfoV2) GetTimestamp() time.Time {
return info.TimeStamp
}

// HealthInfoV3 - MinIO cluster's health Info version 3
type HealthInfoV3 struct {
Version string `json:"version"`
Error string `json:"error,omitempty"`

TimeStamp time.Time `json:"timestamp,omitempty"`
Sys SysInfoV1 `json:"sys,omitempty"`
Minio MinioHealthInfo `json:"minio,omitempty"`
}

func (info HealthInfoV3) String() string {
data, err := json.Marshal(info)
if err != nil {
panic(err) // This never happens.
}
return string(data)
}

// JSON returns this structure as JSON formatted string.
func (info HealthInfoV3) JSON() string {
data, err := json.MarshalIndent(info, " ", " ")
if err != nil {
panic(err) // This never happens.
}
return string(data)
}

// GetError - returns error from the cluster health info
func (info HealthInfoV3) GetError() string {
return info.Error
}

// GetStatus - returns status of the cluster health info
func (info HealthInfoV3) GetStatus() string {
if info.Error != "" {
return "error"
}
return "success"
}

// GetTimestamp - returns timestamp from the cluster health info
func (info HealthInfoV3) GetTimestamp() time.Time {
return info.TimeStamp
}

// Latency contains write operation latency in seconds of a disk drive.
type Latency struct {
Avg float64 `json:"avg"`
Expand Down Expand Up @@ -469,16 +424,3 @@ type NetPerfInfoV0 struct {
Throughput NetThroughput `json:"throughput,omitempty"`
Error string `json:"error,omitempty"`
}

// SysInfoV1 - Includes hardware and system information of the MinIO cluster V1
type SysInfoV1 struct {
CPUInfo []CPUs `json:"cpus,omitempty"`
Partitions []Partitions `json:"partitions,omitempty"`
OSInfo []OSInfo `json:"osinfo,omitempty"`
MemInfo []MemInfo `json:"meminfo,omitempty"`
ProcInfo []ProcInfo `json:"procinfo,omitempty"`
SysErrs []SysErrors `json:"errors,omitempty"`
SysServices []SysServices `json:"services,omitempty"`
SysConfig []SysConfig `json:"config,omitempty"`
KubernetesInfo KubernetesInfo `json:"kubernetes"`
}
54 changes: 17 additions & 37 deletions health.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,8 @@ const (
HealthInfoVersion2 = "2"
// HealthInfoVersion3 is version 3
HealthInfoVersion3 = "3"
// HealthInfoVersion4 is version 4
HealthInfoVersion4 = "4"
// HealthInfoVersion is current health info version.
HealthInfoVersion = HealthInfoVersion4
HealthInfoVersion = HealthInfoVersion3
)

const (
Expand Down Expand Up @@ -234,7 +232,6 @@ type Partition struct {

Device string `json:"device,omitempty"`
Model string `json:"model,omitempty"`
Revision string `json:"revision,omitempty"`
Mountpoint string `json:"mountpoint,omitempty"`
FSType string `json:"fs_type,omitempty"`
MountOptions string `json:"mount_options,omitempty"`
Expand All @@ -245,63 +242,48 @@ type Partition struct {
InodeFree uint64 `json:"inode_free,omitempty"`
}

// NetInfo contains information about a network inerface
type NetInfo struct {
NodeCommon
Interface string `json:"interface,omitempty"`
Driver string `json:"driver,omitempty"`
FirmwareVersion string `json:"firmware_version,omitempty"`
}

// Partitions contains all disk partitions information of a node.
type Partitions struct {
NodeCommon

Partitions []Partition `json:"partitions,omitempty"`
}

func getDeviceInfo(partDevice string) (model string, revision string, err error) {
func getDeviceModel(partDevice string) (string, error) {
var model string

partDevName := strings.ReplaceAll(partDevice, devDir, "")
devPath := path.Join(sysClassBlock, partDevName, "dev")

_, err = os.Stat(devPath)
_, err := os.Stat(devPath)
if err != nil {
return
return model, err
}

var data []byte
data, err = ioutil.ReadFile(devPath)
data, err := ioutil.ReadFile(devPath)
if err != nil {
return
return model, err
}

majorMinor := strings.TrimSpace(string(data))
driveInfoPath := runDevDataPfx + majorMinor

var f *os.File
f, err = os.Open(driveInfoPath)
f, err := os.Open(driveInfoPath)
if err != nil {
return
return model, err
}
defer f.Close()

buf := bufio.NewScanner(f)
for buf.Scan() {
field := strings.SplitN(buf.Text(), "=", 2)
if len(field) == 2 {
if field[0] == "E:ID_MODEL" {
model = field[1]
}
if field[0] == "E:ID_REVISION" {
revision = field[1]
}
if len(model) > 0 && len(revision) > 0 {
break
}
if len(field) == 2 && field[0] == "E:ID_MODEL" {
model = field[1]
break
}
}

return
return model, err
}

// GetPartitions returns all disk partitions information of a node running linux only operating system.
Expand Down Expand Up @@ -335,11 +317,11 @@ func GetPartitions(ctx context.Context, addr string) Partitions {
Error: err.Error(),
})
} else {
var model, revision string
var model string
device := parts[i].Device
if strings.HasPrefix(device, devDir) && !strings.HasPrefix(device, devLoopDir) {
// ignore any error in finding device model
model, revision, _ = getDeviceInfo(device)
model, _ = getDeviceModel(device)
}

partitions = append(partitions, Partition{
Expand All @@ -353,7 +335,6 @@ func GetPartitions(ctx context.Context, addr string) Partitions {
InodeTotal: usage.InodesTotal,
InodeFree: usage.InodesFree,
Model: model,
Revision: revision,
})
}
}
Expand Down Expand Up @@ -904,7 +885,6 @@ type SysInfo struct {
OSInfo []OSInfo `json:"osinfo,omitempty"`
MemInfo []MemInfo `json:"meminfo,omitempty"`
ProcInfo []ProcInfo `json:"procinfo,omitempty"`
NetInfo []NetInfo `json:"netinfo,omitempty"`
SysErrs []SysErrors `json:"errors,omitempty"`
SysServices []SysServices `json:"services,omitempty"`
SysConfig []SysConfig `json:"config,omitempty"`
Expand Down Expand Up @@ -1158,7 +1138,7 @@ func (adm *AdminClient) ServerHealthInfo(ctx context.Context, types []HealthData
}

switch version.Version {
case "", HealthInfoVersion3, HealthInfoVersion2, HealthInfoVersion:
case "", HealthInfoVersion2, HealthInfoVersion:
default:
closeResponse(resp)
return nil, "", errors.New("Upgrade Minio Client to support health info version " + version.Version)
Expand Down
52 changes: 0 additions & 52 deletions net_linux.go

This file was deleted.

35 changes: 0 additions & 35 deletions net_nolinux.go

This file was deleted.

0 comments on commit b7c5192

Please sign in to comment.