Get-ServiceFabricServiceHealth

Gets the health of a Service Fabric service.

Syntax

Get-ServiceFabricServiceHealth
   [-ServiceName] <Uri>
   [-ConsiderWarningAsError <Boolean>]
   [-MaxPercentUnhealthyPartitionsPerService <Byte>]
   [-MaxPercentUnhealthyReplicasPerPartition <Byte>]
   [-EventsHealthStateFilter <Int64>]
   [-EventsFilter <HealthStateFilter>]
   [-PartitionsHealthStateFilter <Int64>]
   [-PartitionsFilter <HealthStateFilter>]
   [-ExcludeHealthStatistics]
   [-TimeoutSec <Int32>]
   [<CommonParameters>]

Description

The Get-ServiceFabricServiceHealth cmdlet gets the health of a Service Fabric service. If you specify a service that 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

PS C:\> Get-ServiceFabricServiceHealth -ServiceName fabric:/myapp/persistenttodolist/svc1

This command gets the health of the specified service.

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

PS C:\> Get-ServiceFabricServiceHealth -ServiceName fabric:/myapp/persistenttodolist/svc1 -ConsiderWarningAsError $True -EventsFilter Error -PartitionsFilter 'Warning,Error'

This command queries the health of the specified service. It provides values for health policy. It uses filters to return only Error events, and children with Error or Warning health states.

Example 3: Query the health of a service and exclude the health statistics

PS C:\> Get-ServiceFabricServiceHealth -ServiceName fabric:/myapp/persistenttodolist/svc1 -ExcludeHealthStatistics

This command gets the health of the specified service. The returned service health doesn't include the service health statistics.

Parameters

-ConsiderWarningAsError

Indicates whether to treat a warning health report as an 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

-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 service health statistics, which contain information about how many partitions and replicas of this service are in Ok, Warning, and Error states.

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

-MaxPercentUnhealthyPartitionsPerService

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

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

-MaxPercentUnhealthyReplicasPerPartition

Specifies the maximum tolerated percentage of unhealthy partition replicas. 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

-PartitionsFilter

Specifies the filter for PartitionHealthState 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

-PartitionsHealthStateFilter

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

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

-ServiceName

Specifies the URI of a Service Fabric service.

Type:Uri
Position:0
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.Uri

Outputs

System.Object