Service Provider Foundation データベース接続モニター

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

SPF Web エンドポイントと SPF データベース間の接続を監視します。

Knowledge Base article:

概要

SPF Web サーバーからのデータベース接続を監視します。モニターは、Service Provider Foundation データベースへのテスト接続を定期的に実行することで行われます。

原因

このモニターでエラーが発生する場合、サーバーからデータベースを使用できないか、モニターのセキュリティが正しく構成されていません。モニターの構成の詳細については、「構成」セクションを参照してください。

モニターが正しく構成されているにもかかわらず、モニターでエラーが発生する場合、データベースがオフラインか、データベース サーバーが Service Provider Foundation サーバーにアクセスできていません。

解決方法

Service Provider Foundation データベースとデータベース サーバーの状態を確認してください。

構成

このモニターが正しく動作するには、モニターに、Service Management Automation データベースを読み取るためのアクセス権限が必要です。このデータベースの読み取りアクセス権限のある実行アカウントを作成し、「Microsoft Service Provider Foundation データベース アカウント」という名前の実行プロファイルに追加します。

このモニターでは次のオプションを構成できます:

オプション

定義

既定

アラート状態

アラートを生成するモニターのヘルス状態。

モニターのヘルス状態が重大状態にあります

アラートの優先順位

このモニターのアラートを生成する優先順位。

アラートの重要度

このモニターのアラートを生成する優先順位。

重大

アラートの自動解決

モニターが正常な状態に戻った時点で自動的にアラートを解決するかどうかを指定します。

有効

モニターを実行するかどうかを指定します。

アラートの生成

モニターが警告状態または重大状態に変更されるときにアラートを生成するかどうかを指定します。

間隔

モニターの実行間隔 (秒)。

300

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
AccessibilityInternal
Alert Message
AlertIfCantConnectToSpfDatabase
SPF データベースへの接続に失敗しました。
RunAsMicrosoft.SystemCenter.SPF.DatabaseAccount

Source Code:

<UnitMonitor ID="Microsoft.SystemCenter.SPF.Monitor.SpfDatabaseScriptMonitor" Accessibility="Internal" 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>