Send-ServiceFabricNodeHealthReport
Sends a health report on a Service Fabric node.
Syntax
Send-ServiceFabricNodeHealthReport
[-NodeName] <String>
-HealthState <HealthState>
-SourceId <String>
-HealthProperty <String>
[-Description <String>]
[-TimeToLiveSec <Int32>]
[-RemoveWhenExpired]
[-SequenceNumber <Int64>]
[-Immediate]
[-TimeoutSec <Int32>]
[<CommonParameters>]
Description
The Send-ServiceFabricNodeHealthReport cmdlet sends a health report on a Service Fabric node.
The node must already exist in the health store. To check whether it exists, use the Get-ServiceFabricNodeHealth cmdlet. Alternatively, you can use the Get-ServiceFabricNode cmdlet. If the cmdlet gets the node and the node has valid health state, then the node exists in the health store.
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-ServiceFabricNodeHealth 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-ServiceFabricNodeHealthReport -NodeName "Node01" -SourceId "MyWatchdog" -HealthProperty "Firewall" -HealthState Error -Description "Firewall rules were not correctly applied"
This command sends a health report on the node named Node01 from the source named MyWatchdog. The health report contains information about the health property Firewall in an Error health state, with infinite TTL.
Example 2: Report Warning valid for specified TTL
PS C:\> Send-ServiceFabricNodeHealthReport -NodeName "Node01" -SourceId "MyWatchdog" -HealthProperty "CPU" -HealthState Warning -Description "CPU has been more than 90% for the last hour." -TimeToLiveSec 10 -RemoveWhenExpired
This command sends a health report on the node named Node01 from the source named MyWatchdog. The health report contains information about the health property CPU in a Warning health state. The command also gives a description for the warning, sets the TTL to 10 seconds, and configures the report to be removed when it expires.
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.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
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 |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-HealthState
Specifies a HealthState object that represents the reported health state.
Type: | HealthState |
Accepted values: | Invalid, Ok, Warning, Error, Unknown |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | 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.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-NodeName
Specifies the name of a Service Fabric node. The cmdlet sends a health report on the node that you specify.
Type: | String |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
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 |
Required: | False |
Accept pipeline input: | True |
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 is rejected due to staleness.
Type: | Int64 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-SourceId
Specifies the identifier of the source that triggered the report.
Type: | String |
Position: | Named |
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 |
-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 |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Inputs
System.String
System.Fabric.Health.HealthState
System.Nullable`1[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]
System.Management.Automation.SwitchParameter
System.Nullable`1[[System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]
Outputs
System.Object