January 2008 - Posts
My last posting had a working script in it however; it was slapped together with out really thinking about what I really needed to find out, is MOM monitoring this list of server names. My last post only told us if the MOM Agent service was on the box, which has too many holes in it to mention here. So after thinking about it and because my long weekend plans got cancelled at the last minute I wrote this script.
It reads in the target list of servers to be checked and puts them into an array. Then queries the one point database for a list of agent managed machines, which is dumped into a text file then read into as another array. If a computer name in array is not in array two its name will be written to the Difference.txt file.Note that the character case in the compairson counts. MOMSRV01 is different than MOMsrv01 and MOMSRV01 will be written to the difference.txt file.
I'm just happy I will not ever have to do this manually ever!!
Hope someone else finds this useful.
'==========================================================================
' NAME: Scott Moss
' DATE : 1/27/2008
' http://myitforum.com/cs2/blogs/smoss/default.aspx
' The problem, here is a list of servers, are they being monitored by mom?
' the input file checkmom.txt should have one server per line, it is loaded
' into an array, query against your OnePoint DB for agentmanaged computers
' which is loaded into an array, The arrays are compaired and the diff is output
' input file D:\checkmom.txt(user provided should be in all caps)
' input file D:\MOMAgentList.txt (created by script)
' output file D:\Differences.txt
' the array check is case sensitive momsrv01 is different than MomSrv01
' change sqlservername\instancenum to suite your environment
'==========================================================================
Const ForReading = 1
Const FOR_WRITING = 2
Const adOpenStatic = 3
Const adLockOptimistic = 3
Const OverwriteExisting = True
Const ForWriting = 2
Const ForAppending = 8
Dim stringInputFile
Dim objFso
Dim objOutputFile
Dim strOutputFile
Dim arrFirst
Dim arrSecond
Dim strElementFirst
Dim strElementSecond
Dim blnExistsInSecond
stringInputFile = "D:\checkmom.txt"
strOutputFile = "D:\Differences.txt"
Set objFso = CreateObject("Scripting.FileSystemObject")
If objFso.FileExists(strOutputFile) Then
Set objOutputFile = objFso.OpenTextFile(strOutputFile,FOR_WRITING)
Else
Set objOutputFile = objFso.CreateTextFile(strOutputFile)
End If
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objectTextStream = objFSO.OpenTextFile(stringInputFile, ForReading)
arrFirst = Split(objectTextStream.ReadAll, vbCrLf)
objectTextStream.Close
Set objConnection = CreateObject("ADODB.Connection")
Set objRecordSet = CreateObject("ADODB.Recordset")
objConnection.Open _
"Provider=SQLOLEDB;Data Source=SQLSERVERNAME\INSTANCENUM;" &_
"Initial Catalog=onepoint;Trusted_Connection=Yes;"
objRecordSet.Open "select Name from Computer WHERE [IsConfigManager]=0 AND ManagedType = '2' AND (idConfigManager IS NULL OR idComputer <> idConfigManager) AND IsAddedByServiceDiscovery = 0 AND [Type] <> 67108864 ORDER BY Name", _
objConnection, adOpenStatic, adLockOptimistic
objRecordSet.MoveFirst
strMomAgentList = "D:\MOMAgentList.txt"
Set objFile = objFSO.CreateTextFile(strMomAgentList)
Do Until objRecordSet.EOF
objFile.WriteLine objRecordSet.Fields.Item("Name")
objRecordSet.MoveNext
Loop
objFile.Close
objRecordSet.Close
objConnection.Close
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objectTextStream = objFSO.OpenTextFile(strMomAgentList, ForReading)
arrSecond = Split(objectTextStream.ReadAll, vbCrLf)
objectTextStream.Close
For Each strElementFirst In arrFirst
blnExistsInSecond = False
For Each strElementSecond In arrSecond
If strElementFirst = strElementSecond Then
blnExistsInSecond = True
Exit For
End If
Next
If Not blnExistsInSecond Then
objOutputFile.WriteLine strElementFirst & " is not being monitored by MOM"
End If
Next
objOutputFile.Close()
Set objOutputFile = Nothing
Set objFso = Nothing
I love to automate things I do not like to do. Here is the one thing I like to do the least, checking to see if servers have mom installed on them. This may not be the best solution however I thought the easiest way would be to check if the service exists, if it does the let it be know, and if not write a failure. The script below will read a file with a list of servers, one server per line, (D:\CHECKMOM.TXT ) and then make sure it can be pinged, if there is a response, check if the service is there or not and write the results to the screen. This has borrowed code from many different sources.
' NAME: Scott Moss
' DATE : 1/25/2008
' COMMENT: will read in a list of servers, verify that they can be pinged
' then check if the mom service is installed or not
Const ForReading = 1
Const SUCCESS = 0
stringInputFile = "D:\checkmom.txt"
strService = "MOM"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objectTextStream = objFSO.OpenTextFile(stringInputFile, ForReading)
arrServers = Split(objectTextStream.ReadAll, vbCrLf)
objectTextStream.Close
Set objShell = CreateObject("WScript.Shell")
On Error Resume Next
For Each strServer in arrServers
Set objScriptExec = objShell.Exec("ping -n 2 -w 1000 " & strServer)
strPingResults = LCase(objScriptExec.StdOut.ReadAll)
If InStr(strPingResults, "reply from") Then
Set objWMIService = GetObject("winmgmts:\\" & strServer)
If Err.Number <> 0 Then
WScript.Echo "FAILURE: " & strServer & " [WMI connection failed]"
Err.Clear
Else
Set objService = objWMIService.Get("Win32_Service.Name='" & strService & "'")
If Err.Number Then
WScript.Echo strServer & " FAILURE: " & strService & " [Service not found]"
Err.Clear
Else
WScript.Echo strServer & " SUCCESS: " & strService & " [Service found]"
End If
End If
Else
WScript.Echo "FAILURE: " & strServer & " [ping failed]"
End If
Next
946427 Even though you install the agent on the physical nodes of an SQL cluster, the cluster resource does not appear in the System Center Operations Manager 2007
http://support.microsoft.com/kb/946427/en-us
946436 Error message when you use the Command Shell utility for the first time in System Center Operations Manager 2007: "Can not find Operations Manager Management Server name for current user"
http://support.microsoft.com/kb/946436/en-us
948097 SCOM 2007: The CPU percentage Utilization monitors do not work on a Windows 2003 server.
http://support.microsoft.com/kb/948097/en-us
948098 SCOM 2007: Gateway server is not working properly after installation.
http://support.microsoft.com/kb/948098/en-us
948096 SCOM 2007: Exchange MP Reports - "Top 100" Returns 'Blank'
http://support.microsoft.com/kb/948096/en-us
948095 SCOM 2007 Exchange 2003 management pack: Exchange server cannot be detected as “back-end†server
http://support.microsoft.com/kb/948095/en-us
January always brings monster Jam to Atlanta, and the boy and I went early to the Pit Party to see the trucks up close before the show starts. As usual Spencer wanted to see and get his picture taken with Grave Digger first, then we could look at the other trucks.

Here we are hanging out in our seats.

Some of the carnage that was seen Saturday night. During the free style portion of the show, of the six trucks below, two lost wheels, and the other two popped a tire, and another one flipped over what a blast to watch!

Looking forward to next year!
Would you like to get more familiar with the VMware Management Pack for Operations Manager 2007?
nworks has a couple recorded webinars that you can watch. The webinar walks through every single aspect of nworks product. It is the exact same thing that they do live but it is recorded. There are three different webinars to choose from reguarding the OpsMgr07 managment pack for VMWare.
The URL is:
https://nworks.webex.com
Click on “Recorded Sessions” on the left under “Attend a Session”. It is about 45 minutes long.
Go to their web site at http://www.nworks.com
After adding the HP ProLiant Server ver 1.0 MP for Operations Manager I noticed the addition of some HP tables in the Operations Manager database. Using this query you will be able to display your HP ProLiant Server information that has been captured by Operations Manager 2007.
-- Scott Moss
-- 01-03-2008
-- OM 2007 Requires HP ProLiant MP v 1.0
-- Visit myitforum blog
-- http://myitforum.com/cs2/blogs/smoss/default.aspx
-- Get your HP Info out of OM with out opening Operator Console
select
NetworkName_A14810C3_AA91_31C4_6864_D897E7B7BE48 as 'Server Name',
Manufacturer_A14810C3_AA91_31C4_6864_D897E7B7BE48 as 'Manufacture',
Model_A14810C3_AA91_31C4_6864_D897E7B7BE48 as 'Model',
SystemType_A14810C3_AA91_31C4_6864_D897E7B7BE48 as 'SystemType',
SerialNumber_A14810C3_AA91_31C4_6864_D897E7B7BE48 as 'Serial Number',
PhysicalMemory_A14810C3_AA91_31C4_6864_D897E7B7BE48 as 'Physical Memory',
SystemFirmware_A14810C3_AA91_31C4_6864_D897E7B7BE48 as 'System Firmware',
TotalDisk_A14810C3_AA91_31C4_6864_D897E7B7BE48 as 'Total Disk',
InsightLightsOut_52CCB151_362E_1B40_728E_1E495D3D348B as 'iLO IP',
ManagementVersion_A14810C3_AA91_31C4_6864_D897E7B7BE48 as 'Management Agent Version'
from dbo.MT_HPProLiantServer
Order By [Server Name]
-- Enjoy!
There were 5 updated SCOM 2007 MPs for December 2007 and they are:
SQL Server 2000/2005 12/21/2007 (6.0.6247.5) http://www.microsoft.com/downloads/details.aspx?FamilyId=8C0F970E-C653-4C15-9E51-6A6CADFCA363&displaylang=en&displaylang=en
Data Protection Manager 2007 12/14/2007 (1.0) http://www.microsoft.com/downloads/details.aspx?FamilyId=FE7B09BD-CEF0-4B96-9FFD-910E6BE7FCEA&displaylang=en&displaylang=en
Windows SharePoint Services 3.0 12/07/2007 (2.0) This is a link to the SharePoint Monitoring toolkit where registration is suggested for this download. http://www.microsoft.com/downloads/details.aspx?FamilyId=E4600FD9-F53D-4DED-88BF-6BB1932794F9&displaylang=en&displaylang=en
Windows SharePoint Services (WSS) 3.0 12/07/2007 (2.0) This is a link to the SharePoint Monitoring toolkit where registration is suggested for this download. http://www.microsoft.com/downloads/details.aspx?FamilyId=E4600FD9-F53D-4DED-88BF-6BB1932794F9&displaylang=en&displaylang=en
Office SharePoint Server 2007 12/07/2007 (2.0) This is a link to the SharePoint Monitoring toolkit where registration is suggested for this download. http://www.microsoft.com/downloads/details.aspx?FamilyId=E4600FD9-F53D-4DED-88BF-6BB1932794F9&displaylang=en&displaylang=en
Link to System Center Operations Manager 2007 Catalog http://www.microsoft.com/technet/prodtechnol/scp/opsmgr07.aspx
Enjoy and Happy New Year!!!!!!!!
The following SQL Query will list the unmanaged Windows Server Cluster Computers in the OnePoint Database.
-- Scott Moss
-- 01-02-2008
-- MOM 2005 Query to enumerate only managed Windows Server Cluster Computers
-- http://myitforum.com/cs2/blogs/smoss/default.aspx
Select [Name], [Domain], [LastHeartbeat]
From Computer
Where [Type]= 67108864 and [ManagedType] = 0 and [DesiredManagedType] = 0
Order by [Name]
This SQL Script will enumerate all Managed Windows Server Cluster Computers in your Onepoint database.
-- Scott Moss
-- 01-02-2008
-- MOM 2005 Query to enumerate only managed Windows Server Cluster Computers
-- http://myitforum.com/cs2/blogs/smoss/default.aspx
Select [Name], [Domain], [LastHeartbeat]
From Computer
Where [Type]= 67108864 and [ManagedType] = 3 and [DesiredManagedType]= 3
Order by [Name]