Not sure that publish function is the best place to do this, but it's where you're calculating timeout and countdown times which are local - but we need to alarm (warning) when countdown reaches 1 ...
Not sure that publish function is the best place to do this, but it's where you're calculating timeout and countdown times which are local - but we need to alarm (warning) when countdown reaches 1 minute (60 secs) and we need to alarm more severely when countdown reaches 0 secs.
If you make the 2 times static (not local here), you can call a monitor function from exec and do the calculations for the times and trigger alarms in the monitor function. Then, here in publish function, you would just publish the static times (no need to calculate because it's already done all the time).