Send-​Service​Fabric​Deployed​Service​Package​Health​Report

Sends a health report on a Service Fabric deployed service package.

Syntax

Send-ServiceFabricDeployedServicePackageHealthReport
    [-ApplicationName] <Uri>
    [-ServiceManifestName] <String>
    [-NodeName] <String>
    [-Description <String>]
    -HealthProperty <String>
    -HealthState <HealthState>
    [-RemoveWhenExpired]
    [-SequenceNumber <Int64>]
    -SourceId <String>
    [-TimeoutSec <Int32>]
    [-TimeToLiveSec <Int32>]
    [<CommonParameters>]

Description

The Send-ServiceFabricDeployedServicePackageHealthReport cmdlet sends a health report on a Service Fabric deployed service package.

The deployed service package must already exist in the health store. To check whether the service exists, use the Get-ServiceFabricDeployedServicePackageHealth cmdlet. Specify the application name, service package name, and node name. Alternatively, you can use the Get-ServiceFabricDeployedApplicationHealth cmdlet. Specify the application name and node name, and check the deployed service package health states section to find the service package.

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 command is evaluated on the client without reference to running on the health store. The report may not be applied in health store even if the command returns success. For example, the health store may reject the report because of an invalid parameter, like a stale sequence number.

To see whether the report was applied in the health store, use the Get-ServiceFabricDeployedServicePackageHealth cmdlet and check that the report appears in the HealthEvents section.

To manage Service Fabric clusters, start Windows PowerShell by using the Run as administrator option. Before you perform any operation on a Service Fabric cluster, establish a connection to the cluster by using the Connect-ServiceFabricCluster cmdlet and then the Get-ServiceFabricClusterConnection cmdlet.

Examples

Example 1: Report Error health report with infinite TTL

PS C:\> Send-ServiceFabricDeployedServicePackageHealthReport -ApplicationName fabric:/MyApplication -NodeName "Node01" -ServiceManifestName "MyServiceManifest" -HealthProperty "Memory" -HealthState Error -SourceId "MyWatchdog"

This command sends a health report on a deployed service package for the application named fabric:/MyApplication on the node named Node01 for the service manifest named MyServiceManifest. The health report contains information about the health property Memory in an Error health state from the source MyWatchdog, with infinite TTL. The description is not given and the sequence number is set automatically.

Example 2: Report Warning valid for specified TTL and remove it when it expires

PS C:\> Send-ServiceFabricDeployedServicePackageHealthReport -ApplicationName fabric:/MyApplication -ServiceManifestName MyServiceManifest -NodeName "Node01" -HealthProperty "CustomSetup" -HealthState Warning -SourceId MyWatchdog -RemoveWhenExpired -Description "The setup has completed with some warnings." -TimeToLiveSec 10

This command sends a health report on a deployed service package for the application named fabric:/MyApplication for the service manifest named MyServiceManifest on the node named Node01. The health report contains information about the health property CustomSetup in a Warning health state from the source MyWatchdog, with 10 seconds TTL. After the report expires, it is removed from the health store and will no longer impact health evaluation. This command also gives a description of the warning.

Required Parameters

-ApplicationName

Specifies the Uniform Resource Identifier (URI) of a Service Fabric application. The cmdlet sends a health report for the application that has the URI that you specify.

Type:Uri
Position:1
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-HealthProperty

Specifies the property of the report. Together with the SourceId parameter, this property uniquely identifies the report. The report overrides any previous reports with the same values for the SourceId and HealthProperty parameters on the same entity.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-HealthState

Specifies a HealthState object that represents the reported health state.

Type:HealthState
Parameter Sets:Invalid, Ok, Warning, Error, Unknown
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-NodeName

Specifies the name of a Service Fabric node. The cmdlet sends a health report for a service package deployed on the node that you specify.

Type:String
Position:3
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-ServiceManifestName

Specifies the name of a Service Fabric service manifest. Together with ApplicationName and NodeName, this value uniquely identifies the deployed service package health entity.

Type:String
Position:2
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-SourceId

Specifies the identifier of the source that triggered the report.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False

Optional 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.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters: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.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters: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 SourceId and HealthProperty, or the report will be rejected due to staleness.

Type:Int64
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters: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.

Type:Int32
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-TimeoutSec

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

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

Inputs

System.Uri, String, System.Fabric.HealthState

Outputs

None