| Scott's profileScott's SpacePhotosBlogLists | Help |
|
December 04 Script to capture MOM daily stats to Jet DB Redux!MOM 2005 Stats to Jet Database Redux Just in time for the holiday season, a new and improved version of MOM_Report_to_Database.vbs For full details please see my prior posting http://myitforum.com/articles/2/view.asp?id=10257 If your already using the original script and database only a few modifications will have to be made.
' Verify that 2 arguments were passed Set colNamedArguments = WScript.Arguments.Named 'mom part Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\MOM") 'database part Set objConnection = CreateObject("ADODB.Connection") objConnection.Open _ objRecordSet.Open "SELECT * FROM momdata" , _ For Each objItem In colItems objRecordSet.Close November 11 MOM 2005 Agent on a DMZ HostThe KB below is packed with information and trouble shooting steps.
Microsoft KB article How to install and manage Microsoft Operations Manager 2005 agent computers that are behind a firewall or in an untrusted domain http://support.microsoft.com/kb/904866 The majority of the problems I've encountered are usually related to, Naming resolution and firewall ports.
Requirements for MOM agents that are behind a firewall
The following ports must be open TCP port 1270 and UDP port 1270, and it must be bi-directional. Also note that the agent must be manually installed on the DMZ host, and updates must be manually applied too. The following should be done prior to manually installing the agent on the DMZ host. 1. Use the host file on mom server to resolve the fqdn name of the DMZ host.
2. Use the host file on the agent computer to resolve the fqdn name(s) of the MOM Server(s). 3. After modifying and saving the changes to the host file, open a command prompt and run the following command nbtstat -RR. 4. To verify that the proper ports are opened up on the firewall, from the MOM 2005 Resource Kit use the MOM Remote Pre-requisite Checker, from the Management Server. Use the computer name that was added to the host file, to run the diagnostic. The tool runs 14 different tests trying to access the computer that was specified. The Channel test is the one that needs to be passed in order for the MOM agent to function properly. A problem that I've run into more than once A DMZ host does not ever send a heartbeat, or the heartbeat stops updating information to Management server. This is usually a problem with UDP port 1270 going from the DMZ agent to the Management Server. Visit my blog http://myitforum.com/cs2/blogs/smoss/default.aspx MOM 2005 Daily stats caputre to Jet DatabaseThis is an easy way to capture data for reporting on MOM 2005 stats utilizing the MOM WMI Class MSFT_TodayStatistics.
I've created a script that will dump the MOM WMI Class MSFT_TodayStatistics (the daily stats) for MOM 2005 into a database. Props to Don Hite, his script to dump the same info into an excel file gave me the idea to dump the info into a jet database. The MOM WMI Class MSFT_TodayStatistics gets zeroed out at 11:59:59 pm each night.
If you manage more than one management group, it would not be hard to modify this script to use a sql db and include the management group name when the data is collected. I'm sure the management group name can be gotten thru WMI... but I'll save that for a later article. User requirements:
1. Create Access Database and Table
Create an Access Database named: MOMRPT.MDB
Create a table named: MOMDATA
Create field names that correspond with the recordset objects below in the table MOMDATA.
Date ComputerGroups Monitored CriticalErrors TotalErrors EventsToday NewAlertsToday SecurityBreaches ServiceLevelExceptions ServicesUnavailable UnresolvedAlerts TotalWarnings 2. Create a scheduled task
Create a scheduled task that runs this script at 11:59 pm (the objects in MSFT_TodayStatistics zero out at 11:59:59 pm)
3. Create the capture Script
User Modifications to make script work:
1.) strComputer = "YOURMOMSERVERNAME"
Change YOUREMOMSERVERNAME to the name of your MOM Server. 2.) "Data Source = DriveLetter:\FOLDER_NAME_WHERE_DB_IS\MOMRPT.MDB"
This should be the drive letter and folder name where the MOMRPT.mdb file is located. ' Script below
' ================= ' Author: Scott Moss ' date May 15, 2007 ' VBScript that will collect daily stats for mom and put them in a ' jet db to run your onw reports against it. Put Script in same folder w/ DB. ' Script should be run from MOM server. ' Requirements ' Create Scheduled Task to run this vb script every night at 11:59 pm. ' *** the objects in MSFT_TodayStatistics zero out at 11:59:59 pm *** ' Create Access Database MOMRPT.MDB ' Create Table called momdata ' Create field names that correspond with the recordset objects below ' Date, ComputerGroups, Monitored, CriticalErrors, etc. ' Must give credit to Don Hite. '=========================== 'mom part strComputer = "YOURMOMSERVERNAME" Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\MOM")
Set colItems = objWMIService.ExecQuery("Select * from MSFT_TodayStatistics") dtmThisDate = (Now) 'database part
Const adOpenStatic = 3 Const adLockOptimistic = 3 Set objConnection = CreateObject("ADODB.Connection") Set objRecordSet = CreateObject("ADODB.Recordset") objConnection.Open _ "Provider = Microsoft.Jet.OLEDB.4.0; " & _ "Data Source = DriveLetter:\FOLDER_NAME_WHERE_DB_IS\MOMRPT.MDB" objRecordSet.Open "SELECT * FROM momdata" , _
objConnection, adOpenStatic, adLockOptimistic For Each objItem In colItems objRecordSet.AddNew objRecordSet("Date") = dtmThisDate objRecordSet("ComputerGroups") = objItem.TotalComputerGroups objRecordSet("Monitored") = objItem.TotalComputersMonitored objRecordSet("CriticalErrors") = objItem.TotalCriticalErrors objRecordSet("TotalErrors") = objItem.TotalErrors objRecordSet("EventsToday") = objItem.TotalEventsToday objRecordSet("NewAlertsToday") = objItem.TotalNewAlertsToday objRecordSet("SecurityBreaches") = objItem.TotalSecurityBreaches objRecordSet("ServiceLevelExceptions") = objItem.TotalServiceLevelExceptions objRecordSet("ServicesUnavailable") = objItem.TotalServicesUnavailable objRecordSet("UnresolvedAlerts") = objItem.TotalUnresolvedAlerts objRecordSet("TotalWarnings") = objItem.TotalWarningsobjRecordSet.Update objRecordSet.Close objConnection.Close Next 'END CODE |
Scott's Space |
||||
|
|