AFAIK some third party monitor applications are able to do what you need, although I don't have any experience with them.
If you want to build your own solution you should take this approach:
- Query the msdb..sysjobhistory table and extract all durations for all (succesfull) jobruns. Calculate the average for each job. Create a monitoring job that takes all running jobs from the msdb..sysjobactivity table, looks at the start_execution_date and calculate the current duration. Generate a warning when the threshold is reached.
Because the msdb..sysjobhistory is cleaned regularly, you could end up with too little information about jobruns from the past. So perhaps you should periodically copy the msdb..sysjobhistory table to a staging table.
** Don't mistake the ‘stupidity of the crowd’ for the ‘wisdom of the group’! **