• RSS
  • Twitter
  • FaceBook

Welcome to ISAserver.org

Forums | Register | Login | My Profile | Inbox | RSS RSS icon | My Subscription | My Forums | Address Book | Member List | Search | FAQ | Ticket List | Log Out

Isa2006 FPC AlertAction enabling problem

Users viewing this topic: none

Logged in as: Guest
  Printable Version
All Forums >> [ISA 2006 Misc.] >> ISA 2006 Programming >> Isa2006 FPC AlertAction enabling problem Page: [1]
Login
Message << Older Topic   Newer Topic >>
Isa2006 FPC AlertAction enabling problem - 13.Aug.2009 8:48:53 AM   
longair

 

Posts: 1
Joined: 9.Oct.2006
Status: offline
Question: Does anyone know how to programically enable the sendmail action?

I'm trying to use a VBscript to enable the SendMail AlertAction for specific Alerts. But if the AlertAction SendMail has never been enabled the SendMail AlertAction does not appear in the collection of AlertActions
the script below will help demonstrate the issue, chose two alerts  that have never had the sendmail action enabled set one manually and run the script after editing the line (If  alert.name = "Service Started" Then) to reflect the name of the alert (note case sensitive)
run the script and you will get the output
'LogEvent
True
0
SendMail
True
2
Done!
now disable the sendmail action for that alert manually and run the script again
this is the output (you can see the sendmail action as False, disabled)
'LogEvent
True
0
SendMail
False
2
Done!

If you then run the script against an alert that has never had the sendmail action enabled you only get
'LogEvent
True
0

This mean I can't programically enable the sendmail action for alerts that have never been enabled.
Does anyone know how to programically enable the sendmail action 


Sub ConfigureAlerts()
   ' Create the root obect.
   Dim root  ' The FPCLib.FPC root object
   Set root = CreateObject("FPC.Root")
   ' Declare the other objects needed.
   Dim array   ' An FPCArray object
   Dim alerts  ' An FPCAlerts collection
   Dim alert   ' An FPCAlert object
Dim Action   ' An FPCAlert.actions Collection

   ' Get references to the array object
   ' and the alerts collection.
   Set array = root.GetContainingArray()
   Set alerts = array.Alerts

   On Error Resume Next
   For Each alert In alerts
   ' wscript.Echo alert.name
   If  alert.name = "Service Started" Then
   
    For Each action In alert.actions
      WScript.Echo action.name & VbCrLf  & action.enabled & VbCrLf & action.type

    Next
        '' alert.Actions.SetSendMail "SendMail", "MailServer", "firewall", "mike@northwindtraders.com"
      'CheckError
      'alert.Actions.Save
      'CheckError
   End If
    
   Next
   WScript.Echo "Done!"
   WScript.Sleep 60000
End Sub
Sub CheckError()
   If Err.Number <> 0 Then
       WScript.Echo "An error occurred: 0x" & Hex(Err.Number) & " " & Err.Description
       Err.Clear
   End If
End Sub
ConfigureAlerts 

Thanks for looking
Paul
Post #: 1

Page:   [1] << Older Topic    Newer Topic >>
All Forums >> [ISA 2006 Misc.] >> ISA 2006 Programming >> Isa2006 FPC AlertAction enabling problem Page: [1]
Jump to:

New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts