Advertisement
Advertisement
| 07.02.2008 at 11:40AM PDT, ID: 23534626 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: |
Set msg = CreateObject("CDO.Message")
Set config = CreateObject("CDO.Configuration")
Set msg.Configuration = config
'ping the box....
Set oShell = CreateObject("wscript.shell")
Set oExecuteObject = oShell.Exec("ping -l 32 -n 4 -w 500 192.168.2.3")
response = LCase(oExecuteObject.StdOut.ReadAll)
If InStr(response, "reply") > 0 Then
Else
subject = "*** xHost DOWN ALERT"
SendEmail
End If
'email subroutine....
Sub SendEmail
With msg
.to = "seriousnick@abc.com"
.from = """Ping Monitor"" <ping@abc.com>"
.subject = subject
End with
'server info
prefix = "http://schemas.microsoft.com/cdo/configuration/"
With config.fields
.item(prefix & "sendusing") = 2
.item(prefix & "smtpserver") = "smtp.smtpserver.com"
.item(prefix & "smtpserverport") = 25
.item(prefix & "smtpauthenticate") = 1
.item(prefix & "sendusername") = "username"
.item(prefix & "sendpassword") = "password"
.update
End With
'set up email error logging
on error resume next
send_error = error.number
on error goto 0
if send_error <> 0 then
wscript.echo "Error Sending Your Message"
wscript.quit 0
else
msg.send
end If
End Sub
|