Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: change trigger schedule Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
mustangcoupe
Super User
Super User
Avatar

Joined: August 08 2003
Location: United States
Online Status: Offline
Posts: 308
Posted: June 04 2006 at 20:44 | IP Logged Quote mustangcoupe

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.

How would I do this? deleate the trigger then recreate it?

__________________
Todd Hannemann

HA newbie

   PowerHome - UPB - ELK    
Back to Top View mustangcoupe's Profile Search for other posts by mustangcoupe Visit mustangcoupe's Homepage
 
theowl
Groupie
Groupie
Avatar

Joined: February 24 2006
Location: United States
Online Status: Offline
Posts: 59
Posted: June 05 2006 at 17:46 | IP Logged Quote theowl

If I'm understanding what you want to do correctly, it's something like this...

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 View theowl's Profile Search for other posts by theowl
 
mustangcoupe
Super User
Super User
Avatar

Joined: August 08 2003
Location: United States
Online Status: Offline
Posts: 308
Posted: June 05 2006 at 18:33 | IP Logged Quote mustangcoupe

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.

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 View mustangcoupe's Profile Search for other posts by mustangcoupe Visit mustangcoupe's Homepage
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: June 05 2006 at 19:14 | IP Logged Quote TonyNo

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 View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
mustangcoupe
Super User
Super User
Avatar

Joined: August 08 2003
Location: United States
Online Status: Offline
Posts: 308
Posted: June 05 2006 at 21:42 | IP Logged Quote mustangcoupe

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 View mustangcoupe's Profile Search for other posts by mustangcoupe Visit mustangcoupe's Homepage
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: June 05 2006 at 22:16 | IP Logged Quote TonyNo

I thought you started with Timed Event!

Check here.
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
mustangcoupe
Super User
Super User
Avatar

Joined: August 08 2003
Location: United States
Online Status: Offline
Posts: 308
Posted: June 05 2006 at 23:04 | IP Logged Quote mustangcoupe

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)

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 View mustangcoupe's Profile Search for other posts by mustangcoupe Visit mustangcoupe's Homepage
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

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