VMware Cloud Community
VicMware
Contributor
Contributor

changing statistics level and datastore heartbeat

Hi

Is there a way of change statistics level using Powercli?

Capture.PNG

and is it possible to set heartbeat datastores using Powercli?

1.PNG

0 Kudos
1 Reply
LucD
Leadership
Leadership

To change the statistics level for a specific interval you can do something like this

$tgtInterval = "Past week"
$tgtLevel = 3

$si = Get-View ServiceInstance
$perfMgr = Get-View $si.Content.PerfManager

$perfInterval = $perfMgr.HistoricalInterval | where {$_.Name -eq $tgtInterval}
$perfInterval.Level = $tgtLevel

$perfMgr.UpdatePerfInterval($perfInterval)

The datastore heartbeat can be configured like this

$clusterName = "MyCluster"
$preferredDatastore = "DS1","DS2"

$cluster = Get-Cluster -Name $clusterName
$dsMoRef = Get-Datastore -Name $preferredDatastore | %{$_.ExtensionData.MoRef}

$spec = New-Object VMware.Vim.ClusterConfigSpec
$spec.dasConfig = New-Object VMware.Vim.ClusterDasConfigInfo
$spec.dasConfig.hBDatastoreCandidatePolicy = "allFeasibleDsWithUserPreference"
$spec.dasConfig.heartbeatDatastore = $dsMoRef

$cluster.ExtensionData.ReconfigureCluster($spec,$true)

PS: next time, can you create 2 separate threads for 2 questions?

It makes it easier for others to find a thread


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos