Skip to content

Commit

Permalink
feat: Updating Snapmirror dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
Hardikl committed Oct 21, 2024
1 parent a64cdec commit 3e7c66f
Show file tree
Hide file tree
Showing 5 changed files with 446 additions and 5,690 deletions.
7 changes: 2 additions & 5 deletions cmd/tools/grafana/grafana.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,8 @@ func exportFiles(dir string, folder *Folder) error {
return nil
}

func addSvmRegex(content []byte, fileName string, val string) []byte {
func addSvmRegex(content []byte, val string) []byte {
svmExpression := []string{"templating.list.#(name=\"SVM\")"}
if fileName == "snapmirror.json" {
svmExpression = []string{"templating.list.#(name=\"DestinationSVM\")", "templating.list.#(name=\"SourceSVM\")"}
}
for _, s := range svmExpression {
var err error
svm := gjson.GetBytes(content, s)
Expand Down Expand Up @@ -514,7 +511,7 @@ func importFiles(dir string, folder *Folder) {

// add svm regex
if opts.svmRegex != "" {
data = addSvmRegex(data, file.Name(), opts.svmRegex)
data = addSvmRegex(data, opts.svmRegex)
}

// change cluster label if needed
Expand Down
21 changes: 4 additions & 17 deletions cmd/tools/grafana/grafana_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bytes"
"encoding/json"
"fmt"
"path/filepath"
"regexp"
"strings"
"testing"
Expand Down Expand Up @@ -113,22 +112,10 @@ func TestAddSvmRegex(t *testing.T) {
VisitDashboards(
[]string{"../../../grafana/dashboards/cmode/svm.json", "../../../grafana/dashboards/cmode/snapmirror.json"},
func(path string, data []byte) {
file := filepath.Base(path)
out := addSvmRegex(data, file, regex)
if file == "svm.json" {
r := gjson.GetBytes(out, "templating.list.#(name=\"SVM\").regex")
if r.String() != regex {
t.Errorf("path: %s \nExpected: [%s]\n Got: [%s]", path, regex, r.String())
}
} else if file == "snapmirror.json" {
r := gjson.GetBytes(out, "templating.list.#(name=\"DestinationSVM\").regex")
if r.String() != regex {
t.Errorf("path: %s \nExpected: [%s]\n Got: [%s]", path, regex, r.String())
}
r = gjson.GetBytes(out, "templating.list.#(name=\"SourceSVM\").regex")
if r.String() != regex {
t.Errorf("path: %s \nExpected: [%s]\n Got: [%s]", path, regex, r.String())
}
out := addSvmRegex(data, regex)
r := gjson.GetBytes(out, "templating.list.#(name=\"SVM\").regex")
if r.String() != regex {
t.Errorf("path: %s \nExpected: [%s]\n Got: [%s]", path, regex, r.String())
}
})
}
Expand Down
7 changes: 7 additions & 0 deletions conf/zapi/cdot/9.8.0/volume.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ counters:
- volume-inode-attributes:
- files-total
- files-used
- volume-mirror-attributes:
- ^is-snapmirror-source => isProtected
- ^is-snapmirror-source-to-object-store => isDestinationCloud
- ^is-snapmirror-source-to-ontap => isDestinationOntap
- volume-sis-attributes:
- ^is-sis-volume => is_sis_volume
- compression-space-saved => sis_compress_saved
Expand Down Expand Up @@ -117,8 +121,11 @@ export_options:
- clone_parent_snapshot
- clone_parent_svm
- clone_parent_volume
- isDestinationCloud
- isDestinationOntap
- isEncrypted
- isHardwareEncrypted
- isProtected
- is_sis_volume
- junction_path
- node_root
Expand Down
Loading

0 comments on commit 3e7c66f

Please sign in to comment.