-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Capture network info in health report (#240)
Introduce a new struct `NetInfo` to store the driver and firmware version of a network interface. Also, - Introduce a function to populate `NetInfo` for a given interface - Add `Revision` field for a drive partition and capture it in the health diagnostics.
- Loading branch information
1 parent
cd6ff27
commit f9e74b9
Showing
5 changed files
with
131 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
//go:build linux | ||
// +build linux | ||
|
||
// Copyright (c) 2015-2023 MinIO, Inc. | ||
// | ||
// This file is part of MinIO Object Storage stack | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Affero General Public License as | ||
// published by the Free Software Foundation, either version 3 of the | ||
// License, or (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Affero General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Affero General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
// | ||
|
||
package madmin | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/safchain/ethtool" | ||
) | ||
|
||
// GetNetInfo returns information of the given network interface | ||
func GetNetInfo(addr string, iface string) (ni NetInfo) { | ||
ni.Addr = addr | ||
ni.Interface = iface | ||
|
||
ethHandle, err := ethtool.NewEthtool() | ||
if err != nil { | ||
ni.Error = err.Error() | ||
return | ||
} | ||
defer ethHandle.Close() | ||
|
||
di, err := ethHandle.DriverInfo(ni.Interface) | ||
if err != nil { | ||
ni.Error = fmt.Sprintf("Error getting driver info for %s: %s", ni.Interface, err.Error()) | ||
return | ||
} | ||
|
||
ni.Driver = di.Driver | ||
ni.FirmwareVersion = di.FwVersion | ||
|
||
return | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
//go:build !linux | ||
// +build !linux | ||
|
||
// | ||
// Copyright (c) 2015-2023 MinIO, Inc. | ||
// | ||
// This file is part of MinIO Object Storage stack | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Affero General Public License as | ||
// published by the Free Software Foundation, either version 3 of the | ||
// License, or (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Affero General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Affero General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
// | ||
|
||
package madmin | ||
|
||
// GetNetInfo returns information of the given network interface | ||
// Not implemented for non-linux platforms | ||
func GetNetInfo(addr string, iface string) NetInfo { | ||
return NetInfo{ | ||
NodeCommon: NodeCommon{ | ||
Addr: addr, | ||
Error: "Not implemented for non-linux platforms", | ||
}, | ||
Interface: iface, | ||
} | ||
} |