Skip to main content
Solved

check if media agent can rebooted


Forum|alt.badge.img+8

Hi! 

Is there a way to check if media agent has on-going activity? Don’t see any API for job controller or media agent call that can be used. 

 

I’m struggling with automatic patching for backup infrastructure but want to avoid interfering with client backup jobs or stuck LTO tapes as a result of reboot in the middle of write. So want to check if media agent is in use in a loop and reboot if no job is actually running. 

 

Thanks.

 

Best answer by Sinan Kerim Caliskan

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/

View original
Did this answer your question?

4 replies

Scott Moseman
Vaulter
Forum|alt.badge.img+18

You could put the MA into Maintenance Mode using APIs.


https://api.commvault.com/docs/SP36/api/cv/Storage/update-media-agent-properties/

Thanks,
Scott


Forum|alt.badge.img+8
  • Author
  • Byte
  • 52 replies
  • April 23, 2025

Yup, that part is quite easy. What I missing is to detect when there is no activity on media agent so i can do patching and reboot without client impact.  


Forum|alt.badge.img+1

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/


Forum|alt.badge.img+8
  • Author
  • Byte
  • 52 replies
  • April 29, 2025

Hi Sinan,

Make sense. Thanks for your input. 

Digging around the API and python lib i correlated running job with media agent. See below code : 

 

from cvpysdk.commcell import Commcell
from cvpysdk.job import JobController
from cvpysdk.job import Job
import json

commcell = Commcell('secret', 'secret', 'secret', verify_ssl=False)
job_c = JobController(commcell)
for job in job_c.active_jobs():
      job_handler = Job(commcell,job)
      jobid = job_handler.details['jobDetail']['generalInfo']['jobId']
      operationType = job_handler.details['jobDetail']['generalInfo']['operationType']
      client =  job_handler.details['jobDetail']['generalInfo']['subclient']['clientName']
      try:
        ma = job_handler.details['jobDetail']['generalInfo']['mediaAgent']['mediaAgentName']
      except:
        ma = job_handler.details['jobDetail']['generalInfo']['destMediaAgent']['mediaAgentName']
      sp = job_handler.details['jobDetail']['generalInfo']['storagePolicy']['storagePolicyName']
      state = job_handler.details['jobDetail']['progressInfo']['state']
      #print(json.dumps(job_handler.details, indent=4))
      print("jobid %s - type %s - client %s - ma %s - sp %s - state %s"%(jobid,operationType,client,ma,sp,state))

#TODO:check if local MA is in use
#TODO:if yes set maintenance mode for 10m
#TODO:install updates and reboot

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings