Hi Iborek,
I had a similar issue. It’s not the most efficient but you could figure out if a job is associated with your Media Agent over Client Computer Groups.
- Create a Client Computer Group with Automatic Association (for each Media Agent)
- Use “Associated Storage Policy List” as Rule Group then select Storage Policies using that Media Agent
I suggest selecting Storage Policies based on only primary copy because Auxiliary Copies might exist for days or weeks due to different environment configuration and this scenario might leave you no gap for a reboot. In my case, there was always an Auxiliary Copy job exist running or waiting so i didn’t include them.
Even with this you better put you MA in Maintenance Mode before reboot because if an SIDB process is running on your MA during reboot might trigger DDB Reconstruction job which might take days or weeks to complete in some scenarios.
Using API, check if any job is running with a Client Computer Group related to your Media Agent, then put your MA in Maintenance Mode and wait for a while to let MA stop its processes gracefully. If the given time was enough, the MA should be ready to go.
This might not work perfect for some situations like clients with different multiple storage policies, but you may consider as your last hope.
https://api.commvault.com/docs/SP36/api/cv/JobOperations/get-list-of-jobs/