Share via


Get-ServiceFabricReplicaHealth

Gets the health of a Service Fabric replica.

Syntax

Default (Default)

Get-ServiceFabricReplicaHealth
    [-PartitionId] <Guid>
    [-ReplicaOrInstanceId] <Int64>
    [-ConsiderWarningAsError <Boolean>]
    [-EventsHealthStateFilter <Int64>]
    [-EventsFilter <HealthStateFilter>]
    [-TimeoutSec <Int32>]
    [<CommonParameters>]

Description

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

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: Query the health of a service replica

PS C:\> $ToDoPartition01 = Get-ServiceFabricPartition -ServiceName fabric:/myapp/persistenttodolist/svc1PS
PS C:\> $ToDoPartition01ReplicaList = Get-ServiceFabricReplica -PartitionId $ToDoPartition01.PartitionId
PS C:\> Get-ServiceFabricReplicaHealth -PartitionId $ToDoPartition01.PartitionId -ReplicaOrInstanceId $ToDoPartition01ReplicaList[0].Id

The first command uses the Get-ServiceFabricPartition cmdlet to get a Service Fabric service partition object, and then stores it in the $ToDoPartition01 variable.

The second command gets the list of replicas in the partition, and then stores it in the $ToDoPartition01ReplicaList variable.

The third command gets the health of a service partition replica by using the PartitionID property of the partition object stored in $ToDoPartition01 and the ID of the first replica in $ToDoPartition01ReplicaList.

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

PS C:\> $ReplicaList = Get-ServiceFabricPartition -ServiceName fabric:/myapp/persistenttodolist/svc1PS | Get-ServiceFabricReplica
PS C:\> Get-ServiceFabricReplicaHealth -PartitionId $ReplicaList[0].PartitionId -ReplicaOrInstanceId $ReplicaList[0].ReplicaId -ConsiderWarningAsError $True -EventsFilter Error

This example queries the health of the service replica. It specifies values for health policy. It uses filters to return only Error events.

Example 3: Get the health of all replicas of all partitions of all services in an application

PS C:\> Get-ServiceFabricApplication -ApplicationName fabric:/MyApplication | Get-ServiceFabricService | Get-ServiceFabricPartition | Get-ServiceFabricReplica | Get-ServiceFabricReplicaHealth

This example gets the health of all service replicas in the specified application.

Parameters

-ConsiderWarningAsError

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

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-EventsFilter

Specifies the filter for the collection of HealthEvent reported on the entity 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 aggregated health state. If not specified, all entries are returned.

Parameter properties

Type:HealthStateFilter
Default value:None
Accepted values:Default, None, Ok, Warning, Error, All
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-EventsHealthStateFilter

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

Parameter properties

Type:Int64
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PartitionId

Specifies the ID of a Service Fabric partition.

Parameter properties

Type:Guid
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ReplicaOrInstanceId

Specifies a Service Fabric stateful service replica or stateless service instance ID.

Parameter properties

Type:Int64
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-TimeoutSec

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

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

System.Guid

System.Int64

Outputs

System.Object