Progs
Progs

Reputation: 737

Pyvmomi How to disable/enable vsan silent checks

I've been reading the documentation for pyvmomi but it's not clear on how to use the function VsanHealthSetVsanClusterSilentChecks from the managed object vim.cluster.VsanVcClusterHealthSystem, it doesn't say how to initialize or how to instance the object or show any example on how to use it.

i have tried code like this:

vchs = vim.cluster.VsanVcClusterHealthSystem('vsan-cluster-health-system')
check = vchs.VsanHealthSetVsanClusterSilentChecks(cluster, None, alarm_list)

The code throws an exception but it's not very descriptive:

VsanVcClusterHealthSystem

and that is all from the exception error message.

Pyvmomi documentation for VsanHealthSetVsanClusterSilentChecks

Upvotes: -1

Views: 295

Answers (2)

Progs
Progs

Reputation: 737

Turns out that pyvmomi on it's own can't do that, i needed to use vSAN Management SDK for Python

Upvotes: -1

Freeman
Freeman

Reputation: 12748

I think you need to retrieve VsanVcClusterHealthSystem object from the content property of the service instance!

something like this :

from pyVim import connect

#don't forget to replace vcenter_server, username and password with yours
si = connect.SmartConnectNoSSL(host="vcenter_server", user="username", pwd="password")

#get the content property of the service instance
content = si.RetrieveContent()

#get the vSphere API root folder
root_folder = content.rootFolder

#get the cluster object by name and ensure that the cluster object is correctly obtained from the root folder
cluster = root_folder.childEntity[0]

#get the VsanVcClusterHealthSystem object from the cluster
vchs = cluster['vsan-cluster-health-system']

#calling the VsanHealthSetVsanClusterSilentChecks function
check = vchs.VsanHealthSetVsanClusterSilentChecks(cluster, None, alarm_list)

Upvotes: 0

Related Questions