Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: rest infrastructure #565

Merged
merged 8 commits into from
Nov 2, 2021
Merged
40 changes: 40 additions & 0 deletions cmd/collectors/rest/plugins/disk/disk.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright NetApp Inc, 2021 All rights reserved
*/
package disk

import (
"goharvest2/cmd/poller/plugin"
"goharvest2/pkg/matrix"
)

type Disk struct {
*plugin.AbstractPlugin
}

func New(p *plugin.AbstractPlugin) plugin.Plugin {
return &Disk{AbstractPlugin: p}
}

func (me *Disk) Run(data *matrix.Matrix) ([]*matrix.Matrix, error) {

for _, instance := range data.GetInstances() {

containerType := instance.GetLabel("container_type")

if containerType == "shared" {
instance.SetLabel("shared", "true")
} else {
instance.SetLabel("shared", "false")
}

if containerType == "broken" {
instance.SetLabel("failed", "true")
} else {
instance.SetLabel("failed", "false")
}

}

return nil, nil
}
Loading