From b67d9c037962bd4c753096ec04e4f537c8526b36 Mon Sep 17 00:00:00 2001 From: hardikl Date: Wed, 18 Dec 2024 20:28:13 +0530 Subject: [PATCH] feat: handled review comments --- .../plugins/snapshotpolicy/snapshotpolicy.go | 21 ++-- cmd/collectors/zapi/collector/zapi.go | 3 + .../plugins/snapshotpolicy/snapshotpolicy.go | 46 ++++++++ cmd/tools/generate/counter.yaml | 3 - conf/rest/9.12.0/snapshotpolicy.yaml | 3 +- conf/zapi/cdot/9.8.0/snapshotpolicy.yaml | 27 +++-- docs/ontap-metrics.md | 10 -- docs/prepare-cdot-clusters.md | 2 +- ...ion_snapshot.json => data_protection.json} | 100 +++++++++++++----- grafana/dashboards/cmode/datacenter.json | 16 +-- integration/test/dashboard_json_test.go | 2 +- 11 files changed, 169 insertions(+), 64 deletions(-) create mode 100644 cmd/collectors/zapi/plugins/snapshotpolicy/snapshotpolicy.go rename grafana/dashboards/cmode/{data_protection_snapshot.json => data_protection.json} (92%) diff --git a/cmd/collectors/rest/plugins/snapshotpolicy/snapshotpolicy.go b/cmd/collectors/rest/plugins/snapshotpolicy/snapshotpolicy.go index 4c5fc6781..ee8705a17 100644 --- a/cmd/collectors/rest/plugins/snapshotpolicy/snapshotpolicy.go +++ b/cmd/collectors/rest/plugins/snapshotpolicy/snapshotpolicy.go @@ -8,6 +8,7 @@ import ( "github.com/netapp/harvest/v2/cmd/poller/plugin" "github.com/netapp/harvest/v2/pkg/matrix" "github.com/netapp/harvest/v2/pkg/util" + "github.com/netapp/harvest/v2/third_party/tidwall/gjson" "strconv" "strings" ) @@ -25,15 +26,19 @@ func (m *SnapshotPolicy) Run(dataMap map[string]*matrix.Matrix) ([]*matrix.Matri data := dataMap[m.Object] for _, instance := range data.GetInstances() { - copies := strings.Split(instance.GetLabel("copies"), ",") - if len(copies) > 1 { - var copiesValue int - for _, c := range copies { - val, _ := strconv.Atoi(c) - copiesValue += val - } - instance.SetLabel("copies", strconv.Itoa(copiesValue)) + copies := instance.GetLabel("copies") + copiesJSON := gjson.Result{Type: gjson.JSON, Raw: "[" + copies + "]"} + var scheduleVal string + var copiesValue int + for _, copiesData := range copiesJSON.Array() { + count := copiesData.Get("count").String() + countVal, _ := strconv.Atoi(count) + schedule := copiesData.Get("schedule.name").ClonedString() + scheduleVal = scheduleVal + schedule + ":" + count + "," + copiesValue += countVal } + instance.SetLabel("schedules", strings.TrimSuffix(scheduleVal, ",")) + instance.SetLabel("copies", strconv.Itoa(copiesValue)) } return nil, nil, nil diff --git a/cmd/collectors/zapi/collector/zapi.go b/cmd/collectors/zapi/collector/zapi.go index 6d735fead..acc5461fa 100644 --- a/cmd/collectors/zapi/collector/zapi.go +++ b/cmd/collectors/zapi/collector/zapi.go @@ -15,6 +15,7 @@ import ( "github.com/netapp/harvest/v2/cmd/collectors/zapi/plugins/security" "github.com/netapp/harvest/v2/cmd/collectors/zapi/plugins/shelf" "github.com/netapp/harvest/v2/cmd/collectors/zapi/plugins/snapmirror" + "github.com/netapp/harvest/v2/cmd/collectors/zapi/plugins/snapshotpolicy" "github.com/netapp/harvest/v2/cmd/collectors/zapi/plugins/svm" "github.com/netapp/harvest/v2/cmd/collectors/zapi/plugins/systemnode" "github.com/netapp/harvest/v2/cmd/collectors/zapi/plugins/volume" @@ -148,6 +149,8 @@ func (z *Zapi) LoadPlugin(kind string, abc *plugin.AbstractPlugin) plugin.Plugin switch kind { case "Snapmirror": return snapmirror.New(abc) + case "SnapshotPolicy": + return snapshotpolicy.New(abc) case "Shelf": return shelf.New(abc) case "Qtree": diff --git a/cmd/collectors/zapi/plugins/snapshotpolicy/snapshotpolicy.go b/cmd/collectors/zapi/plugins/snapshotpolicy/snapshotpolicy.go new file mode 100644 index 000000000..4f028c29e --- /dev/null +++ b/cmd/collectors/zapi/plugins/snapshotpolicy/snapshotpolicy.go @@ -0,0 +1,46 @@ +/* + * Copyright NetApp Inc, 2024 All rights reserved + */ + +package snapshotpolicy + +import ( + "github.com/netapp/harvest/v2/cmd/poller/plugin" + "github.com/netapp/harvest/v2/pkg/matrix" + "github.com/netapp/harvest/v2/pkg/util" + "strconv" + "strings" +) + +type SnapshotPolicy struct { + *plugin.AbstractPlugin +} + +func New(p *plugin.AbstractPlugin) plugin.Plugin { + return &SnapshotPolicy{AbstractPlugin: p} +} + +func (m *SnapshotPolicy) Run(dataMap map[string]*matrix.Matrix) ([]*matrix.Matrix, *util.Metadata, error) { + // Purge and reset data + data := dataMap[m.Object] + + for _, instance := range data.GetInstances() { + copies := strings.Split(instance.GetLabel("copies"), ",") + schedules := strings.Split(instance.GetLabel("schedules"), ",") + + var scheduleVal string + var copiesValue int + if len(copies) > 1 { + for index, copiesData := range copies { + countVal, _ := strconv.Atoi(copiesData) + schedule := schedules[index] + scheduleVal = scheduleVal + schedule + ":" + copiesData + "," + copiesValue += countVal + } + instance.SetLabel("schedules", strings.TrimSuffix(scheduleVal, ",")) + instance.SetLabel("copies", strconv.Itoa(copiesValue)) + } + } + + return nil, nil, nil +} diff --git a/cmd/tools/generate/counter.yaml b/cmd/tools/generate/counter.yaml index 7adc1adcf..e69c60326 100644 --- a/cmd/tools/generate/counter.yaml +++ b/cmd/tools/generate/counter.yaml @@ -873,9 +873,6 @@ counters: - Name: snapmirror_update_successful_count Description: Number of Successful Updates - - Name: snapshot_policy_total_schedules - Description: Total Number of Schedules in this Policy - - Name: svm_nfs_read_throughput APIs: - API: REST diff --git a/conf/rest/9.12.0/snapshotpolicy.yaml b/conf/rest/9.12.0/snapshotpolicy.yaml index e0342a07c..1083d868e 100644 --- a/conf/rest/9.12.0/snapshotpolicy.yaml +++ b/conf/rest/9.12.0/snapshotpolicy.yaml @@ -5,10 +5,9 @@ object: snapshot_policy counters: - ^^uuid => uuid - ^comment => comment - - ^copies.#.count => copies + - ^copies => copies - ^enabled => status - ^name => snapshot_policy - - ^schedules => schedules - ^scope => scope - ^svm.name => svm diff --git a/conf/zapi/cdot/9.8.0/snapshotpolicy.yaml b/conf/zapi/cdot/9.8.0/snapshotpolicy.yaml index 1c9d598bb..324ff7f26 100644 --- a/conf/zapi/cdot/9.8.0/snapshotpolicy.yaml +++ b/conf/zapi/cdot/9.8.0/snapshotpolicy.yaml @@ -2,18 +2,33 @@ name: SnapshotPolicy query: snapshot-policy-get-iter object: snapshot_policy - counters: snapshot-policy-info: - - ^^policy => snapshot_policy - - ^^vserver-name => svm - - ^comment => comment - - total-schedules => total_schedules + - ^^policy => snapshot_policy + - ^^vserver-name => svm + - ^comment => comment + - ^enabled => status + - ^policy-owner => policy_owner + - snapshot-policy-schedules: + - snapshot-schedule-info: + - ^count => copies + - ^schedule => schedules + +plugins: + - LabelAgent: + split: + - policy_owner `-admin` scope, + - SnapshotPolicy export_options: instance_keys: - - comment - snapshot_policy + instance_labels: + - comment + - copies + - schedules + - scope + - status - svm diff --git a/docs/ontap-metrics.md b/docs/ontap-metrics.md index 311683e61..755941bdc 100644 --- a/docs/ontap-metrics.md +++ b/docs/ontap-metrics.md @@ -11503,16 +11503,6 @@ Number of Successful Updates | ZAPI | `snapmirror-get-iter` | `snapmirror-info.update-successful-count` | conf/zapi/cdot/9.8.0/snapmirror.yaml | -### snapshot_policy_total_schedules - -Total Number of Schedules in this Policy - -| API | Endpoint | Metric | Template | -|--------|----------|--------|---------| -| REST | `api/private/cli/volume/snapshot/policy` | `total_schedules` | conf/rest/9.12.0/snapshotpolicy.yaml | -| ZAPI | `snapshot-policy-get-iter` | `snapshot-policy-info.total-schedules` | conf/zapi/cdot/9.8.0/snapshotpolicy.yaml | - - ### svm_cifs_connections Number of connections diff --git a/docs/prepare-cdot-clusters.md b/docs/prepare-cdot-clusters.md index cc74ff16e..a91ca02f4 100644 --- a/docs/prepare-cdot-clusters.md +++ b/docs/prepare-cdot-clusters.md @@ -208,6 +208,7 @@ security login rest-role create -role harvest2-rest-role -access readonly -api / security login rest-role create -role harvest-rest-role -access readonly -api /api/storage/qos/workloads security login rest-role create -role harvest-rest-role -access readonly -api /api/storage/quota/reports security login rest-role create -role harvest-rest-role -access readonly -api /api/storage/shelves + security login rest-role create -role harvest-rest-role -access readonly -api /api/storage/snapshot-policies security login rest-role create -role harvest-rest-role -access readonly -api /api/storage/volumes security login rest-role create -role harvest-rest-role -access readonly -api /api/support/auto-update security login rest-role create -role harvest-rest-role -access readonly -api /api/support/autosupport @@ -235,7 +236,6 @@ security login rest-role create -role harvest2-rest-role -access readonly -api / security login rest-role create -role harvest-rest-role -access readonly -api /api/private/cli/qos/workload security login rest-role create -role harvest-rest-role -access readonly -api /api/private/cli/qtree security login rest-role create -role harvest-rest-role -access readonly -api /api/private/cli/snapmirror - security login rest-role create -role harvest-rest-role -access readonly -api /api/private/cli/volume/snapshot/policy security login rest-role create -role harvest-rest-role -access readonly -api /api/private/cli/storage/failover security login rest-role create -role harvest-rest-role -access readonly -api /api/private/cli/storage/shelf security login rest-role create -role harvest-rest-role -access readonly -api /api/private/cli/system/chassis/fru diff --git a/grafana/dashboards/cmode/data_protection_snapshot.json b/grafana/dashboards/cmode/data_protection.json similarity index 92% rename from grafana/dashboards/cmode/data_protection_snapshot.json rename to grafana/dashboards/cmode/data_protection.json index 1cd6ff0cd..701bb5e3a 100644 --- a/grafana/dashboards/cmode/data_protection_snapshot.json +++ b/grafana/dashboards/cmode/data_protection.json @@ -183,7 +183,7 @@ "targets": [ { "exemplar": false, - "expr": "count(volume_labels{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\",snapshot_policy!=\"\", snapshot_policy!~\"none.*\", volume!~\"MDV.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_total_schedules{})) OR on() vector(0)", + "expr": "count(volume_labels{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\",snapshot_policy!=\"\", snapshot_policy!~\"none.*\", volume!~\"MDV.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_labels{})) OR on() vector(0)", "instant": true, "interval": "", "legendFormat": "Volumes protected", @@ -191,7 +191,7 @@ }, { "exemplar": false, - "expr": "count((volume_labels{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\",snapshot_policy=~\"none.*\", volume!~\"MDV.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_total_schedules{}))) OR on() vector(0)", + "expr": "count((volume_labels{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\",snapshot_policy=~\"none.*\", volume!~\"MDV.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_labels{}))) OR on() vector(0)", "hide": false, "instant": true, "interval": "", @@ -253,7 +253,7 @@ "targets": [ { "exemplar": false, - "expr": "count(volume_labels{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\", snapshot_policy!=\"\", snapshot_policy!~\"none.*\", volume!~\"MDV.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_total_schedules{})) OR on() vector(0)", + "expr": "count(volume_labels{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\", snapshot_policy!=\"\", snapshot_policy!~\"none.*\", volume!~\"MDV.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_labels{})) OR on() vector(0)", "format": "time_series", "hide": false, "instant": true, @@ -349,7 +349,7 @@ "targets": [ { "exemplar": false, - "expr": "count(volume_labels{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\",snapshot_policy!=\"\", snapshot_policy!~\"none.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_total_schedules{}) * on (volume, svm, cluster) group_right() ( volume_snapshot_reserve_size{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} >= 0 and volume_snapshots_size_used{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} >= 0 and volume_snapshots_size_used{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} > volume_snapshot_reserve_size{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"})) OR on() vector(0)", + "expr": "count(volume_labels{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\",snapshot_policy!=\"\", snapshot_policy!~\"none.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_labels{}) * on (volume, svm, cluster) group_right() ( volume_snapshot_reserve_size{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} >= 0 and volume_snapshots_size_used{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} >= 0 and volume_snapshots_size_used{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} > volume_snapshot_reserve_size{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"})) OR on() vector(0)", "instant": true, "interval": "", "legendFormat": "Volumes breached", @@ -357,7 +357,7 @@ }, { "exemplar": false, - "expr": "(count((volume_labels{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\",snapshot_policy!=\"\", snapshot_policy!~\"none.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_total_schedules{})) * on (volume, svm, cluster) group_right() (volume_snapshot_reserve_size{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} >= 0 and volume_snapshots_size_used{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} >= 0 and volume_snapshots_size_used{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} <= volume_snapshot_reserve_size{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"})) OR on() vector(0)) + (count(volume_labels{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\",snapshot_policy!=\"\", snapshot_policy!~\"none.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_total_schedules{}) * on (volume, svm, cluster) group_right() ( volume_snapshot_reserve_size{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} >= 0 and volume_snapshots_size_used{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} == 0)) OR on() vector(0))", + "expr": "(count((volume_labels{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\",snapshot_policy!=\"\", snapshot_policy!~\"none.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_labels{})) * on (volume, svm, cluster) group_right() (volume_snapshot_reserve_size{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} >= 0 and volume_snapshots_size_used{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} >= 0 and volume_snapshots_size_used{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} <= volume_snapshot_reserve_size{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"})) OR on() vector(0)) + (count(volume_labels{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\",snapshot_policy!=\"\", snapshot_policy!~\"none.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_labels{}) * on (volume, svm, cluster) group_right() ( volume_snapshot_reserve_size{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} >= 0 and volume_snapshots_size_used{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} == 0)) OR on() vector(0))", "instant": true, "interval": "", "legendFormat": "Volumes not breached", @@ -418,7 +418,7 @@ "targets": [ { "exemplar": false, - "expr": "count(volume_labels{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\", snapshot_policy!=\"\", snapshot_policy!~\"none.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_total_schedules{}) * on (volume, svm, cluster) group_right() ( volume_snapshot_reserve_size{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} >= 0 and volume_snapshots_size_used{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} >= 0 and volume_snapshots_size_used{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} > volume_snapshot_reserve_size{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"})) OR on() vector(0)", + "expr": "count(volume_labels{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\", snapshot_policy!=\"\", snapshot_policy!~\"none.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_labels{}) * on (volume, svm, cluster) group_right() ( volume_snapshot_reserve_size{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} >= 0 and volume_snapshots_size_used{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} >= 0 and volume_snapshots_size_used{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} > volume_snapshot_reserve_size{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"})) OR on() vector(0)", "format": "time_series", "hide": false, "instant": true, @@ -492,7 +492,7 @@ "targets": [ { "exemplar": false, - "expr": "count((volume_labels{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\",snapshot_policy=~\"none.*\", volume!~\"MDV.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_total_schedules{}))) OR on() vector(0)", + "expr": "count((volume_labels{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\",snapshot_policy=~\"none.*\", volume!~\"MDV.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_labels{}))) OR on() vector(0)", "format": "time_series", "hide": false, "instant": true, @@ -566,7 +566,7 @@ "targets": [ { "exemplar": false, - "expr": "(count((volume_labels{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\", snapshot_policy!=\"\", snapshot_policy!~\"none.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_total_schedules{})) * on (volume, svm, cluster) group_right() (volume_snapshot_reserve_size{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} > 0 and volume_snapshots_size_used{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} > 0 and volume_snapshots_size_used{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} <= volume_snapshot_reserve_size{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"})) OR on() vector(0)) + (count(volume_labels{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\",snapshot_policy!=\"\", snapshot_policy!~\"none.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_total_schedules{}) * on (volume, svm, cluster) group_right() ( volume_snapshot_reserve_size{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} >= 0 and volume_snapshots_size_used{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} == 0)) OR on() vector(0))", + "expr": "(count((volume_labels{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\", snapshot_policy!=\"\", snapshot_policy!~\"none.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_labels{})) * on (volume, svm, cluster) group_right() (volume_snapshot_reserve_size{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} > 0 and volume_snapshots_size_used{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} > 0 and volume_snapshots_size_used{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} <= volume_snapshot_reserve_size{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"})) OR on() vector(0)) + (count(volume_labels{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\",snapshot_policy!=\"\", snapshot_policy!~\"none.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_labels{}) * on (volume, svm, cluster) group_right() ( volume_snapshot_reserve_size{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} >= 0 and volume_snapshots_size_used{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} == 0)) OR on() vector(0))", "format": "time_series", "hide": false, "instant": true, @@ -713,7 +713,7 @@ "targets": [ { "exemplar": false, - "expr": "label_replace(label_replace(volume_labels{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\", snapshot_policy!=\"\", volume!~\"MDV.*\"}, \"Status\", \"Protected\", \"snapshot_policy\", \"(.*)\") , \"Status\", \"Unprotected\", \"snapshot_policy\", \"(none.*)\") * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_total_schedules{})", + "expr": "label_replace(label_replace(volume_labels{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\", snapshot_policy!=\"\", volume!~\"MDV.*\"}, \"Status\", \"Protected\", \"snapshot_policy\", \"(.*)\") , \"Status\", \"Unprotected\", \"snapshot_policy\", \"(none.*)\") * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_labels{})", "format": "table", "instant": true, "interval": "", @@ -934,7 +934,7 @@ "targets": [ { "exemplar": false, - "expr": "volume_labels{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\", snapshot_policy!=\"\", snapshot_policy!~\"none.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_total_schedules{}) * on (volume, svm, cluster) group_right() ( volume_snapshot_reserve_size{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} >= 0 and volume_snapshots_size_used{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} >= 0)", + "expr": "volume_labels{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\", snapshot_policy!=\"\", snapshot_policy!~\"none.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_labels{}) * on (volume, svm, cluster) group_right() ( volume_snapshot_reserve_size{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} >= 0 and volume_snapshots_size_used{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} >= 0)", "format": "table", "hide": false, "instant": true, @@ -1093,7 +1093,7 @@ "targets": [ { "exemplar": false, - "expr": "count((volume_labels{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\",snapshot_policy!=\"\", snapshot_policy!~\"none.*\", volume!~\"MDV.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_total_schedules{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"})) * on (volume,svm,cluster) (volume_snapshot_count{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"} > 0 and volume_snapshot_count{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"} < 10)) OR on() vector(0)", + "expr": "count((volume_labels{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\",snapshot_policy!=\"\", snapshot_policy!~\"none.*\", volume!~\"MDV.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_labels{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"})) * on (volume,svm,cluster) (volume_snapshot_count{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"} > 0 and volume_snapshot_count{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"} < 10)) OR on() vector(0)", "format": "time_series", "hide": false, "instant": true, @@ -1156,7 +1156,7 @@ "targets": [ { "exemplar": false, - "expr": "count((volume_labels{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\",snapshot_policy!=\"\", snapshot_policy!~\"none.*\", volume!~\"MDV.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_total_schedules{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"})) * on (volume,svm,cluster) (volume_snapshot_count{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"} >= 10 and volume_snapshot_count{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"} <= 100)) OR on() vector(0)", + "expr": "count((volume_labels{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\",snapshot_policy!=\"\", snapshot_policy!~\"none.*\", volume!~\"MDV.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_labels{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"})) * on (volume,svm,cluster) (volume_snapshot_count{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"} >= 10 and volume_snapshot_count{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"} <= 100)) OR on() vector(0)", "format": "time_series", "hide": false, "instant": true, @@ -1219,7 +1219,7 @@ "targets": [ { "exemplar": false, - "expr": "count((volume_labels{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\",snapshot_policy!=\"\", snapshot_policy!~\"none.*\", volume!~\"MDV.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_total_schedules{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"})) * on (volume,svm,cluster) (volume_snapshot_count{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"} > 100 and volume_snapshot_count{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"} <= 500)) OR on() vector(0)", + "expr": "count((volume_labels{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\",snapshot_policy!=\"\", snapshot_policy!~\"none.*\", volume!~\"MDV.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_labels{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"})) * on (volume,svm,cluster) (volume_snapshot_count{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"} > 100 and volume_snapshot_count{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"} <= 500)) OR on() vector(0)", "format": "time_series", "hide": false, "instant": true, @@ -1282,7 +1282,7 @@ "targets": [ { "exemplar": false, - "expr": "count((volume_labels{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\",snapshot_policy!=\"\", snapshot_policy!~\"none.*\", volume!~\"MDV.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_total_schedules{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"})) * on (volume,svm,cluster) (volume_snapshot_count{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"} > 500)) OR on() vector(0)", + "expr": "count((volume_labels{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\",snapshot_policy!=\"\", snapshot_policy!~\"none.*\", volume!~\"MDV.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_labels{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"})) * on (volume,svm,cluster) (volume_snapshot_count{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"} > 500)) OR on() vector(0)", "format": "time_series", "hide": false, "instant": true, @@ -1504,7 +1504,7 @@ "targets": [ { "exemplar": false, - "expr": "(volume_labels{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\",snapshot_policy!=\"\", snapshot_policy!~\"none.*\", volume!~\"MDV.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_total_schedules{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"})) * on (volume,svm,cluster) (volume_snapshot_count{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"} > 0)", + "expr": "(volume_labels{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\",snapshot_policy!=\"\", snapshot_policy!~\"none.*\", volume!~\"MDV.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_labels{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"})) * on (volume,svm,cluster) (volume_snapshot_count{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"} > 0)", "format": "table", "instant": true, "interval": "", @@ -1599,7 +1599,7 @@ }, "gridPos": { "h": 5, - "w": 5, + "w": 8, "x": 0, "y": 3 }, @@ -1666,8 +1666,8 @@ }, "gridPos": { "h": 5, - "w": 5, - "x": 5, + "w": 8, + "x": 8, "y": 3 }, "id": 105, @@ -1733,8 +1733,8 @@ }, "gridPos": { "h": 5, - "w": 5, - "x": 10, + "w": 8, + "x": 16, "y": 3 }, "id": 106, @@ -1885,6 +1885,16 @@ } }, "type": "value" + }, + { + "options": { + "match": "empty", + "result": { + "index": 2, + "text": "Not Supported" + } + }, + "type": "special" } ] } @@ -1913,6 +1923,16 @@ } }, "type": "value" + }, + { + "options": { + "match": "empty", + "result": { + "index": 2, + "text": "Not Supported" + } + }, + "type": "special" } ] }, @@ -1945,6 +1965,16 @@ } }, "type": "value" + }, + { + "options": { + "match": "empty", + "result": { + "index": 2, + "text": "Not Supported" + } + }, + "type": "special" } ] }, @@ -1977,6 +2007,16 @@ } }, "type": "value" + }, + { + "options": { + "match": "empty", + "result": { + "index": 2, + "text": "Not Supported" + } + }, + "type": "special" } ] }, @@ -2332,7 +2372,12 @@ "show": false }, "showHeader": true, - "sortBy": [] + "sortBy": [ + { + "desc": false, + "displayName": "Name" + } + ] }, "pluginVersion": "8.4.11", "targets": [ @@ -2597,7 +2642,12 @@ "show": false }, "showHeader": true, - "sortBy": [] + "sortBy": [ + { + "desc": false, + "displayName": "Status" + } + ] }, "pluginVersion": "8.4.11", "targets": [ @@ -3013,7 +3063,7 @@ ] }, "timezone": "", - "title": "ONTAP: Data Protection Snapshots", - "uid": "cdot-data-protection-snapshots", - "version": 2 + "title": "ONTAP: Data Protection", + "uid": "cdot-data-protection", + "version": 3 } diff --git a/grafana/dashboards/cmode/datacenter.json b/grafana/dashboards/cmode/datacenter.json index 2c4d60d57..f6a793bc4 100644 --- a/grafana/dashboards/cmode/datacenter.json +++ b/grafana/dashboards/cmode/datacenter.json @@ -2980,7 +2980,7 @@ "targets": [ { "exemplar": false, - "expr": "count(volume_labels{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\",snapshot_policy!=\"\", snapshot_policy!~\"none.*\", volume!~\"MDV.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_total_schedules{})) OR on() vector(0)", + "expr": "count(volume_labels{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\",snapshot_policy!=\"\", snapshot_policy!~\"none.*\", volume!~\"MDV.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_labels{})) OR on() vector(0)", "instant": true, "interval": "", "legendFormat": "Volumes protected", @@ -2988,7 +2988,7 @@ }, { "exemplar": false, - "expr": "count((volume_labels{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\",snapshot_policy=~\"none.*\", volume!~\"MDV.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_total_schedules{}))) OR on() vector(0)", + "expr": "count((volume_labels{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\",snapshot_policy=~\"none.*\", volume!~\"MDV.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_labels{}))) OR on() vector(0)", "hide": false, "instant": true, "interval": "", @@ -3083,7 +3083,7 @@ "targets": [ { "exemplar": false, - "expr": "count(volume_labels{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\",snapshot_policy!=\"\", snapshot_policy!~\"none.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_total_schedules{}) * on (volume, svm, cluster) group_right() ( volume_snapshot_reserve_size{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} >= 0 and volume_snapshots_size_used{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} >= 0 and volume_snapshots_size_used{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} > volume_snapshot_reserve_size{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"})) OR on() vector(0)", + "expr": "count(volume_labels{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\",snapshot_policy!=\"\", snapshot_policy!~\"none.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_labels{}) * on (volume, svm, cluster) group_right() ( volume_snapshot_reserve_size{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} >= 0 and volume_snapshots_size_used{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} >= 0 and volume_snapshots_size_used{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} > volume_snapshot_reserve_size{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"})) OR on() vector(0)", "instant": true, "interval": "", "legendFormat": "Volumes breached", @@ -3091,7 +3091,7 @@ }, { "exemplar": false, - "expr": "(count((volume_labels{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\",snapshot_policy!=\"\", snapshot_policy!~\"none.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_total_schedules{})) * on (volume, svm, cluster) group_right() (volume_snapshot_reserve_size{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} >= 0 and volume_snapshots_size_used{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} >= 0 and volume_snapshots_size_used{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} <= volume_snapshot_reserve_size{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"})) OR on() vector(0)) + (count(volume_labels{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\",snapshot_policy!=\"\", snapshot_policy!~\"none.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_total_schedules{}) * on (volume, svm, cluster) group_right() ( volume_snapshot_reserve_size{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} >= 0 and volume_snapshots_size_used{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} == 0)) OR on() vector(0))", + "expr": "(count((volume_labels{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\",snapshot_policy!=\"\", snapshot_policy!~\"none.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_labels{})) * on (volume, svm, cluster) group_right() (volume_snapshot_reserve_size{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} >= 0 and volume_snapshots_size_used{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} >= 0 and volume_snapshots_size_used{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} <= volume_snapshot_reserve_size{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"})) OR on() vector(0)) + (count(volume_labels{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\",snapshot_policy!=\"\", snapshot_policy!~\"none.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_labels{}) * on (volume, svm, cluster) group_right() ( volume_snapshot_reserve_size{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} >= 0 and volume_snapshots_size_used{datacenter=~\"$Datacenter\", cluster=~\"$Cluster\"} == 0)) OR on() vector(0))", "instant": true, "interval": "", "legendFormat": "Volumes not breached", @@ -3185,7 +3185,7 @@ "targets": [ { "exemplar": false, - "expr": "count((volume_labels{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\",snapshot_policy!=\"\", snapshot_policy!~\"none.*\", volume!~\"MDV.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_total_schedules{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"})) * on (volume,svm,cluster) (volume_snapshot_count{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"} > 0 and volume_snapshot_count{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"} < 10)) OR on() vector(0)", + "expr": "count((volume_labels{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\",snapshot_policy!=\"\", snapshot_policy!~\"none.*\", volume!~\"MDV.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_labels{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"})) * on (volume,svm,cluster) (volume_snapshot_count{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"} > 0 and volume_snapshot_count{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"} < 10)) OR on() vector(0)", "instant": true, "interval": "", "legendFormat": " <10 Copies ", @@ -3193,7 +3193,7 @@ }, { "exemplar": false, - "expr": "count((volume_labels{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\",snapshot_policy!=\"\", snapshot_policy!~\"none.*\", volume!~\"MDV.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_total_schedules{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"})) * on (volume,svm,cluster) (volume_snapshot_count{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"} >= 10 and volume_snapshot_count{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"} <= 100)) OR on() vector(0)", + "expr": "count((volume_labels{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\",snapshot_policy!=\"\", snapshot_policy!~\"none.*\", volume!~\"MDV.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_labels{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"})) * on (volume,svm,cluster) (volume_snapshot_count{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"} >= 10 and volume_snapshot_count{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"} <= 100)) OR on() vector(0)", "instant": true, "interval": "", "legendFormat": "10-100 Copies", @@ -3201,7 +3201,7 @@ }, { "exemplar": false, - "expr": "count((volume_labels{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\",snapshot_policy!=\"\", snapshot_policy!~\"none.*\", volume!~\"MDV.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_total_schedules{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"})) * on (volume,svm,cluster) (volume_snapshot_count{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"} > 100 and volume_snapshot_count{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"} <= 500)) OR on() vector(0)", + "expr": "count((volume_labels{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\",snapshot_policy!=\"\", snapshot_policy!~\"none.*\", volume!~\"MDV.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_labels{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"})) * on (volume,svm,cluster) (volume_snapshot_count{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"} > 100 and volume_snapshot_count{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"} <= 500)) OR on() vector(0)", "hide": false, "instant": true, "interval": "", @@ -3210,7 +3210,7 @@ }, { "exemplar": false, - "expr": "count((volume_labels{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\",snapshot_policy!=\"\", snapshot_policy!~\"none.*\", volume!~\"MDV.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_total_schedules{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"})) * on (volume,svm,cluster) (volume_snapshot_count{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"} > 500)) OR on() vector(0)", + "expr": "count((volume_labels{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\",snapshot_policy!=\"\", snapshot_policy!~\"none.*\", volume!~\"MDV.*\"} * on (snapshot_policy) group_left () group by (snapshot_policy) (snapshot_policy_labels{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"})) * on (volume,svm,cluster) (volume_snapshot_count{datacenter=~\"$Datacenter\",cluster=~\"$Cluster\"} > 500)) OR on() vector(0)", "hide": false, "instant": true, "interval": "", diff --git a/integration/test/dashboard_json_test.go b/integration/test/dashboard_json_test.go index fe23a2237..0f9c6222d 100644 --- a/integration/test/dashboard_json_test.go +++ b/integration/test/dashboard_json_test.go @@ -57,7 +57,7 @@ var restCounterMap = map[string]struct{}{ "aggr_snapshot_inode_used_percent": {}, "flexcache_": {}, "rw_ctx_": {}, - "snapshot_policy_total_schedules": {}, + "snapshot_policy_labels": {}, "support_labels": {}, }