Merge pull request #28 from AnalogJ/notify_failures

Adding UI for settings (and eventually notifications).
This commit is contained in:
Jason Kulatunga
2020-09-18 14:44:24 -06:00
committed by GitHub
50 changed files with 16226 additions and 12550 deletions
+12 -1
View File
@@ -23,6 +23,18 @@ type BaseCollector struct {
func (c *BaseCollector) DetectStorageDevices() ([]models.Device, error) {
//availableDisksJson, err := c.ExecCmd("smartctl", []string{"-j", "--scan"}, "", os.Environ())
//if err != nil {
// c.logger.Errorf("Error getting block storage info: %v", err)
// return nil, err
//}
//
//var smartctlScan models.Scan
//err = json.Unmarshal([]byte(availableDisksJson), &smartctlScan)
//if err != nil {
// return nil, err
//}
block, err := ghw.Block()
if err != nil {
c.logger.Errorf("Error getting block storage info: %v", err)
@@ -77,7 +89,6 @@ func (c *BaseCollector) DetectStorageDevices() ([]models.Device, error) {
approvedDisks = append(approvedDisks, diskModel)
}
return approvedDisks, nil
}
+2
View File
@@ -14,6 +14,8 @@ type Device struct {
Capacity int64 `json:"capacity"`
FormFactor string `json:"form_factor"`
SmartSupport bool `json:"smart_support"`
DeviceProtocol string `json:"device_protocol"` //protocol determines which smart attribute types are available (ATA, NVMe, SCSI)
DeviceType string `json:"device_type"` //device type is used for querying with -d/t flag, should only be used by collector.
}
type DeviceWrapper struct {
+19
View File
@@ -0,0 +1,19 @@
package models
type Scan struct {
JSONFormatVersion []int `json:"json_format_version"`
Smartctl struct {
Version []int `json:"version"`
SvnRevision string `json:"svn_revision"`
PlatformInfo string `json:"platform_info"`
BuildInfo string `json:"build_info"`
Argv []string `json:"argv"`
ExitStatus int `json:"exit_status"`
} `json:"smartctl"`
Devices []struct {
Name string `json:"name"`
InfoName string `json:"info_name"`
Type string `json:"type"`
Protocol string `json:"protocol"`
} `json:"devices"`
}