Get-ServiceFabricClusterHealth

Gets health information for a Service Fabric cluster.

Syntax

Get-ServiceFabricClusterHealth
   [-ConsiderWarningAsError <Boolean>]
   [-MaxPercentUnhealthyApplications <Byte>]
   [-MaxPercentUnhealthyNodes <Byte>]
   [-EventsHealthStateFilter <Int64>]
   [-EventsFilter <HealthStateFilter>]
   [-ApplicationsHealthStateFilter <Int64>]
   [-ApplicationsFilter <HealthStateFilter>]
   [-NodesHealthStateFilter <Int64>]
   [-NodesFilter <HealthStateFilter>]
   [-ApplicationHealthPolicyMap <ApplicationHealthPolicyMap>]
   [-ApplicationTypeHealthPolicyMap <ApplicationTypeHealthPolicyMap>]
   [-NodeTypeHealthPolicyMap <NodeTypeHealthPolicyMap>]
   [-IncludeSystemApplicationHealthStatistics]
   [-TimeoutSec <Int32>]
   [<CommonParameters>]
Get-ServiceFabricClusterHealth
   [-ConsiderWarningAsError <Boolean>]
   [-MaxPercentUnhealthyApplications <Byte>]
   [-MaxPercentUnhealthyNodes <Byte>]
   [-EventsHealthStateFilter <Int64>]
   [-EventsFilter <HealthStateFilter>]
   [-ApplicationsHealthStateFilter <Int64>]
   [-ApplicationsFilter <HealthStateFilter>]
   [-NodesHealthStateFilter <Int64>]
   [-NodesFilter <HealthStateFilter>]
   [-ApplicationHealthPolicyMap <ApplicationHealthPolicyMap>]
   [-ApplicationTypeHealthPolicyMap <ApplicationTypeHealthPolicyMap>]
   [-NodeTypeHealthPolicyMap <NodeTypeHealthPolicyMap>]
   [-ExcludeHealthStatistics]
   [-TimeoutSec <Int32>]
   [<CommonParameters>]

Description

The Get-ServiceFabricClusterHealth cmdlet gets health information for a Service Fabric cluster. Service Fabric reports the following health states:

  • OK. The entity meets health guidelines.
  • Error. The entity does not meet health guidelines.
  • Warning. The entity meets health guidelines but experienced some issue.

The aggregated health state of the cluster takes into consideration all health reports on the cluster as well as the aggregated health state of all children, recursively. The health evaluation uses the cluster health policy and the application health policy of each application in the cluster.

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 of the cluster and filter returned children

PS C:\> Get-ServiceFabricClusterHealth -NodesFilter Error -ApplicationsFilter 'Warning,Error'

This command queries the health of the cluster. It specifies filters to return only nodes with health state Error and applications with health state Warning or Error.

Example 2: Get the health of the cluster using custom health policies

PS C:\> $defaultServiceTypeHealthPolicy = new-object -TypeName System.Fabric.Health.ServiceTypeHealthPolicy
$defaultServiceTypeHealthPolicy.MaxPercentUnhealthyPartitionsPerService = 20
$defaultServiceTypeHealthPolicy.MaxPercentUnhealthyServices = 10
$appHealthPolicy = New-Object -TypeName System.Fabric.Health.ApplicationHealthPolicy
$appHealthPolicy.ConsiderWarningAsError = $True
$appHealthPolicy.MaxPercentUnhealthyDeployedApplications = 20
$appHealthPolicy.DefaultServiceTypeHealthPolicy = $defaultServiceTypeHealthPolicy
$appHealthPolicyMap = New-Object -TypeName System.Fabric.Health.ApplicationHealthPolicyMap
$appUri1 = New-Object -TypeName System.Uri -ArgumentList "fabric:/app1"
$appHealthPolicyMap.Add($appUri1, $appHealthPolicy)
Get-ServiceFabricClusterHealth -ConsiderWarningAsError $True -MaxPercentUnhealthyNodes 10 -ApplicationHealthPolicyMap $appHealthPolicyMap

This command queries the health of the cluster and passes in custom policies.

Example 3: Get the health of the cluster using an application type health policy map

PS C:\> $AppTypeHealthPolicyMap = New-Object -TypeName "System.Fabric.Health.ApplicationTypeHealthPolicyMap"
PS C:\> $AppTypeHealthPolicyMap.Add("CriticalAppType", 0)
PS C:\> Get-ServiceFabricClusterHealth -ApplicationTypeHealthPolicyMap $AppTypeHealthPolicyMap -MaxPercentUnhealthyApplications 20

This command queries the health of the cluster and passes in an application type health policy map. The application type CriticalAppType does not tolerate any failures. The remaining applications are evaluated using 20% maximum percent unhealthy.

Example 4: Get the health of the cluster without health events and without health statistics

PS C:\> Get-ServiceFabricClusterHealth -EventsFilter None -ExcludeHealthStatistics

This command queries the health of the cluster. It specifies filters to exclude any health events and the health statistics.

Example 5: Get the health of the cluster with fabric:/System application statistics included

PS C:\> Get-ServiceFabricClusterHealth -EventsFilter None -IncludeSystemApplicationHealthStatistics

This command queries the health of the cluster. The health statistics returned as part of the cluster health contain the fabric:/System application statistics, in addition to the user applications statistics.

Parameters

-ApplicationHealthPolicyMap

Specifies the ApplicationHealthPolicyMap object that includes custom health policies for some or all of the applications. If you do not specify this parameter, the health evaluation uses the application health policies defined in the application manifest or the default health policy.

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

-ApplicationsFilter

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

-ApplicationsHealthStateFilter

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

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

-ApplicationTypeHealthPolicyMap

Specifies the map that defines the maximum percentage of unhealthy applications that are allowed per application type. Application types in this map are evaluated using specific percentages rather than the global MaxPercentUnhealthyApplications percentage.

For example, if some applications of a type are critical, the cluster administrator can add an entry to the map for that application type and assign it a value of 0% (that is, do not tolerate any failures). All other applications can be evaluated with MaxPercentUnhealthyApplications set to 20% to tolerate some failures out of the thousands of application instances.

The application type health policy map is used only if the cluster manifest enables application type health evaluation using the configuration entry for HealthManager/EnableApplicationTypeHealthEvaluation.

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

-ConsiderWarningAsError

Indicates whether to treat a warning health report as error during health evaluation. This value is used for evaluation of nodes and cluster health reports.

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 cluster 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 of the cluster. 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 cluster health statistics, which contain information about how many entities are in Ok, Warning, and Error states.

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

-IncludeSystemApplicationHealthStatistics

Indicates whether the health statistics should include information for the fabric:/System application. If specified, the application, service, partition, replica, deployed application, and deployed service package counts include the System entities. If not specified, the health statistics return health state counts only for user applications.

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

-MaxPercentUnhealthyApplications

Specifies the maximum tolerated percentage of unhealthy applications. If there are more applications with aggregated health state of error than tolerated, the health state of the cluster is error. If you do not specify this parameter, the health evaluation uses the value provided in the cluster manifest.

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

-MaxPercentUnhealthyNodes

Specifies the maximum tolerated percentage of unhealthy nodes. If there are more nodes with aggregated health state of error than tolerated, the cluster is evaluated as error. If you do not specify this parameter, the health evaluation uses the value provided in the cluster manifest.

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

-NodesFilter

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

-NodesHealthStateFilter

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

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

-NodeTypeHealthPolicyMap

Defines a map with max percentages unhealthy nodes for specific node types.

The node type health policy map can be used during cluster health evaluation to describe special node types. The node types included in the map are evaluated against the percentage included in the map, and also with the global (see System.Fabric.Health.ClusterHealthPolicy.MaxPercentUnhealthyNodes). The nodes of node types specified in the map are also counted against the global pool of nodes; they are independent checks.

Type:NodeTypeHealthPolicyMap
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

None

Outputs

System.Object