We have batch jobs written in shell script which takes a while to complete, and sometime fails to complete.
1. How could we send the data (start time, end time, completion time) for charting in Dashboard; hopefully dynatrace can auto baseline and alert if any deviation in completion time.
2. and also in the event of failure we need Problem to be created in Dynatrace.
Note: If we use API to send custom metrics, it has to be done at the completion of the batch, but in the event the job crashes, it will never reaches the part where it calls API, then we would miss the metric and any notifications. So is there any other solution to achieve our goal other than API.
I don't know your particular script, but I'd try to write a helper "daemon" in a language that's supported by deep monitoring and OneAgent-SDK and call the daemon to process any start/finish events (or other functions). Dynatrace would trace the requests as purepaths (you could pass additional info such as batch job ID/name) and capture them.
However I'm not sure if automated baselines will work in this case if the batch jobs are not frequent.