Creating Custom Scripts Step by Step
Windows Server Forum Index Windows Server
Server discussion on Windows platform.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web winserverhelp.com
Creating Custom Scripts Step by Step

 
Post new topic   Reply to topic    Windows Server Forum Index -> MOM
Author Message
Glenn Wilson
Guest





Posted: Thu Jan 06, 2005 5:31 am    Post subject: Creating Custom Scripts Step by Step Reply with quote

I have to work on some custom scripts for MOM, these scripts are for
monitoring internal Database systems. For example we have an internally
written applications that writes messages to a messagelog database table. I
need to configure a monitoring action to collect some data from this data,
process some rules, and then decide wether to alert or not, and what type of
alert to send ( crit, warning, information, error, and such)

What I am looking for is a simple tutorial on witing scripts for MOM, then
an article on how to set it up..

Can some one send me to a link or in a direction to find what I am looking
for.
Back to top
Guest






Posted: Fri Jan 07, 2005 1:53 am    Post subject: Creating Custom Scripts Step by Step Reply with quote

OK,
1. Write a script not for MOM in order to get the data
from you database table.
Create a simple VBS and check if you get the right data.

2. In order to generate alert first create an event
Using this function:
and call this function for example:

Const EVENT_SOURCE = "My Application"

'Event Type Constants
Const EVENT_TYPE_SUCCESS = 0
Const EVENT_TYPE_ERROR = 1
Const EVENT_TYPE_WARNING = 2
Const EVENT_TYPE_INFORMATION = 4

Const SUCCESS = 0
Const ERROR = 1
Const WARNING = 2
Const INFORMATION = 4
Const AUDIT_SUCCESS = 8
Const AUDIT_FAILURE = 16

Const EVENTID = 998877
MsgEvent = "We have a problem"

CreateEvent EVENT_SOURCE, EVENTID ,EVENT_TYPE_WARNING,
MsgEvent ,strComputerName


'==========================================================
===============
' Insert event to MOM all other events
'==========================================================
===============

Sub CreateEvent(strSource, lngEventID, lngEventType,
strMsg, strSrcComputer)

Const MAX_EVENT_DESCRIPTION_LENGTH = 3450

Dim oNewEvent

' Create a new event
Set oNewEvent = ScriptContext.CreateEvent

' Set event properties
oNewEvent.Message = Left(strMsg,
MAX_EVENT_DESCRIPTION_LENGTH)
oNewEvent.EventNumber = lngEventID
oNewEvent.EventType = lngEventType
oNewEvent.EventSource = strSource
If strSrcComputer <> "" Then
oNewEvent.SourceComputer = strSrcComputer
oNewEvent.LoggingComputer = strSrcComputer
End If

' Submit the event
ScriptContext.Submit oNewEvent

Set oNewEvent = Nothing
End Sub

'==========================================================
===============
' Insert event to event log
'==========================================================
===============

sub LogEvent(nSeverity, sDescription, sComputer)
Dim oShell
Dim bSuccess

set oShell = CreateObject("WScript.Shell")
bSuccess = oShell.LogEvent(nSeverity, sDescription,
sComputer)
set oShell = Nothing

end sub

3. Create a new Event rule and the provider is "Script-
generated Data and in Criteria you can write with event id
998877


You can also using parameter for each rule using
'Get Parameters
Set oParams = ScriptContext.Parameters
str1 = oParams.get("mystr1")
str2 = oParams.get("mystr2")

Hop this help you

Idan

Quote:
-----Original Message-----

I have to work on some custom scripts for MOM, these
scripts are for
monitoring internal Database systems. For example we have
an internally
written applications that writes messages to a messagelog
database table. I
need to configure a monitoring action to collect some
data from this data,
process some rules, and then decide wether to alert or
not, and what type of
alert to send ( crit, warning, information, error, and
such)

What I am looking for is a simple tutorial on witing
scripts for MOM, then
an article on how to set it up..

Can some one send me to a link or in a direction to find
what I am looking
for.
.
Back to top
 
Post new topic   Reply to topic    Windows Server Forum Index -> MOM All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




New Topics Powered by phpBB