Get-ServiceFabricPartitionHealth

Gets the health of a Service Fabric partition.

Syntax

Get-ServiceFabricPartitionHealth
   [-PartitionId] <Guid>
   [-ConsiderWarningAsError <Boolean>]
   [-MaxPercentUnhealthyReplicasPerPartition <Byte>]
   [-EventsHealthStateFilter <Int64>]
   [-EventsFilter <HealthStateFilter>]
   [-ReplicasHealthStateFilter <Int64>]
   [-ReplicasFilter <HealthStateFilter>]
   [-ExcludeHealthStatistics]
   [-TimeoutSec <Int32>]
   [<CommonParameters>]

Description

The Get-ServiceFabricPartitionHealth cmdlet gets the health of a Service Fabric partition. If you specify a partition that does not exist in the health store, this cmdlet returns an error.

Before you perform any operation on a Service Fabric cluster, establish a connection to the cluster by using the Connect-ServiceFabricCluster cmdlet.

Examples

Example 1: Get the health events for of a service partition

PS C:\> $ToDoPartition01 = Get-ServiceFabricPartition -ServiceName fabric:/myapp/persistenttodolist/svc1PS
PS C:\> Get-ServiceFabricPartitionHealth -PartitionId $ToDoPartition01.PartitionId

The first command uses the Get-ServiceFabricPartition cmdlet to get the singleton service partition object for the specified service, and then stores the object in the $ToDoPartition01 variable.

The second command gets the health of the partition by using the PartitionId property of the object stored in $ToDoPartition01.

Example 2: Query the health of a service partition using custom health policy and return filters

PS C:\> Get-ServiceFabricPartition -ServiceName fabric:/myapp/persistenttodolist/svc1PS | Get-ServiceFabricPartitionHealth -ConsiderWarningAsError $True -EventsFilter Error

This command queries the health of the partitions of the specified service. It uses custom health policy and filter to return only Error events.

Parameters

-ConsiderWarningAsError

Indicates whether to treat a warning health report as error during health evaluation.

Type:Boolean
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-EventsFilter

Specifies the filter for the collection of HealthEvents reported on the partition based on health state. The value can be obtained from members or bitwise operations on members of HealthStateFilter. Only events that match the filter are returned. All events are used to evaluate the partition's aggregated health state. If not specified, all entries are returned.

Type:HealthStateFilter
Accepted values:Default, None, Ok, Warning, Error, All
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-EventsHealthStateFilter

This parameter has been deprecated. Specify the EventsFilter parameter instead.

Type:Int64
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ExcludeHealthStatistics

Indicates whether the health statistics should be included in the query result. If specified, the health statistics are not returned as part of the query result. Otherwise, the query result includes the partition health statistics, which contain information about how many replicas are in Ok, Warning, and Error states.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-MaxPercentUnhealthyReplicasPerPartition

Specifies the maximum tolerated percentage of unhealthy replicas in a partition. If there are more replicas with a health state error than tolerated, the health state of the partition is error.

Type:Byte
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-PartitionId

Specifies the ID of a Service Fabric partition.

Type:Guid
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-ReplicasFilter

Specifies the filter for ReplicaHealthState children based on health state. The value can be obtained from members or bitwise operations on members of HealthStateFilter. Only children that match the filter are returned. All children are used to evaluate the entity aggregated health state. If not specified, all entries are returned.

Type:HealthStateFilter
Accepted values:Default, None, Ok, Warning, Error, All
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ReplicasHealthStateFilter

This parameter has been deprecated. Specify the ReplicasFilter parameter instead.

Type:Int64
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-TimeoutSec

Specifies the time-out period, in seconds, for the operation.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

System.Guid

Outputs

System.Object