Service Provider Foundation 数据库连接监视器

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

监视 SPF Web 端点与 SPF 数据库之间的连接。

Knowledge Base article:

摘要

监视数据库与 SPF Web 服务器的连接。这是通过定期建立与 Service Provider Foundation 数据库的测试连接完成的。

配置

此监视器正常工作的前提是有权读取 Service Management Automation 数据库。创建具有读取该数据库的权限的运行方式帐户,并将其添加到名为“Microsoft Service Provider Foundation VMM 帐户”的运行方式配置文件中。

可对此监视器配置以下选项:

选项

定义

默认值

警报启用状态

生成警报的监视器的健康状况。

监视器处于“严重”健康状况

警报优先级

为此监视器生成的警报的优先级。

警报严重性

为此监视器生成的警报的优先级。

严重

自动解决警报

指定在监视器返回到正常状态时是否应自动解决警报。

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>