A discovery schedule can be configured to have a "max run time". The discovery will be automatically cancelled if this max run time is reached.
Discovery Cancellation Process Overview
A couple of important script includes are called when a discovery is created:
StartDiscovery creates a scheduled job(sys_trigger record) to cancel the discovery. The following is an example scheduled job created to cancel a discovery:
The scripts will also log to "System Logs" that the discovery will be cancelled and at what time:
If the discovery is not cancelled as expected, the following can be done for troubleshooting.
- Check that script includes Discovery and StartDiscovery are OOB.
- Check that the cancellation scheduled jobs are being created as expected, a test discovery can be run to confirm this.
- Search the "System Logs > System Log > All" for "Cancelling Discovery <discovery_status_number>" (replace with the actual discovery number).
- If the "Cancelling Discovery ..." message is found, then the mechanism to cancel the discovery was successful.
- Check that there were no performance issues at the time the discovery should have been cancelled and that the workers were not behind (unlikely to happen).