The transition to NetApp MS Azure AD B2C is complete. If you missed the pre-registration, you will be invited to reigister at next log in.
Please note that access to your NetApp data may take up to 1 hour.
To learn more, read the FAQ and watch the video.
Need assistance? Complete this form and select “Registration Issue” as the Feedback Category.

Active IQ Unified Manager Discussions

WFA Mysql query statement to list snapshot policies in a cluster

krishgudd

Hi,

 

I am looking for WFA mysql query statement to list the snapshot policies in a cluster/vserver. Can someone help me on this.

 

Thanks in Advance,

Krishgudd

 

 

 

1 ACCEPTED SOLUTION

MattInCO

 

@krishgudd

 

This is what I came up with real quick. I listed a few extra attributes in here, which may or may not be helpful, and in this case a cluster needs to be defined via another variable. Under “SVM” it will show the cluster name if it is a cluster-defined snapshot policy, or the SVM name if it is an SVM-defined snapshot policy. I’m not a MySQL query expert by any stretch, so this could probably be cleaner, but it looks to work. I hope this points you in the right direction, at least.

 

 

SELECT
     snapshot_policy.name AS 'Snapshot Policy',
     schedule.name AS 'Schedule name',
     snapshot_policy_schedule.snapshot_count AS 'Snapshots to Retain',
     vserver.name AS 'SVM'
FROM
     cm_storage.cluster,
     cm_storage.vserver,
     cm_storage.snapshot_policy,
     cm_storage.snapshot_policy_schedule,
     cm_storage.schedule
WHERE
     vserver.cluster_id = cluster.id
     AND snapshot_policy.vserver_id = vserver.id
     AND snapshot_policy_schedule.snapshot_policy_id = snapshot_policy.id
     AND snapshot_policy_schedule.schedule_id = schedule.id
     AND cluster.name = '${cluster}'
ORDER BY
    snapshot_policy.name,
    snapshot_policy_schedule.snapshot_count,
    schedule.name,
    vserver.name

 

View solution in original post

2 REPLIES 2

mbeattie

Hi,

 

Does this work for you?

 

SELECT
    snapshot_policy.name,
    vserver.name AS 'vserver.name',
    cluster.primary_address AS 'vserver.cluster.primary_address'
FROM
    cm_storage.snapshot_policy,
    cm_storage.vserver,
    cm_storage.cluster
WHERE
    snapshot_policy.vserver_id = vserver.id
AND
    vserver.cluster_id = cluster.id
AND
    vserver.name =  '${VserverName}'
AND (
    cluster.name = '${ClusterName}'
    OR cluster.primary_address = '${ClusterName}'
)

That should list all the snapshot policies assigned to a cluster\vserver. Alternately if you want to filter to a specific snapshot policy name then change the AND clause to add the policy name

 

AND
    vserver.cluster_id = cluster.id
AND
    vserver.name =  '${VserverName}'
AND
    snapshot_policy.name = '${SnapShotPolicyName}'
AND (
    cluster.name = '${ClusterName}'
    OR cluster.primary_address = '${ClusterName}'
)

Hope that helps

 

/Matt

 

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

MattInCO

 

@krishgudd

 

This is what I came up with real quick. I listed a few extra attributes in here, which may or may not be helpful, and in this case a cluster needs to be defined via another variable. Under “SVM” it will show the cluster name if it is a cluster-defined snapshot policy, or the SVM name if it is an SVM-defined snapshot policy. I’m not a MySQL query expert by any stretch, so this could probably be cleaner, but it looks to work. I hope this points you in the right direction, at least.

 

 

SELECT
     snapshot_policy.name AS 'Snapshot Policy',
     schedule.name AS 'Schedule name',
     snapshot_policy_schedule.snapshot_count AS 'Snapshots to Retain',
     vserver.name AS 'SVM'
FROM
     cm_storage.cluster,
     cm_storage.vserver,
     cm_storage.snapshot_policy,
     cm_storage.snapshot_policy_schedule,
     cm_storage.schedule
WHERE
     vserver.cluster_id = cluster.id
     AND snapshot_policy.vserver_id = vserver.id
     AND snapshot_policy_schedule.snapshot_policy_id = snapshot_policy.id
     AND snapshot_policy_schedule.schedule_id = schedule.id
     AND cluster.name = '${cluster}'
ORDER BY
    snapshot_policy.name,
    snapshot_policy_schedule.snapshot_count,
    schedule.name,
    vserver.name

 

View solution in original post

Announcements
NetApp on Discord Image

We're on Discord, are you?

Live Chat, Watch Parties, and More!

Explore Banner

Meet Explore, NetApp’s digital sales platform

Engage digitally throughout the sales process, from product discovery to configuration, and handle all your post-purchase needs.

NetApp Insights to Action
I2A Banner
Public