The ASUP Rule writes AutoSupport messages with Cluster-level information to the EMS log on the storage system. AutoSupport automatically sends periodic email notifications about system health to technical support.
if (Test-Path -path $netappRegPath)
{
# Check for the registry key value of the install location for NetApp
$key = get-itemproperty $netappRegPath
}
elseif (Test-Path -path $ibmRegPath)
{
# Check for IBM registry key since can't find NetApp
$key= get-itemproperty $ibmRegPath
}
else
{
throw ("OnCommand Plug-in for Microsoft is not installed on " + $env:COMPUTERNAME + "`r`n")
}
function InvokeMethodInAppDomain([AppDomain]$appDomain,
[string]$assemblyPath,
[string]$typename,
[array]$contructorParameters,
[string]$methodName,
[array]$methodParameters)
{
#In SCOM a Powershell script is executed in a MonitoringHost.exe process.
#Lifetime of a MonitoringHost.exe is not controlled by us and it continues to run after the script is done, possibly
#running other scripts or the same script again. A script is executed in a default AppDomain (by SCOM design) and
#as a result any assemblies loaded by script can not be unloaded because the defualt AppDomain can not be unloaded.
#Impossibility of unloading an assembly becomes a problem when then the assembly DLL is being updated
#(i.e. during an istallation), the problem is that even after the assembly DLL is updated,
#the new assembly code is not loaded if the assembly is already loaded.
#The solution for this problem is to load an assembly to a non-default domain which can be unloaded when the script is done.
#The OC.Cluster.OM.AppDomainInvoker assembly has to be in the GAC
$AppDomainInvokerAssembly = [System.Reflection.Assembly]::LoadWithPartialName('OC.Cluster.OM.AppDomainInvoker')
$api.LogScriptEvent($scriptName, 14001, 0, "Generating ASUP message succeeded.")
}
catch
{
if ($api)
{
$api.LogScriptEvent($scriptName, 14002, 1, "Generating ASUP message failed.`r`n" + $Error)
}
#throw the current error so that it will be displayed in the SCOM task output and status of the task will be set as failed
throw
}
finally
{
if ($nonDefaultAppDomain)
{
[AppDomain]::Unload($nonDefaultAppDomain)
$nonDefaultAppDomain = $null
}
}</Script></ScriptBody>
<Parameters>
<Parameter>
<Name>MonitoringMethodName</Name>
<Value>GenerateAsupClusterEmsMessage</Value>
</Parameter>
<Parameter>
<Name>VserverUUID</Name>
<Value>$Target/Property[Type="DataONTAP.Cluster.AbstractVserver"]/UUID$</Value>
</Parameter>
</Parameters>
<TimeoutSeconds>1200</TimeoutSeconds>
</WriteAction>
</WriteActions>
</Rule>