A user asked about using ControlUp Triggers to restart a service after a VM boot up. Options discussed include Uptime in Minutes and Status column triggers, but it may be best to use a Scheduled Task in the VM. Advice was given to be careful with the equals operator, as it is risky for numeric values like uptime. A further suggestion was to use BIS-F with a custom script looping until the service is started.
Read the entire ‘Leveraging ControlUp Triggers to Restart Services After VM Boot Up’ thread below:
I’m trying to see if I can leverage ControlUP’s Triggers to restart a service after the VM boots up. I created a trigger to run a simple script when the uptime changes from 60 seconds, to 75 seconds. It never fires for some reason. I assume the monitors are scanning every 5 minutes or so…and missing the window of opportunity. It there a different way to go about this?
Correct, the monitors are on a 5 minute interval. When a agent disconnects the monitors wait until the next interval to attempt to reconnect.
You may be able to use Uptime in Minutes as a trigger.
I used Uptime in minutes as well. Nothing triggers. I really need a consistent way to ensure the service is restarted prior to user login.
It would have to be like greater than 6 to account for the 5 minute poll.
Another option may be the "Status" column.
UGH. OK. Scheduled Task in the VM it is… Thanks!
When Status = Ready.
Just FYI, in 9.0 agents will contact the monitors on start so should be alot quicker.
For the Status = Ready idea… you mean like this?
Yep!
in general be careful with the equals operator. Your trigger won’t fire unless:
• The previous state has the machine uptime at exactly 1 minute
• The next state has the machine uptime at exactly 1 min, 15 seconds.
It’s pretty rare for that scenario to happen. General tips in terms of triggers:
Previous state
Unless you actually care about the previous state, just leave the "from this state" selector empty. I’ve worked with CU daily for the last ~5 years and I think I’ve encountered a single good use case for the previous state. A trigger that only wants to do something when a user goes from idle > active. As in, the previous status is important to the functionality.
Equals operator.
The equal operator is risky for numeric values. Or volatile values. It is very useful for things like power status. But for metrics like uptime? You’re risking that you’re creating very specific scenarios you need to hit.
For uptime in particular. Remember that uptime is calculated (at least for agent based uptime, VM only data uptime is different) from the machines boot time, as determined by windows.
It could be that by the time the cuagent has started, uptime could already be at 2 minutes. Might be a bit extreme but you get my point.
Are we talking Citrix and are you using BIS-F by chance?
If yes, you can create a custom script for personalization phase which loops until the service is started.
Last thing BISF does is starting Broker Service so no users until that happens 🙂
Continue reading and comment on the thread ‘Leveraging ControlUp Triggers to Restart Services After VM Boot Up’. Not a member? Join Here!
Categories: All Archives, ControlUp Scripts & Triggers