Service Provider Foundation VMM Web 端点监视器

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

监视 SPF VMM Web 端点的运行状况。

Knowledge Base article:

摘要

监视 SPF Web 服务器中 VMM Web 接口的可访问性和可操作性。这是通过定期进行测试 Web 接口调用以检索云资源来完成的。

原因

如果此监视器出错,并且其他连接监视器未出错,则原因可能是构造配置错误或权限错误。有关配置监视器的详细信息,请参阅“配置”部分。

解决方法

请检查目标 VMM 服务器以了解云资源上的构造配置,并确保向管理员帐户授予访问权限。请确保监视器的安全性配置正确。

配置

为了让此监视器正常工作,此监视器必须具有访问 VMM 服务器上的云资源的管理员权限。创建一个所使用或具有的权限与为 VMM Web 端点指定的应用程序池帐户权限等效的运行方式帐户,并将其添加到名为“Microsoft Service Provider Foundation VMM 帐户”的运行方式配置文件中。

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

选项

定义

默认值

警报所处状态

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

监视器处于严重健康状况

警报优先级

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

警报严重性

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

严重

自动解决警报

指定当监视器恢复正常状态时是否应该自动解决警报。

已启用

指定是否应该运行监视器。

生成警报

指定当更改为警告或严重状态时监视器是否应该生成警报。

间隔

监视器运行间隔时间的秒数。

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
AlertIfCantAccessVMMEndpoint
Service Provider Foundation VMM Web 端点无法访问。
RunAsMicrosoft.SystemCenter.SPF.VmmEndpointAccount

Source Code:

<UnitMonitor ID="Microsoft.SystemCenter.SPF.Monitor.VMMEndpointGet" 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.VmmEndpointAccount">
<Category>AvailabilityHealth</Category>
<AlertSettings AlertMessage="Microsoft.SystemCenter.SPF.Monitor.VMMEndpointGet.AlertMessage">
<AlertOnState>Error</AlertOnState>
<AutoResolve>true</AutoResolve>
<AlertPriority>Normal</AlertPriority>
<AlertSeverity>MatchMonitorHealth</AlertSeverity>
<AlertParameters>
<AlertParameter1>$Data/Context/Property[@Name='StatusCode']$</AlertParameter1>
</AlertParameters>
</AlertSettings>
<OperationalStates>
<OperationalState ID="Error" MonitorTypeStateID="Error" HealthState="Error"/>
<OperationalState ID="Success" MonitorTypeStateID="Success" HealthState="Success"/>
</OperationalStates>
<Configuration>
<IntervalSeconds>300</IntervalSeconds>
<SyncTime/>
<ScriptName>HealthOfSpfServer.ps1</ScriptName>
<ScriptBody><Script>param
(
$PortNumber
)

$oAPI = new-object -comObject "MOM.ScriptAPI"
$propertyBag = $oAPI.CreatePropertyBag()

$errorActionSetting = $ErrorActionPreference

$downVmmServers = $null
$res = $null

try
{
$ErrorActionPreference = "Stop"

[Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}

$req = [System.Net.WebRequest]::Create("https://localhost:$PortNumber/SC2012R2/VMM/Microsoft.Management.OData.svc/Clouds")
$req.UseDefaultCredentials = $true
$res = $req.GetResponse()
$int = [int]$res.StatusCode
if($int -eq 200)
{
$propertyBag.AddValue("Result", "Success")
}
else
{
$propertyBag.AddValue("Result", "Failure")
}

$propertyBag.AddValue("StatusCode", $int)

}
catch
{
$propertyBag.AddValue("Result", "Failure")
$propertyBag.AddValue("StatusCode", $_.Exception.Message)
}
finally
{
$ErrorActionPreference = $errorActionSetting
if($res -ne $null)
{
$res.Close()
}
$propertyBag
}
</Script></ScriptBody>
<Parameters>
<Parameter>
<Name>PortNumber</Name>
<Value>$Target/Property[Type="Microsoft.SystemCenter.SPF.SpfServerBase"]/PortNumber$</Value>
</Parameter>
</Parameters>
<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>