Service Provider Foundation 資料庫連線監視器

Microsoft.SystemCenter.SPF.Monitor.SpfDatabaseScriptMonitor (UnitMonitor)

監視 SPF Web 端點與 SPF 資料庫之間的連線。

Knowledge Base article:

摘要

監視來自 SPF Web 伺服器的資料庫連線。這是透過定期測試與 Service Provider Foundation 資料庫的連線來完成。

設定

此監視器必須有讀取「服務管理自動化」資料庫的權限才能正確運作。建立具有讀取資料庫之權限的「執行身分資料庫」,將它新增到名為「Microsoft Service Provider Foundation 資料庫帳戶」的「執行身分設定檔」。

您可以在此監視器上設定下列選項:

選項

定義

預設值

警示開啟狀態

產生警示之監視器的健康情況狀態。

監視器處於重大的健康情況狀態

警示優先順序

此監視器所產生之警示的優先順序。

警示嚴重性

此監視器所產生之警示的優先順序。

重大

自動解決警示

指定當監視器恢復到狀況良好狀態時,是否應該自動解除警示。

True

已啟用

指定監視器是否應該執行。

True

產生警示

指定當變更為警告或重大狀態時,監視器是否應該產生警示。

True

間隔

監視器執行的間隔秒數。

300

原因

若此監視器處於錯誤狀態,表示伺服器無法存取資料庫,或未正確設定監視器的安全性。如需設定監視器的詳細資訊,請參閱<設定>一節。

若監視器已正確設定且監視器處於錯誤狀態,表示資料庫已離線或 Service Provider Foundation 伺服器無法存取資料庫伺服器。

解決方式

檢查 Service Provider Foundation 資料庫與資料庫伺服器的狀態。

Element properties:

TargetMicrosoft.SystemCenter.SPF.SpfServer
Parent MonitorSystem.Health.AvailabilityState
CategoryAvailabilityHealth
EnabledTrue
Alert GenerateTrue
Alert SeverityMatchMonitorHealth
Alert PriorityNormal
Alert Auto ResolveTrue
Monitor TypeMicrosoft.SystemCenter.ServiceProviderFoundation.PowerShellModule.TwoStateMonitorType.PropertyBag
RemotableTrue
AccessibilityPublic
Alert Message
無法連線到 SPF 資料庫
與 SPF 資料庫的連線失敗。
RunAsMicrosoft.SystemCenter.SPF.DatabaseAccount

Source Code:

<UnitMonitor ID="Microsoft.SystemCenter.SPF.Monitor.SpfDatabaseScriptMonitor" Accessibility="Public" Enabled="true" Target="Microsoft.SystemCenter.SPF.SpfServer" ParentMonitorID="Health!System.Health.AvailabilityState" Remotable="true" Priority="Normal" TypeID="Microsoft.SystemCenter.ServiceProviderFoundation.PowerShellModule.TwoStateMonitorType.PropertyBag" ConfirmDelivery="false" RunAs="Microsoft.SystemCenter.SPF.DatabaseAccount">
<Category>AvailabilityHealth</Category>
<AlertSettings AlertMessage="Microsoft.SystemCenter.SPF.Monitor.SpfDatabaseScriptMonitor.AlertMessage">
<AlertOnState>Error</AlertOnState>
<AutoResolve>true</AutoResolve>
<AlertPriority>Normal</AlertPriority>
<AlertSeverity>MatchMonitorHealth</AlertSeverity>
</AlertSettings>
<OperationalStates>
<OperationalState ID="Error" MonitorTypeStateID="Error" HealthState="Error"/>
<OperationalState ID="Success" MonitorTypeStateID="Success" HealthState="Success"/>
</OperationalStates>
<Configuration>
<IntervalSeconds>300</IntervalSeconds>
<SyncTime/>
<ScriptName>HealthOfSqlServer.ps1</ScriptName>
<ScriptBody><Script>$oAPI = new-object -comObject "MOM.ScriptAPI"
$propertyBag = $oAPI.CreatePropertyBag()

$errorActionSetting = $ErrorActionPreference
try
{
$ErrorActionPreference = "Stop"
Import-Module "$env:COMMONPROGRAMFILES\Microsoft System Center 2012 R2\Service Provider Foundation\Microsoft.SystemCenter.Foundation.Cmdlet.dll"
$stamps = Get-SCSPFStamp
$propertyBag.AddValue("Result", "Success")
}
catch
{
$propertyBag.AddValue("Result", "Error")
}
finally
{
$ErrorActionPreference = $errorActionSetting
$propertyBag
}
</Script></ScriptBody>
<TimeoutSeconds>300</TimeoutSeconds>
<ErrorExpression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="String">Property[@Name='Result']</XPathQuery>
</ValueExpression>
<Operator>NotEqual</Operator>
<ValueExpression>
<Value Type="String">Success</Value>
</ValueExpression>
</SimpleExpression>
</ErrorExpression>
<SuccessExpression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="String">Property[@Name='Result']</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="String">Success</Value>
</ValueExpression>
</SimpleExpression>
</SuccessExpression>
</Configuration>
</UnitMonitor>