We’d like to introduce another author on Thelazyadmin.com.
Brad Bird is an IT Professional of 12 years experience. Currently working as an independent consultant associated with Infront Consulting. Brad has more than 8 years under his belt specifically in Windows Networking Administration. Among his specialties are: Windows security, forensics, intrusion prevention and detection, Active Directory implementation, System Center Operations Manager and Data Protection Manager implementation and consulting. Brad has specifically been focusing his efforts in the non-Windows space with Operations Manager. His certifications include MCT, MCITP, MCTS, MCSE, MCSA, A+ and Network+.
Most of Brad’s writing will focus on his specialty, System Center products, but you might see some other stuff here and there as well. Please welcome Brad.
The TLA Team
---------------------------
I was recently working with another colleague from Infront Consulting on a contract. My colleague is John Hann, he is a MOM MVP and we were tasked to update a SCOM environment to SP1 and incorporate new features like Savision Live Maps and Cross Platform Extensions to monitor Linux servers.
While these were also interesting to work with, the topic is on Exchange 2007 monitoring within a distributed application in SCOM 2007. We tried a couple of different approaches which I will explain.
The challenge came in treating the mail store as an isolated component to retrieve health state information from that would roll up into the overall health of a distributed application using all of the component relationships that we defined.
The Good - The mail store is definitely monitored within the Exchange 2007 Management Pack as one would expect and health information, performance information, etc are included as one would expect from the knowledge contained in a product Management Pack.
The Bad - Our first instinct was to monitor the Information Store service on the Exchange server itself. This is done easily enough within the Operations Manager console authoring node using the Windows Service monitor Management Pack template. The problem was that when the mailbox store was dismounted, it reflected a bad health state using information within the management pack, but did not specifically affect the information store service on the Exchange server...
What is affected then?
The Ugly - Upon further investigation using the Health Explorer, we found that the Exchange mailbox store rolls up into the MOM 2005 rollup computer role object. (As if that is in any way, obvious...) OK, so we tried targeting the MOM 2005 rollup Computer Role object and sure enough, the Exchange Mailbox store is a selectable object to be used in the distributed application designer.
Job done, right?
Neigh, neigh... We tested dismounting the mailbox store again and the health state does show in Health Explorer. The problem, is that it will not rollup any further to affect the distributed application as desired.
The Solution - While John and I worked together on this particular issue, I must bow to his experience in creating the monitor and finding the script code that we used to get this resolved.
In John Hann we trust!!!
So, there are a couple of steps here...
First, we needed to find a separate way to get the mailbox status. We used a powershell script for that to check on the mailbox store mount status and write the resulting health state to a log file.
get-mailboxdatabase –status
Then, we created a 2 state monitor targeted to the Exchange 2007 Mailbox Servers Computer Role object. That, would allow the rollup to work correctly.
An interesting note here, is that targeting this Group actually affects the health state of the Exchange Server Computer Object which needed to be added into the distributed application designer.
Here is the script..
On Error Resume Next
Public WshShell, StrApp1, strHosts, strPreCheck, oBag, oAPI
Set oAPI = CreateObject("MOM.ScriptAPI")
Set WshShell = Wscript.CreateObject("WScript.Shell")
Set objFileSystem = CreateObject("Scripting.FileSystemObject")
OutFile = "c:\mbx.ps1"
objFileSystem.DeleteFile OutFile
Set OutputFile = objFileSystem.OpenTextFile(OutFile, 2, True)
OutputFile.WriteLine "get-mailboxdatabase -status | select-object name,mounted | export-csv " & chr(34) & "c:\mb.out" & Chr(34)
OutputFile.close
Set OutputFile = Nothing
InFile = "c:\mb.out"
objFileSystem.DeleteFile InFile
strPSCmd = "PowerShell.exe -PSConsoleFile " & chr(34) & "C:\Program Files\Microsoft\Exchange Server\Bin\ExShell.psc1" & Chr(34) & " -Command c:\mbx.ps1"
WshShell.Run strPSCmd, 0, True
strDisMounted = ""
strStatus = "All Mounted"
Set InputFile = objFileSystem.OpenTextFile(InFile, 1, False)
InLine = InputFile.ReadLine
InLine = InputFile.ReadLine
Do While InputFile.AtEndOfStream <> True
InLine = InputFile.ReadLine
Items = Split(InLine,",")
If Items(1) = "False" Then
strDisMounted = strDisMounted & Items(0) & VbCrLf
strStatus = "DisMounted"
End If
Loop
InputFile.Close
Set InputFile = Nothing
objFileSystem.DeleteFile InFile
objFileSystem.DeleteFile OutFile
If strDisMounted = "" Then
strDisMounted = "All Mailstores Mounted"
End If
Set oBag = oAPI.CreatePropertyBag()
Call oBag.AddValue("Status",strStatus)
Call oBag.AddValue("Mounted",strDisMounted)
Call oAPI.Return(oBag)
And the monitor
Important Syntax here is: Property(@Name='Status'). This needs to be associated with "dismounted" for a "Critical" state and "All Mounted" for a "Healthy" state.
Now the job is done!