Scott's profileScott's SpacePhotosBlogLists Tools Help
January 11

Better late than never

HAPPY NEW YEAR!
December 20

on vacation this week!

At the beach this week!
WOOOT!
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
This script takes in two arguments, the MOM Server name and the Management Group Name, collects the mom daily statistics and puts them into a database D:\MOMMGT\MOMRPT.MDB.
This will allow for reporting on multiple Management Groups. Tongue out

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.
The database will have to have a row called MGName added, and the scheduled task will have to have the parameters added for the /MOMServer:ServerName /MGName:ManagementGroupName
There is error checking to make sure that there are 2 parameters, if the two parameters are not there, the script will quit with the parameters that are required.


Usage:
cscript mom_report_to_database.vbs /MOMServer:MOMServerName /MGName:MOMManagementGroupName


'Start Of Code
'========================================================
' Author: Scott Moss
' date DEC 4, 2007
' Mom_report_to_Database2.vbs This one uses Named Arguments
' usage cscript mom_report_to_database.vbs /MOMServer:MOMServerName /MGName:MOMManagementGroupName
' disclaimer use at your own risk.
' mom script 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.
' Run as a scheduled task at 11:59 PM every day 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, MGName, ComputerGroups, Monitored, CriticalErrors, etc.
' Must give credit to Don Hite. His idea to dump to excel gave me the idea to dump it to a db.
'=======================================================
'cscript mom_report_to_database.vbs /MOMServer:MOMServerName /MGName:MOMManagementGroupName

' Verify that 2 arguments were passed
iNumberOfArguments = WScript.Arguments.Count
If iNumberOfArguments = 2 Then
    '
Else
    Wscript.Echo "Error: invalid number of arguments entered. " & _
        "cscript mom_stats_to_JetDB_Argument.vbs /MOMServer:MOMServerName /MGName:MOMManagementGroupName"
    Wscript.Quit
End If

Set colNamedArguments = WScript.Arguments.Named
strMOMServer = colNamedArguments.Item("MOMServer")
strMGName = colNamedArguments.Item("MGName")

'mom part
strComputer = strMOMServer

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 = D:\MOMMGT\momrpt.mdb"

objRecordSet.Open "SELECT * FROM momdata" , _
    objConnection, adOpenStatic, adLockOptimistic

For Each objItem In colItems
objRecordSet.AddNew
objRecordSet("Date") = dtmThisDate
objRecordSet("MGName") = strMGName
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.TotalWarnings
objRecordSet.Update

objRecordSet.Close
objConnection.Close
Next
'End Of Code

November 11

MOM 2005 Agent on a DMZ Host

The 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.
 

MOM 2005 Daily stats caputre to Jet Database

This 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
 

I’m making a difference

Loading...
Photo 1 of 1

Scott Moss

No list items have been added yet.

Scott's Space