Working with Logical Disk Fragmentation Monitor in SCOM 2012

Tuesday, February 12, 2013
by asalvo

If you leave the default monitoring for Logical Disk Fragmentation in SCOM 2012 (and previous versions by the looks of the Google results), you will end up with a dashboard that looks like this.

image

The health explorer shows a warning for each logical disk, which must be reset if you want to get ride of the warning. This must be done for each disk on each server, even if you close the alert.

image

Changing the Default Values

The default monitoring is set to warn if the disk fragmentation is greater then the “OS recommended limit”, which seems to be set to a very low level. This SCOM monitor runs weekly, but can be configured as to when it runs, what disk fragmentation level to run at, etc. On the OS side, Windows Server 2012 is setup to automatically defrag your hard drives on a weekly basis (it knows to ignore SSD drives in case you are wondering), but the default defragmentation runs after the SCOM monitor. Even then, when I experimented with scheduling the monitor or defragmentation job, I’d still end up with warnings.

I ended up overriding the monitor Windows Server 2008 Logical Disk, and Windows Server 2012 Logical Disk to warn at a 30% fragmentation level. You must also be sure to enable the override for Use Server Recommended Value to False.

image

Resetting the Health

So you’ve cleared your alarms and set the monitor to use more sane values. So wow do you reset 100 monitors in the warning state if you don’t have an intern to pawn this work off onto? Of course the answer is Power Shell (well Google/Bing plus power shell if you are reading this).

If you’ve never used PowerShell with SCOM there are a few things you should know. When you install the Operations Manager console, the PowerShell command-lets get installed as well. If you search thru your start menu, you’ll actually see a PowerShell command prompt which has the command-lets loaded, and is preconfigured to connect to a management server.

image

These command-lets can be manually imported using the Import-Module OperationsManager PowerShell command. The Operations Manager command-lets only work with PowerShell 3.0. Finally, you must launch the PowerShell environment (command line, editor, PowerGui, etc) as an windows user that has the necessary permissions to access operations manager.

Here is the script which will reset the health for all 2008 and 2012 logical disk monitors.


#Import the operations manager command-lets and connect to our management server
Import-Module OperationsManager
$scomServer = "SomeManagementServer.contoso.com"
New-SCOMManagementGroupConnection -ComputerName $scomServer

#Reest Windows 2008 monitors
$monitor = Get-ScomMonitor | where {$_.Name -eq 'Microsoft.Windows.Server.2008.LogicalDisk.DefragAnalysis'}
$monitorClass = Get-ScomClass -name Microsoft.Windows.Server.2008.LogicalDisk
$monitorClass | Get-SComClassInstance | where {$_.HealthState -eq 'Warning' -or $_.HealthState -eq 'Error'} | foreach {$_.ResetMonitoringState($monitor)}

#Reset Windows 2012 monitors
$monitor = Get-ScomMonitor | where {$_.Name -eq 'Microsoft.Windows.Server.6.2.LogicalDisk.DefragAnalysis'}
$monitorClass = Get-ScomClass -name Microsoft.Windows.Server.6.2.LogicalDisk
$monitorClass | Get-SComClassInstance | where {$_.HealthState -eq 'Warning' -or $_.HealthState -eq 'Error'} | foreach {$_.ResetMonitoringState($monitor)}

Comments

comments powered by Disqus