Dell Server Capacity Planning UMT

Dell.ManagedServer.ServerCapacityPlanningUMT (UnitMonitorType)

Element properties:

RunAsDefault
AccessibilityPublic
Support Monitor RecalculateFalse

Member Modules:

ID Module Type TypeId RunAs 
DSP2 DataSource System.SimpleScheduler Default
PB2 ProbeAction Microsoft.Windows.PowerShellPropertyBagProbe Default
OperationStatusSuccess ConditionDetection System.ExpressionFilter Default
OperationStatusWarning ConditionDetection System.ExpressionFilter Default

Overrideable Parameters:

IDParameterTypeSelectorDisplay NameDescription
IntervalSecondsint$Config/IntervalSeconds$Interval SecondsInterval Seconds for the Capacity Planning UMT
TimeoutSecondsint$Config/TimeoutSeconds$Timeout SecondsTimeout Seconds for the Capacity Planning UMT
LogLevelint$Config/LogLevel$LogLevelLogLevel for the Capacity Planning UMT
PerformanceValueint$Config/PerformanceValue$Performance ValuePerformance Value for the Capacity Planning UMT

Source Code:

<UnitMonitorType ID="Dell.ManagedServer.ServerCapacityPlanningUMT" Accessibility="Public">
<MonitorTypeStates>
<MonitorTypeState ID="Normal" NoDetection="false"/>
<MonitorTypeState ID="Warning" NoDetection="false"/>
</MonitorTypeStates>
<Configuration>
<IncludeSchemaTypes>
<SchemaType>System!System.ExpressionEvaluatorSchema</SchemaType>
<SchemaType>Windows!Microsoft.Windows.PowerShellSchema</SchemaType>
</IncludeSchemaTypes>
<xsd:element name="IntervalSeconds" type="xsd:integer"/>
<xsd:element name="SyncTime" type="xsd:string"/>
<xsd:element name="TimeoutSeconds" type="xsd:integer"/>
<xsd:element name="InstanceIndex" type="xsd:string"/>
<xsd:element name="ComponentType" type="xsd:string"/>
<xsd:element name="LogLevel" type="xsd:integer"/>
<xsd:element name="PerformanceValue" type="xsd:integer"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="IntervalSeconds" Selector="$Config/IntervalSeconds$" ParameterType="int"/>
<OverrideableParameter ID="TimeoutSeconds" Selector="$Config/TimeoutSeconds$" ParameterType="int"/>
<OverrideableParameter ID="LogLevel" Selector="$Config/LogLevel$" ParameterType="int"/>
<OverrideableParameter ID="PerformanceValue" Selector="$Config/PerformanceValue$" ParameterType="int"/>
</OverrideableParameters>
<MonitorImplementation>
<MemberModules>
<DataSource ID="DSP2" TypeID="System!System.SimpleScheduler">
<IntervalSeconds>$Config/IntervalSeconds$</IntervalSeconds>
<SyncTime>$Config/SyncTime$</SyncTime>
</DataSource>
<ProbeAction ID="PB2" TypeID="Windows!Microsoft.Windows.PowerShellPropertyBagProbe">
<ScriptName>DellServerCapacityPlanningUMT.ps1</ScriptName>
<ScriptBody><Script>
param($LogLevel, $PerformanceValue)
$api = New-Object -comObject 'MOM.ScriptAPI'

$scriptname = "DellServerCapacityPlanningUMT"
$logDirectory = "DellManagedServeriSM_log"

try
{
$ErrorActionPreference = "SilentlyContinue"
if ($LogLevel -ne 0)
{
$TempFolder = $env:SystemRoot + "\Temp"
$LogLocation = $TempFolder + "\" + $logDirectory + "\"
If(!(Test-Path -path($TempFolder)))
{
# create the directory if not present
New-Item $TempFolder -type directory
}

If(!(Test-Path -path($LogLocation)))
{
# create the directory if not present
New-Item $LogLocation -type directory
}
$Global:LogFileLocation = $LogLocation + $scriptname + ".log"
If(!(Test-Path -path($LogFileLocation)))
{
# create the file if it does not exist
New-Item $LogFileLocation -type file
}
Else
{
$logFileSize = Get-ChildItem $LogFileLocation | ForEach-Object {($_.Length/1KB)}
If ($logFileSize -gt 512)
{
# existingLogFile is greater than 512 KB
$archiveTime = Get-Date -f "yyyy-MM-dd_HH.mm"
Rename-Item $LogFileLocation ("ArchivedLog_" + $scriptname + "_" + $archiveTime + ".log")
New-Item $LogFileLocation -type file
}
}
}
}
catch
{
$ErrorMessage = $_.Exception.Message
$FailedItem = $_.Exception.ItemName
$message = "Exception in creating log file. Exception-Message:" + $ErrorMessage + $FailedItem
$api.LogScriptEvent("DellServerHealthCookDownUMT.ps1",1345,0,$message)
}
Function psDebugLog
{
param($level, $message)
if (($level -gt 0) -and ($level -le $LogLevel))
{
$currentTime = Get-Date -f "yyyy-MM-dd_HH.mm.ss"
Out-File -FilePath $LogFileLocation -InputObject ($currentTime + " :: " + $message) -Append -EA SilentlyContinue
}
}

psDebugLog -level 1 -message "Server Health CookDownUMT Script is Started"

# Update for all profiles inventory.
$profiles = @("DCIM_AggregationMetricValue"
)

$hash_profileInstances = @{}

foreach($profile in $profiles)
{
psDebugLog -level 1 -message ("Health UMT Retriving " + $profile + " Profile")
Try
{
$ErrorActionPreference = "SilentlyContinue"
$ProfileInstances = Get-CimInstance -Namespace root\cimv2\dcim -ClassName $profile
#Converting single-objects into arrays, as some profiles are not arrrays
if($ProfileInstances -ne $null)
{
if($ProfileInstances -isnot [system.array])
{
$temparray = @()
$temparray += $ProfileInstances
$ProfileInstances = $temparray
}
# Then add array into Hash Map.
$hash_profileInstances.Add($profile, $ProfileInstances)
}
}
Catch
{
$ErrorMessage = $_.exception.Message
psDebugLog -level 1 -message "Exception in Retriving Profile " + $profile + " Exception-Message:" + $ErrorMessage
}
}

$dcimAggregationMetricValueArray = $hash_profileInstances.Item("DCIM_AggregationMetricValue")

if (($dcimAggregationMetricValueArray -ne $null) -and ($dcimAggregationMetricValueArray.Count -gt 0))
{
psDebugLog -level 1 -message ("System Board Average SYS Usage UMT Script is Started")
foreach($dcimAggregationMetricValue in $dcimAggregationMetricValueArray)
{
$instanceID = $dcimAggregationMetricValue.InstanceID
$lcaseInstanceId = $instanceID.ToLower()
if (($lcaseInstanceId.Contains("systemboard")) -and ($lcaseInstanceId.Contains("avg")) -and ($lcaseInstanceId.Contains("sysusage")) -and ($lcaseInstanceId.Contains("1d")))
{
$metricValue = $dcimAggregationMetricValue.MetricValue
$state = "Warning"
[int]$default = 60
if(([int]$PerformanceValue -lt 1) -or ([int]$PerformanceValue -gt 99))
{
[int]$PerformanceValue = [int]$default
psDebugLog -level 1 -message ("Threshold value set is either less than 1 or greater than 99. Hence setting it to default value - 60")
}
psDebugLog -level 1 -message ("WarningThreshold: " + $PerformanceValue + ", MetricValue: " + $metricValue)
if([int]$metricValue -lt [int]$PerformanceValue){
$state = "OK"
}
$propertyBag = $api.CreatePropertyBag()
$propertyBag.AddValue("ComponentType", "Dell.ManagedServer.AvgCUPSUtilizationPerDay")
$propertyBag.AddValue("InstanceIndex", $instanceID)
$propertyBag.AddValue("PerformanceValue", $metricValue)
$propertyBag.AddValue("Status", $state)
$api.AddItem($propertyBag)
$propertyBag
$message = "AvgCUPSUtilization per day for " + $instanceID + " is : " + $state
psDebugLog -level 1 -message ($message)
}
}
psDebugLog -level 1 -message ("System Board Average SYS Usage UMT Script is Ended")
}
psDebugLog -level 1 -message "Server Health CookDownUMT Script is Ended"
</Script></ScriptBody>
<Parameters>
<Parameter>
<Name>LogLevel</Name>
<Value>$Config/LogLevel$</Value>
</Parameter>
<Parameter>
<Name>PerformanceValue</Name>
<Value>$Config/PerformanceValue$</Value>
</Parameter>
</Parameters>
<TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
</ProbeAction>
<ConditionDetection ID="OperationStatusSuccess" TypeID="System!System.ExpressionFilter">
<Expression>
<And>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery>Property[@Name='ComponentType']</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="String">$Config/ComponentType$</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery>Property[@Name='Status']</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="String">OK</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</And>
</Expression>
</ConditionDetection>
<ConditionDetection ID="OperationStatusWarning" TypeID="System!System.ExpressionFilter">
<Expression>
<And>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery>Property[@Name='ComponentType']</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="String">$Config/ComponentType$</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery>Property[@Name='Status']</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="String">Warning</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</And>
</Expression>
</ConditionDetection>
</MemberModules>
<RegularDetections>
<RegularDetection MonitorTypeStateID="Normal">
<Node ID="OperationStatusSuccess">
<Node ID="PB2">
<Node ID="DSP2"/>
</Node>
</Node>
</RegularDetection>
<RegularDetection MonitorTypeStateID="Warning">
<Node ID="OperationStatusWarning">
<Node ID="PB2">
<Node ID="DSP2"/>
</Node>
</Node>
</RegularDetection>
</RegularDetections>
</MonitorImplementation>
</UnitMonitorType>