Pyvmomi How to disable/enable vsan silent checks

138 views Asked by At

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

2

There are 2 answers

0
Progs On BEST ANSWER

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

0
Freeman On

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)