Send-ServiceFabricApplicationHealthReport
在 Service Fabric 應用程式上傳送健康情況報告。
語法
Send-ServiceFabricApplicationHealthReport
[-ApplicationName] <Uri>
-HealthState <HealthState>
-SourceId <String>
-HealthProperty <String>
[-Description <String>]
[-TimeToLiveSec <Int32>]
[-RemoveWhenExpired]
[-SequenceNumber <Int64>]
[-Immediate]
[-TimeoutSec <Int32>]
[<CommonParameters>]
Description
Send-ServiceFabricApplicationHealthReport Cmdlet 會在 Service Fabric 應用程式上傳送健康情況報告。
應用程式必須已存在於健康狀態存放區中。
若要檢查它是否存在,請使用 get-ServiceFabricApplicationHealth Cmdlet
Cmdlet 會在 Connect-ServiceFabricCluster Cmdlet HealthReportSendIntervalInSec 參數所指定的間隔之後傳送報表。 叢集聯機必須在這段期間保持運作。 此 Cmdlet 會以異步方式傳送報表,因此即使處理失敗,此 Cmdlet 仍可能會傳送成功值。 例如,如果刪除實體,或因為無效的參數,例如過時的序號,健康情況存放區可能會拒絕報告。
若要查看是否已在健康狀態存放區中套用報表,請使用 Get-ServiceFabricApplicationHealth Cmdlet,並檢查報告是否出現在 HealthEvents 區段中。
若要管理 Service Fabric 叢集,請使用 [以系統管理員身分執行] 選項啟動 Windows PowerShell。 在 Service Fabric 叢集上執行任何作業之前,請先使用 Connect-ServiceFabricCluster Cmdlet,然後 Get-ServiceFabricClusterConnection Cmdlet 來建立叢集的連線。
範例
範例 1:報告具有無限 TTL 的錯誤健康情況報告
PS C:\> Send-ServiceFabricApplicationHealthReport -ApplicationName fabric:/MyApplication -SourceId "MyWatchdog" -HealthProperty "Availability" -HealthState Error
此命令會從來源 MyWatchDog,在名為 fabric:/MyApplication 的應用程式上傳送健康情況報告。 健康情況報告包含健康情況屬性的相關信息,可用性 處於錯誤健康狀態,且具有無限 TTL。
範例 2:報告適用於指定 TTL 的警告
PS C:\> Send-ServiceFabricApplicationHealthReport -ApplicationName fabric:/MyApplication -SourceId "MyWatchdog" -HealthProperty "Availability" -HealthState Warning -TimeToLiveSec 10 -RemoveWhenExpired
此命令會從來源 MyWatchDog,在名為 fabric:/MyApplication 的應用程式上傳送健康情況報告。 健康情況報告包含健康情況屬性的相關信息,可用性 處於警告健康狀態。 報表將停留在健康狀態存放區 10 秒,之後會自動移除。
參數
-ApplicationName
指定 Service Fabric 應用程式的統一資源識別碼(URI)。 Cmdlet 會傳送健康情況報告,以取得您指定 URI 的應用程式。
類型: | Uri |
Position: | 0 |
預設值: | None |
必要: | True |
接受管線輸入: | True |
接受萬用字元: | False |
-Description
指定觸發報表之條件的人類可讀資訊。 SourceId、HealthProperty,以及 HealthState 參數會完整描述報告。
描述的最大字串長度為4096個字元。 如果提供的字串較長,它會自動截斷。 截斷時,描述會以標記 「[Truncated]」 結尾,以指出發生截斷的使用者。 字串大小總計為 4096 個字元,因此會保留原始字串中的少於 4096 個字元。
類型: | String |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | True |
接受萬用字元: | False |
-HealthProperty
指定報表的屬性。 此屬性與 SourceId 參數一起,可唯一識別報表。 此報表會以相同實體上 SourceId 和 HealthProperty 參數,覆寫任何先前的報表。
類型: | String |
Position: | Named |
預設值: | None |
必要: | True |
接受管線輸入: | True |
接受萬用字元: | False |
-HealthState
指定代表所報告健全狀態的 HealthState 物件。
類型: | HealthState |
接受的值: | Invalid, Ok, Warning, Error, Unknown |
Position: | Named |
預設值: | None |
必要: | True |
接受管線輸入: | True |
接受萬用字元: | False |
-Immediate
指定是否應立即將報告傳送至健康狀態存放區。 這對於應儘快傳送的重要報告很有用。 如果未指定,則會根據健康情況客戶端設定來傳送報告。 因此,它會根據 HealthReportSendInterval 組態進行批處理。 這是建議的設定,因為它可讓健康情況用戶端將健康情況報告訊息優化到健康狀態存放區,以及健康情況報告處理。 根據預設,Powershell 網狀架構用戶端會將 HealthReportSentInterval 設定為 0,因此會立即傳送報告。
類型: | SwitchParameter |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-RemoveWhenExpired
指出報表在到期時會從健康狀態存放區中移除。 如果您未指定此參數,當報表存留時間到期時,實體會被視為處於錯誤狀態。 過期時移除的報表,可用於只有效一段時間的條件,或清除健全狀況存放區的報告。
類型: | SwitchParameter |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | True |
接受萬用字元: | False |
-SequenceNumber
指定與健康情況報告相關聯的序號。 如果您未指定此參數的值,則會自動設定序號。 如果您指定序號,該值必須高於相同 SourceId 和 HealthProperty上設定的任何先前序號,否則報表會因為過時而遭到拒絕。
類型: | Int64 |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | True |
接受萬用字元: | False |
-SourceId
指定觸發報表的來源標識碼。
類型: | String |
Position: | Named |
預設值: | None |
必要: | True |
接受管線輸入: | True |
接受萬用字元: | False |
-TimeoutSec
指定作業的逾時期間,以秒為單位。
類型: | Int32 |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-TimeToLiveSec
指定報表的存留時間(TTL)以秒為單位。
當 TTL 到期時,如果指定了 removeWhenExpired 參數
類型: | Int32 |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | True |
接受萬用字元: | False |
輸入
System.Uri
System.Fabric.Health.HealthState
System.String
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]]
輸出
System.Object