Get-ServiceFabricReplicaHealth
Gets the health of a Service Fabric replica.
Syntax
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.
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 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.
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 |
-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 |
-ReplicaOrInstanceId
Specifies a Service Fabric stateful service replica or stateless service instance ID.
Type: | Int64 |
Position: | 1 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
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
System.Int64
Outputs
System.Object