Hi @JobyJob
Yes, there are several ways to directly create a custom alert using the APIs provided by Dynatrace when a script fails.
POST https://{environmentid}.live.dynatrace.com/api/v1/events
Alternatively, if your script sends logs, you can forward those logs to Dynatrace and then trigger an alert based on them.
POST https://{environmentid}.live.dynatrace.com/api/v2/logs/ingest