Performance Alert - Passing command line arguments to email script

F

foxj77

Can anyone help me out with this problem. I have setup the following
two scripts to fire an email every time an alert is triggered.

I want to be able to use a generic script to email me when an alert is
tripped and include details of the alert. I plan to use the following
two scripts to send an email and select all of the command line
arguments in the alert (as one string).

The problem is that the script doesn't send when configured in the
alert. It works fine from the command line using the johnmail.cmd file
as well as typing cscript johnmail.vbs "alert text in here".

When I try and configure it within the performance alert it doesn't
send an email. The alert writes to event log so that I know the alert
is being triggered.

Can anyone help me out.

Thanks in advance


John
------------------------------------------------
Johnmail.cmd

cscript johnmail.vbs %1
------------------------------------------------
johnmail.vbs

dim server
dim eventlog
dim eventid

server = WScript.Arguments.Item(0)

Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Example CDO Message"
objMessage.Sender = "(e-mail address removed)"
objMessage.To = "(e-mail address removed)"
objMessage.TextBody = "This is some sample message text. ===" &
server

'==This section provides the configuration information for the remote
SMTP server.
'==Normally you will only change the server name or IP.

objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
"newminddc"

'Server port (typically 25)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

objMessage.Configuration.Fields.Update

'==End remote SMTP server configuration section==

objMessage.Send
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top