| Author |  | 
      
        | mustangcoupe Super User
 
  
  
 Joined: August 08 2003
 Location: United States
 Online Status: Offline
 Posts: 308
 | 
          Id like to change the schedule of a trigger via a macro.  ex. I run a trigger every 1/2 hr but if the ip address isnt reachable I send an email to myself and then want to change the trigger to 8 hrs to give me time to get out of work and check it and not fill up my email box.  And if it fixes itself then I want to beable to get it back on it's 1/2 hr schedule.
           | Posted: June 04 2006 at 20:44 | IP Logged |   |  
           | 
 |  
 How would I do this? deleate the trigger then recreate it?
 
 __________________
 Todd Hannemann
 
 HA newbie
   
 
  PowerHome - UPB - ELK   | 
       
        | Back to Top |       | 
       
       
        |  | 
        | theowl Groupie
 
  
  
 Joined: February 24 2006
 Location: United States
 Online Status: Offline
 Posts: 59
 | 
          If I'm understanding what you want to do correctly, it's something like this...
           | Posted: June 05 2006 at 17:46 | IP Logged |   |  
           | 
 |  
 Check IP every 1/2 hour
 IP: OK - Continue 1/2 hour checks
 IP: Unreachable - Switch to 8 hr
 After 8 hours, do check again
 IP: OK - Switch to 1/2 hour checks
 IP: Unreachable - Continue 8 hr
 However, if IP comes back on it's own before the 8 hour mark, switch back to 1/2 hour checks.
 
 I'm not sure how to change the trigger via a macro, but perhaps you wouldn't have to if your goal is just to have it stop e-mailing you.
 
 Something like
 
 IP Unreachable - Send E-mail & Set Global IPBroke to 1
 
 Next time the 1/2 hour runs, it would hit an if statement
 
 1. if {IPBROKE} = 0 Jump 999
 2. Send E-mail
 
 This would allow the 1/2 hour checks to continue, but would only send you e-mail once and then set the IPBROKE to prevent further e-mails. If the situation corrects itself, just set IPBROKE back to 0. Next time there is an issue, you'll get an e-mail.
 
 Granted, this is only a concept but it's something I'd probably use to check on servers.
 
 Option 2
 
 Use two timed events (1/2 hr & 8 hr), only activate one at a time. I'm not at my PH machine right now, but I 'think' it's possible to disable a timed event.
 
 Hope some of this helps
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | mustangcoupe Super User
 
  
  
 Joined: August 08 2003
 Location: United States
 Online Status: Offline
 Posts: 308
 | 
          thanks theowl, but the code is part of a larger macro, and I will use global if I need to but I think there must be a better way.
           | Posted: June 05 2006 at 18:33 | IP Logged |   |  
           | 
 |  
 I check the ip address of a device on my network, and if it is there then I poll it for a webpage and email me the results if there is a problem with the data I get back from it.  If it is not there
  I dont want to keep getting emails all day, I just want to know once and then get it back on line when I get home from work. 
 But I still want it to check later incase it comes back on it's own then I could go back to the 1/2 hr checks....
 
 So If I could disable the trigger and then re-enable the trigger through the macro then I could just also create a single trigger that would run 8 hrs later.
 
 
 
 Edited by mustangcoupe - June 05 2006 at 18:35
 
 __________________
 Todd Hannemann
 
 HA newbie
   
 
  PowerHome - UPB - ELK   | 
       
        | Back to Top |       | 
       
       
        |  | 
        | TonyNo Moderator Group
 
  
  
 Joined: December 05 2001
 Location: United States
 Online Status: Offline
 Posts: 2889
 | 
          
           | Posted: June 05 2006 at 19:14 | IP Logged |   |  
           | 
 |  
| Quote: 
 
    
    | 
      
       | If I could disable the trigger and then re-enable the trigger through the macro then I could just also create a single trigger that would run 8 hrs later |  |  |  This is the key part. You can enable and disable triggers, you just can't create, delete, or reschedule them without using SQL (afaik).
 
 So, create two triggers, disable the "error" one, and then enable it when there is a problem.
 
 ph_disabletrigger( s )
 ph_enabletrigger( s )
 | 
       
        | Back to Top |       | 
       
       
        |  | 
        | mustangcoupe Super User
 
  
  
 Joined: August 08 2003
 Location: United States
 Online Status: Offline
 Posts: 308
 | 
          
           | Posted: June 05 2006 at 21:42 | IP Logged |   |  
           | 
 |   please dont slap me....  I have been saying trigger but I ment to say timed event!! 
 now for me to ask for help.... can anyone tell me how to either delete, reschedule or disable a timed event?
 
 __________________
 Todd Hannemann
 
 HA newbie
   
 
  PowerHome - UPB - ELK   | 
       
        | Back to Top |       | 
       
       
        |  | 
        | TonyNo Moderator Group
 
  
  
 Joined: December 05 2001
 Location: United States
 Online Status: Offline
 Posts: 2889
 | 
          I thought you started with Timed Event!
           | Posted: June 05 2006 at 22:16 | IP Logged |   |  
           | 
 |    
 Check here.
 | 
       
        | Back to Top |       | 
       
       
        |  | 
        | mustangcoupe Super User
 
  
  
 Joined: August 08 2003
 Location: United States
 Online Status: Offline
 Posts: 308
 | 
          Duh, I just figured out a simpler way... check Ip's in a if/then in a jump cmd then if it passes this in the next line  create a timed event in 30 min... and run the rest of the code, then have a second jump cmd that wil jump oven the next 2 lines... in those lines 1 create the email for the error, and line #2 create a timed event for 8 hrs later...(we will get to these two lines from jump #1)
           | Posted: June 05 2006 at 23:04 | IP Logged |   |  
           | 
 |  
 couldn't I make it easier if I tried?
   
 Edited by mustangcoupe - June 05 2006 at 23:07
 
 __________________
 Todd Hannemann
 
 HA newbie
   
 
  PowerHome - UPB - ELK   | 
       
        | Back to Top |       | 
       
       
        |  |