#snapmirror labels not appearing in REST based snapmirror metrics

1 messages · Page 1 of 1 (latest)

grizzled hatch
#

I have been reviewing labels not produced compared to the ONTAPI counterparts and maybe my understanding of where the labels come from in REST vs ONTAPI.

Here's the snapmirror label metric from a ontapi based metric:

snapmirror_labels{derived_relationship_type="load_sharing",group_type="",healthy="true",last_transfer_error="",last_transfer_type="",local="true",policy_type="",protectedBy="",protectionSourceType="",relationship_status="idle",relationship_type="load_sharing",schedule="15min",unhealthy_reason="",policy="",mirror_state="snapmirrored",datacenter="HPC",cluster="node",destination_location="node://vservera/vservera_rootvol_m34_17b",destination_node="",destination_volume="vservera_rootvol_m34_17b",destination_vserver="vservera",relationship_id="",source_cluster="node",source_volume="vservera_rootvol",source_vserver="vservera"} 1.0

when I try and mimic this in REST, I get this:

snapmirror_labels{derived_relationship_type="load_sharing",destination_cg_name="",fl_healthy="true",group_type="",healthy="true",last_transfer_error="",last_transfer_type="",local="true",policy="",policy_type="",protectedBy="",protectionSourceType="",relationship_state="",relationship_status="idle",relationship_type="load_sharing",schedule="15min",source_cg_name="",state="",unhealthy_reason="",datacenter="HPC",cluster="node",destination_location="node://vservera/vservera_rootvol_m34_17b",destination_node="",destination_volume="vservera_rootvol_m34_17b",destination_vserver="vservera",relationship_id="",source_cluster="node",source_location="node://vservera/vservera_rootvol",source_volume="vservera_rootvol",source_vserver="vservera"} 1.0

While they look much the same, the part that is confusing me is the 'state' in the REST portion. mirror_state in the ONTAPI shows 'snapmirrored' and I expected the same from REST but that isn't being populated in the REST metric.

#

I am simply using the following code changes to try and mimic the same information with 'state' as that is called out as the REST value.

--- snapmirror.yaml 2026-03-04 10:31:42.000000000 -0800
+++ snapmirror_custom.yaml 2026-03-04 135038.767103458 -0800
@@ -46,10 +46,15 @@
- ^^uuid => relationship_id
- ^source.cluster.name => source_cluster
- ^state => relationship_state

  •  - ^policy.name                         => policy
     - ^unhealthy_reason.#.message          => last_transfer_error
    

plugins:

  • Snapmirror
    • LabelAgent:
  •  join:
    
  •      - state `` relationship_state
    

export_options:
instance_keys:
@@ -71,6 +76,7 @@
- last_transfer_error
- last_transfer_type
- local

    • policy
    • policy_type
    • protectedBy
    • protectionSourceType
      @@ -79,4 +85,5 @@
    • relationship_type
    • schedule
    • source_cg_name
    • state
    • unhealthy_reason

Both relationship_state and state are "", because I am simply duplicating relationship_state in the labelagent join.

I am not seeing any errors in the logs related to snapmirror, simply 'INFO:" about the collected metrics....

Confused.

#

in ONTAPI, my changes were:

name: SnapMirror
query: snapmirror-get-iter
object: snapmirror
counters:
snapmirror-info:
- ^policy
- ^mirror-state => mirror_state
plugins:
LabelAgent:
value_to_num:
- new_status healthy true up 0
export_options:
instance_labels:
- policy
- mirror_state

I had planned to use the standard label for REST and try and not deviate to 'mirror_state' as from ONTAPI....but it wouldn't matter as there is no data being collected in REST for these mirrors.

vestal hawk
#

@grizzled hatch If I understand correctly then, you have done custom changes in ontapi which is Zapi call of snapmirror-get-iter where you can get mirror_state properly and when you would be doing custom changes of rest which is Rest call of api/snapmirror/relationships where you are not getting mirror_state or state as expected.

If you would follow the default rest based snapmirror template https://github.com/NetApp/harvest/blob/main/conf/rest/9.12.0/snapmirror.yaml#L48, Here, attached screenshot of the same where relationship_state field is populated appropriately. You can apply your custom changes on top of this if you want any other extra customization.

You can also share your custom template to us via our email ng-harvest-files@netapp.com, so we can validate it.

grizzled hatch
#

I think you miss understood or maybe I misspoke. This works fine with normal volumes, where they are not LS types (Ie. XDP mirroring), but the Zapi call shows the LS volumes similar to XDP snapmirrors but REST does not populate the information for LS types under REST

#

Here's a working relationship that is showing the same data between ZAPI and REST, though these are of type 'extended_data_protection', the other I put above was type 'load_sharing'

ie:

Zapi:

netapp_snapmirror_labels{derived_relationship_type="mirror_vault",group_type="none",healthy="true",last_transfer_error="",last_transfer_type="update",local="",policy_type="mirror_vault",protectedBy="volume",protectionSourceType="volume",relationship_status="idle",relationship_type="extended_data_protection",schedule="sv_0510_1710",unhealthy_reason="",policy="vservera_vault_10_12hr_30d",mirror_state="snapmirrored",datacenter="HPC",cluster="node",destination_location="vservera:node2_myvolume_mirror_vault",destination_node="noden08b",destination_volume="node2_myvolume_mirror_vault",destination_vserver="vservera",relationship_id="fec2af15-133c-11f1-9a13-d039eab63bc1",source_cluster="node2",source_volume="myvolume",source_vserver="vserver2a"} 1.0

REST:

netapp_snapmirror_labels{derived_relationship_type="mirror_vault",destination_cg_name="",fl_healthy="true",group_type="none",healthy="true",last_transfer_error="",last_transfer_type="update",local="",policy="vservera_vault_10_12hr_30d",policy_type="mirror_vault",protectedBy="volume",protectionSourceType="volume",relationship_state="snapmirrored",relationship_status="idle",relationship_type="extended_data_protection",schedule="sv_0510_1710",source_cg_name="",state="snapmirrored",unhealthy_reason="",datacenter="HPC",cluster="node",destination_location="vservera:node2_myvolume_mirror_vault",destination_node="noden08b",destination_volume="node2_myvolume_mirror_vault",destination_vserver="vservera",relationship_id="fec2af15-133c-11f1-9a13-d039eab63bc1",source_cluster="node2",source_location="vserver2a:myvolume",source_volume="myvolume",source_vserver="vserver2a"} 1.0

#

so the difference is between load_sharing types not showing 'state' vs extended data protection types do.

vestal hawk
#

@grizzled hatch , Thanks for more detail.
Let me validate this locally and will update you accordingly.

vestal hawk
#

@grizzled hatch , Thanks for raising this.
There is a bug in Rest side for LS type of snapmirrors, Details are captured in PR with fix https://github.com/NetApp/harvest/pull/4182, changes would be under review. Will update as soon as it gets publish to nightly.

vestal hawk
grizzled hatch
#

so the gist of the change is to move state from the public to the private area?

#

that's an easy fix on my end

onyx parcel