Share via


Send-ServiceFabricReplicaHealthReport

Sends a health report on a Service Fabric replica.

Syntax

StatefulService (Default)

Send-ServiceFabricReplicaHealthReport
    [-PartitionId] <Guid>
    -ReplicaId <Int64>
    -HealthState <HealthState>
    -SourceId <String>
    -HealthProperty <String>
    [-Description <String>]
    [-TimeToLiveSec <Int32>]
    [-RemoveWhenExpired]
    [-SequenceNumber <Int64>]
    [-Immediate]
    [-TimeoutSec <Int32>]
    [<CommonParameters>]

StatelessService

Send-ServiceFabricReplicaHealthReport
    [-PartitionId] <Guid>
    -InstanceId <Int64>
    -HealthState <HealthState>
    -SourceId <String>
    -HealthProperty <String>
    [-Description <String>]
    [-TimeToLiveSec <Int32>]
    [-RemoveWhenExpired]
    [-SequenceNumber <Int64>]
    [-Immediate]
    [-TimeoutSec <Int32>]
    [<CommonParameters>]

Description

The Send-ServiceFabricReplicaHealthReport cmdlet sends a health report on a Service Fabric stateless service instance or a stateful service replica.

The stateless service instance or the stateful service replica must already exist in the health store. To check whether it exists, use the Get-ServiceFabricReplicaHealth cmdlet, and specify the PartitionId and ReplicaOrInstanceId parameters. Alternatively, you can use the Get-ServiceFabricPartitionHealth cmdlet with the PartitionId parameter, and then check the ReplicaHealthStates section to find the replica.

The cmdlet sends the report after an interval specified by the HealthReportSendIntervalInSec parameter of the Connect-ServiceFabricCluster cmdlet. The cluster connection must be kept alive during this time.

The cmdlet may return success, but the report is sent asynchronously, so its processing may fail. To see whether the report was applied in the health store, use the Get-ServiceFabricReplicaHealth cmdlet and check that the report appears in the health events section.

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: Report Error health report on a stateful service replica with infinite TTL

PS C:\> Send-ServiceFabricReplicaHealthReport -PartitionId 869dd2e9-fdda-42a5-ad96-4b71c795dfd3 -ReplicaId 130464806670632402 -SourceId "MyWatchdog" -HealthProperty "DiskUsage" -HealthState Error -Description "Disk is full"

This command sends a health report for the specified partition for the specified stateful service replica from the source MyWatchDog. The health report contains information about the health property DiskUsage in an Error health state, with infinite TTL. This command also gives a description of the error.

Example 2: Report Warning health report on a stateless service instance valid for the specified TTL and remove it when it expires

PS C:\> Send-ServiceFabricReplicaHealthReport -PartitionId 1a151ac7-9c25-4528-81fc-4c6bb9909394 -InstanceId 130464806670632403 -SourceId "MyWatchdog" -HealthProperty "Resources" -HealthState Warning -Description "Access to resources is temporarily disabled" -TimeToLiveSec 10 -RemoveWhenExpired

This command sends a health report for the specified stateless service instance from the source MyWatchDog. The health report contains information about the health property Resources in a Warning health state from the source MyWatchdog, with 10 seconds TTL. The report marked for removal on expiration.

Parameters

-Description

Specifies human readable information about the condition that triggered the report. The SourceId, HealthProperty, and HealthState parameters fully describe the report.

The maximum string length for the description is 4096 characters. If the provided string is longer, it is automatically truncated. When truncated, the description ends with a marker, "[Truncated]", to indicate to users that truncation occurred. The total string size is 4096 characters, so less than 4096 characters from the original string are kept.

Parameter properties

Type:String
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:True
Value from remaining arguments:False

-HealthProperty

Specifies the property of the report. Together with the SourceId parameter, this property uniquely identifies the report.

Parameter properties

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

Parameter sets

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

-HealthState

Specifies a HealthState object that represents the reported health state.

Parameter properties

Type:HealthState
Default value:None
Accepted values:Invalid, Ok, Warning, Error, Unknown
Supports wildcards:False
DontShow:False

Parameter sets

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

-Immediate

Specifies whether the report should be sent to the health store immediately. This is useful for critical reports that should be sent as soon as possible. If not specified, the report is sent based on the health client settings. Therefore, it will be batched according to the HealthReportSendInterval configuration. This is the recommended setting because it allows the health client to optimize health reporting messages to health store as well as health report processing. By default, the Powershell fabric client sets HealthReportSentInterval to 0, so reports are sent immediately.

Parameter properties

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

-InstanceId

Specifies the stateless service instance ID. The instance ID is only valid for stateless services. A report for a stateful replica that uses InstanceId instead of ReplicaId is accepted by the health client, but is rejected by the health store.

Parameter properties

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

Parameter sets

StatelessService
Position:Named
Mandatory:True
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

-RemoveWhenExpired

Indicates that the report is removed from the health store when it expires. If you do not specify this parameter, the entity is considered in Error state when the report time to live expires. The reports that are removed when expired can be used for conditions that are only valid for a period of time or for clearing reports from Health Store.

Parameter properties

Type:SwitchParameter
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:True
Value from remaining arguments:False

-ReplicaId

Specifies the stateful service replica ID. The replica ID is only valid for stateful services. A report for a stateless instance that uses ReplicaId instead of InstaceId is accepted by the health client, but is rejected by the health store.

Parameter properties

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

Parameter sets

StatefulService
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-SequenceNumber

Specifies the sequence number associated with the health report. If you do not specify a value for this parameter, the sequence number is set automatically. If you specify a sequence number, that value must be higher than any previous sequence number set on the same entity for the same SourceId and HealthProperty, or the report is rejected due to staleness.

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:True
Value from remaining arguments:False

-SourceId

Specifies the identifier of the source that triggered the report.

Parameter properties

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

Parameter sets

(All)
Position:Named
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

-TimeToLiveSec

Specifies the Time to Live (TTL) of the report in seconds. When the TTL expires, the report is removed from the health store if the RemoveWhenExpired parameter is specified. Otherwise, the entity is evaluated at Error because of the expired report. The default value is Infinite.

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:True
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.Fabric.Health.HealthState

System.String

System.Nullable`1

System.Management.Automation.SwitchParameter

System.Nullable`1

Outputs

System.Object