Maintenance Timer

Anyone have an idea of a script for a timer or stopwatch that would start and stop on the run cycle of a pump. The pump has a tag that shows its run status. The idea is to have it count up and alarm user defined intervals as the pump or motor approaches its maintenance due date. Then once the maintenance is done a user could reset the timer to zero and then the process would repeat.