Storage DKU Drive Unit Monitor

UCPManagementPack.StorageDKUDriveUnitMonitor (UnitMonitor)

Description for the new unit monitor.

Knowledge Base article:

Summary

This monitor is an availability monitor for Storage in a UCP Director. If the state is Warning or Error, there could be an issue with the Storage System or with a related Storage component.

Causes

A warning or error for the Storage can be caused by a problem with the Controller or Unit.

Resolutions

Please check specific the Storage System in UCP Director for details.

Element properties:

TargetUCPManagementPack.StorageDKUDrive
Parent MonitorSystem.Health.AvailabilityState
CategoryAvailabilityHealth
EnabledTrue
Alert GenerateTrue
Alert SeverityMatchMonitorHealth
Alert PriorityNormal
Alert Auto ResolveTrue
Monitor TypeUCPManagementPack.TimedPowerShell.UnitMonitor
RemotableTrue
AccessibilityInternal
Alert Message
Storage DKU Drive failed health check
RunAsSystem.PrivilegedMonitoringAccount

Source Code:

<UnitMonitor ID="UCPManagementPack.StorageDKUDriveUnitMonitor" Accessibility="Internal" Enabled="true" Target="UCPManagementPack.StorageDKUDrive" ParentMonitorID="Health!System.Health.AvailabilityState" Remotable="true" Priority="Normal" TypeID="UCPManagementPack.TimedPowerShell.UnitMonitor" ConfirmDelivery="false" RunAs="System!System.PrivilegedMonitoringAccount">
<Category>AvailabilityHealth</Category>
<AlertSettings AlertMessage="UCPManagementPack.StorageDKUDriveUnitMonitor.AlertMessage">
<AlertOnState>Warning</AlertOnState>
<AutoResolve>true</AutoResolve>
<AlertPriority>Normal</AlertPriority>
<AlertSeverity>MatchMonitorHealth</AlertSeverity>
</AlertSettings>
<OperationalStates>
<OperationalState ID="Healthy" MonitorTypeStateID="Healthy" HealthState="Success"/>
<OperationalState ID="Warning" MonitorTypeStateID="Warning" HealthState="Warning"/>
<OperationalState ID="Error" MonitorTypeStateID="Error" HealthState="Error"/>
</OperationalStates>
<Configuration>
<IntervalSeconds>400</IntervalSeconds>
<SyncTime/>
<ScriptName>MonitorStorageDKUDrive.ps1</ScriptName>
<ScriptBody><Script>

param($sourceId, $managedEntityId, $managementIps, $domain, $username, $password)

$api = new-object -comObject 'MOM.ScriptAPI'

$bag = $api.CreatePropertyBag()

# Make sure credentials are set
if ($username -and $password) {

add-type "using System.Net; using System.Security.Cryptography.X509Certificates; public class TrustAllCertsPolicy : ICertificatePolicy { public bool CheckValidationResult(ServicePoint srvPoint, X509Certificate certificate, WebRequest request, int certificateProblem) { return true; } }"

[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy

$secstr = New-Object -TypeName System.Security.SecureString
$password.ToCharArray() | ForEach-Object {$secstr.AppendChar($_)}
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist "$domain`\$username", $secstr

$url = "https://$managementIps/api/storagesystems"
$resourceName = "$Target/Host/Property[Type='UCPManagementPack.Storage']/Name$"

$api.LogScriptEvent("MonitorStorageDKUDrive.ps1", 103, 0, "Getting storage DKU Drive health data from $url for $resourceName")

$results = Invoke-RestMethod -Uri $url -Credential $cred

$result = $results | where { $_.GlobalResourceId -eq $resourceName }

$result.ComponentStatuses | foreach {
if ($_.Name -eq "DB Drive") {
if ($_.Status -eq "Normal") {
$bag.AddValue("Status","HEALTHY")
} elseif ($_.Status -eq "Serious") {
$bag.AddValue("Status","ERROR")
} else {
$bag.AddValue("Status","WARNING")
}
}
}

$api.LogScriptEvent("MonitorStorageDKUDrive.ps1", 103, 0, "Finished getting storage DKU Drive health data for $resourceName")
} else {
$api.LogScriptEvent("MonitorStorageDKUDrive.ps1", 103, 0, "Credentials not provided!")
}

$bag

</Script></ScriptBody>
<ManagementIps>$Target/Host/Host/Host/Property[Type='UCPManagementPack.Pod']/ManagementIp$</ManagementIps>
<TimeoutSeconds>300</TimeoutSeconds>
<SourceId>$MPElement$</SourceId>
<ManagedEntityId>$Target/Id$</ManagedEntityId>
</Configuration>
</UnitMonitor>