-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ONTAP Power calculation for embedded Shelf (#2333)
* feat: ONTAP Power calculation for embedded Shelf
- Loading branch information
1 parent
09beef2
commit 4c81750
Showing
7 changed files
with
135 additions
and
38 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Package shelf Copyright NetApp Inc, 2021 All rights reserved | ||
package shelf | ||
|
||
import ( | ||
"github.com/netapp/harvest/v2/cmd/collectors" | ||
"github.com/netapp/harvest/v2/cmd/poller/plugin" | ||
"github.com/netapp/harvest/v2/pkg/matrix" | ||
) | ||
|
||
type Shelf struct { | ||
*plugin.AbstractPlugin | ||
} | ||
|
||
func New(p *plugin.AbstractPlugin) plugin.Plugin { | ||
return &Shelf{AbstractPlugin: p} | ||
} | ||
|
||
func (my *Shelf) Init() error { | ||
return my.InitAbc() | ||
} | ||
|
||
func (my *Shelf) Run(dataMap map[string]*matrix.Matrix) ([]*matrix.Matrix, error) { | ||
|
||
data := dataMap[my.Object] | ||
for _, instance := range data.GetInstances() { | ||
if !instance.IsExportable() { | ||
continue | ||
} | ||
|
||
model := instance.GetLabel("model") | ||
moduleType := instance.GetLabel("module_type") | ||
|
||
isEmbed := collectors.IsEmbedShelf(model, moduleType) | ||
if isEmbed { | ||
instance.SetLabel("isEmbedded", "Yes") | ||
} else { | ||
instance.SetLabel("isEmbedded", "No") | ||
} | ||
} | ||
return nil, nil | ||
|
||
} |
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
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