Cross-database ownership chaining has been disabled on the rtcdyn database
http://go.microsoft.com/fwlink/?LinkId=266330
Target | Microsoft.KnowledgeServices.Lync.2010.CentralMgmtDatabase | ||
Parent Monitor | System.Health.ConfigurationState | ||
Category | Alert | ||
Enabled | True | ||
Alert Generate | True | ||
Alert Severity | Error | ||
Alert Priority | High | ||
Alert Auto Resolve | True | ||
Monitor Type | Microsoft.KnowledgeServices.Library.PowerShellMonitorEx | ||
Remotable | True | ||
Accessibility | Public | ||
Alert Message |
| ||
RunAs | Microsoft.KnowledgeServices.ElevatedAccount | ||
Comment | SupportTopic=TBD;VersionNumber=1.0.0.0; |
<UnitMonitor ID="Monitor_AKN420658" Comment="SupportTopic=TBD;VersionNumber=1.0.0.0;" Accessibility="Public" Enabled="true" Target="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.CentralMgmtDatabase" ParentMonitorID="Health!System.Health.ConfigurationState" Remotable="true" Priority="High" RunAs="KnowledgeServicesLibrary!Microsoft.KnowledgeServices.ElevatedAccount" TypeID="KnowledgeServicesLibrary!Microsoft.KnowledgeServices.Library.PowerShellMonitorEx" ConfirmDelivery="true">
<Category>Alert</Category>
<AlertSettings AlertMessage="MonitorMessagec48ad6c30c8d4044ba4071e0673f31ff">
<AlertOnState>Error</AlertOnState>
<AutoResolve>true</AutoResolve>
<AlertPriority>High</AlertPriority>
<AlertSeverity>Error</AlertSeverity>
</AlertSettings>
<OperationalStates>
<OperationalState ID="Success" MonitorTypeStateID="Success" HealthState="Success"/>
<OperationalState ID="Error" MonitorTypeStateID="Error" HealthState="Error"/>
</OperationalStates>
<Configuration>
<ScriptName>AKN420658.ps1</ScriptName>
<Parameters>
<Parameter>
<Name>SQLInstanceName</Name>
<Value>$Target/Property[Type="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.CentralMgmtDatabase"]/sqlinstancename$</Value>
</Parameter>
<Parameter>
<Name>PoolFQDN</Name>
<Value>$Target/Property[Type="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.CentralMgmtDatabase"]/poolFQDN$</Value>
</Parameter>
</Parameters>
<ScriptBody>
param($SQLInstanceName,$PoolFQDN)
$ErrorActionPreference = "Stop"
# Set up the arguments
$scriptargs = new-object psobject
$scriptargs | add-member NoteProperty "SQLInstanceName" $SQLInstanceName
$scriptargs | add-member NoteProperty "PoolFQDN" $PoolFQDN
# Set up the output
$global:scriptoutput = new-object psobject
$scriptoutput | add-member NoteProperty "HasIssue" $false
#-----------------------------------------------------
# MAIN CODE SECTION
#-----------------------------------------------------
$scriptenv = New-Object psobject
$scriptenv | Add-Member NoteProperty "RuntimeError" $false
$scriptenv | Add-Member NoteProperty "HasIssue" $false
function DetectDbChaining()
{
$SQL = $scriptargs.PoolFQDN
$SQLInst = $scriptargs.SQLInstanceName
$connString = "Server=" + $SQL.ToString() + "\" + "$SQLInst" + ";" + "Database=master;Integrated Security=true"
if($SQLInst -ieq "")
{
$connString = "Server=" + $SQL.ToString()+ ";Database=master;Integrated Security=true"
}
$oConnection = New-Object System.Data.SqlClient.SqlConnection
$oConnection.ConnectionString = $connString
$oConnection.Open()
$oSQLCommand = New-Object System.Data.SqlClient.SqlCommand
$oSQLCommand.CommandText = "select is_db_chaining_on, name from sys.databases where name = 'rtcdyn'"
$oSQLCommand.Connection = $oConnection
$oSqlReader = $oSQLCommand.ExecuteReader()
If($oSqlReader.HasRows)
{
while ($oSqlReader.Read())
{
$dbChainingStatus = $oSqlReader["is_db_chaining_on"]
if ($dbChainingStatus -eq 0)
{
#Raise Alert
$ScriptEnv.HasIssue = $true
break;
}
}
}
$oSqlReader.Close()
$oConnection.Close()
}
# Main Function
function AdvisorRule($scriptargs, $scriptoutput)
{
if ($script:lyncPSVer -eq 2010)
{
trap [Exception]
{
$scriptenv.RuntimeError = $true
continue
}
$scriptoutput.HasIssue = $false
DetectDbChaining
if($scriptenv.HasIssue -eq $true -and $scriptenv.RuntimeError -eq $false)
{
$scriptoutput.HasIssue = $true
}
}
}
AdvisorRule $scriptargs $scriptoutput
# set the output
$mom = new-object -comobject "MOM.ScriptAPI"
$bag = $mom.CreatePropertyBag()
if ($scriptoutput.HasIssue -ne $null)
{
$bag.AddValue("HasIssue", $scriptoutput.HasIssue)
}
$bag
</ScriptBody>
<SnapIns/>
<TimeoutSeconds>300</TimeoutSeconds>
<Schedule>15300</Schedule>
<ErrorExpression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="Boolean">Property[@Name='HasIssue']</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="Boolean">true</Value>
</ValueExpression>
</SimpleExpression>
</ErrorExpression>
<SuccessExpression>
<Not>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="Boolean">Property[@Name='HasIssue']</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="Boolean">true</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</Not>
</SuccessExpression>
</Configuration>
</UnitMonitor>