Solved

MediaAgent running jobs


Userlevel 3
Badge +12

Hi Guys,

 

Hope everyone is doing good.

Is there in windows command to be used on the MA to check if there are any running jobs on that MA ?

 

Kind regards.

icon

Best answer by Onno van den Berg 25 May 2022, 10:36

View original

22 replies

Userlevel 6
Badge +15

Good morning.  There is no way to do this from Windows as Windows would only see processes.  

Userlevel 7
Badge +16

You could use powershell to tail a log file.

For example:

Get-Content <log file path\filename> -Wait

You can also filter on specific keywords by using:

Get-Content <log file path\filename> -Wait | where { $_ -match “Enter what you want to filter on” }

But this will not report a list, this will only provide insight just as gxtail would.
Depending on the log selection it will show you job id's.
It would be easier to use the java gui in my honest opinion, then you can sort/filter on the media agent column within the Job Controller.

Userlevel 6
Badge +15

You could go to Command Center and filter the clients based on “Last backed up”.

Userlevel 3
Badge +12

You could use powershell to tail a log file.

For example:

Get-Content <log file path\filename> -Wait

You can also filter on specific keywords by using:

Get-Content <log file path\filename> -Wait | where { $_ -match “Enter what you want to filter on” }

But this will not report a list, this will only provide insight just as gxtail would.
Depending on the log selection it will show you job id's.
It would be easier to use the java gui in my honest opinion, then you can sort/filter on the media agent column within the Job Controller.

Thanks, @Jos Meijer, the objective for the info, is to confirm that there is no running jobs on that specific MA in order to be able to power it off. Note that the MA will only get Aux copies from another MA.

Is there any way to automate this ? With an internal script to power off the MA ? Or regroup all the aux copies into one workflow and after finishing all the aux copies, run a script on the workflow to power off the MA ?

Any suggestion would be great ! :)

Userlevel 7
Badge +19

@Commvault Engineer are you using partitioned DDB's and have you configured them to allow to run the DDB on one partition? reason for asking is that Commvault will only report the MA that is involved in the processing of the job but it will not report if it has to perform DDB lookups to its neighbor MA that is part of the partitioned DDB. turning off the "passive” node would in that case stop all backup activity because by default it requires all members to be online. 

Easiest way to achieve what you want to do, is to leverage the APIs and consume them through the Powershell SDK or the Python SDK. Alternatively you could run a qscript on the command line on the MA and parse the output of a qscript → "qoperation execscript -sn GetAllRunningJobs".

 

Userlevel 3
Badge +12

@Commvault Engineer are you using partitioned DDB's and have you configured them to allow to run the DDB on one partition? reason for asking is that Commvault will only report the MA that is involved in the processing of the job but it will not report if it has to perform DDB lookups to its neighbor MA that is part of the partitioned DDB. turning off the "passive” node would in that case stop all backup activity because by default it requires all members to be online. 

Easiest way to achieve what you want to do, is to leverage the APIs and consume them through the Powershell SDK or the Python SDK. Alternatively you could run a qscript on the command line on the MA and parse the output of a qscript → "qoperation execscript -sn GetAllRunningJobs".

 

Hi @Onno van den Berg 

Thanks for the reply.

Actually, the main purpose is just to be able to power off a remote MA which will receive multiple Aux Copies. I know it's possible to automate and achieve this through workflows.

Theoretically, I got the scenario of how it can happen, but I’m not used to workflows, unfortunately.

I wanted to create and schedule a workflow which checks if there is any Aux Copy running on the remote MA, if it founds that there is still some, the workflow ends. If no Aux Copy is running, then ask the remote MA to execute a command to Power OFF itself.

Userlevel 7
Badge +19

I hope your Windows VM runs virtualized on VMware, because in that case you could look at a feature called power management which exactly does this trick, even while taking into account AUX-copies https://documentation.commvault.com/11.26/essential/101313_cloud_mediaagent_power_management.html

In case you are running it on physical hardware or virtualized on an unsupported hypervisor type than I would automate it through Powershell or Python and stay away from workflows. The amount of people who have great understanding of workflows while the audience who know how to right code in either PS or Python is so much bigger. 

Userlevel 3
Badge +12

I hope your Windows VM runs virtualized on VMware, because in that case you could look at a feature called power management which exactly does this trick, even while taking into account AUX-copies https://documentation.commvault.com/11.26/essential/101313_cloud_mediaagent_power_management.html

In case you are running it on physical hardware or virtualized on an unsupported hypervisor type than I would automate it through Powershell or Python and stay away from workflows. The amount of people who have great understanding of workflows while the audience who know how to right code in either PS or Python is so much bigger. 

Yes, we are using Virtualized MA VMs, but they are not in the cloud, which as per my understanding Power Management is not feasible in this case.

Userlevel 7
Badge +19

@Commvault Engineer you are being mislead by the wording of the feature, because VMware is also supported ;-) You also have private CLOUDS ;-) 

See→ https://documentation.commvault.com/11.24/essential/101313_cloud_mediaagent_power_management.html#support-for-cloud-vendor-systems 

Userlevel 3
Badge +12

You could use powershell to tail a log file.

For example:

Get-Content <log file path\filename> -Wait

You can also filter on specific keywords by using:

Get-Content <log file path\filename> -Wait | where { $_ -match “Enter what you want to filter on” }

But this will not report a list, this will only provide insight just as gxtail would.
Depending on the log selection it will show you job id's.
It would be easier to use the java gui in my honest opinion, then you can sort/filter on the media agent column within the Job Controller.

Hi @Jos Meijer, just wondering if there is any qcommand to be used on CS level to list running jobs per MediaAgent ?

Userlevel 7
Badge +19

@Commvault Engineer check my previous post and/or search for it on the documentation page → https://documentation.commvault.com/11.26/expert/123654_available_qscripts.html

But I strongly recommend to leverage the APIs!

Userlevel 3
Badge +12

@Commvault Engineer check my previous post and/or search for it on the documentation page → https://documentation.commvault.com/11.26/expert/123654_available_qscripts.html

But I strongly recommend to leverage the APIs!

Thanks a lot @Onno van den Berg, and sorry for not giving you feedback about your previous post.

Actually, the client wants to manually automate the process without using nor Cloud controller nor APIs unfortunately, but only scripts.

The qscripts that you provided are really helpful, unfortunately didn’t find one which may give me the list of MediaAgent of the running jobs, so I thought of adding a description on the jobs that I need to filter, the description will be used as an ID for my filtering.

Userlevel 7
Badge +19

The qscript I gave you shows the MediaAgent that is running the job. But you'll have to parse it somehow correctly to make sure you extract the right information. Anyway API's are consumed through Powershell or Python so you could argue this is also some form of programming/scripting ;-)

 

 

Userlevel 3
Badge +12

The qscript I gave you shows the MediaAgent that is running the job. But you'll have to parse it somehow correctly to make sure you extract the right information. Anyway API's are consumed through Powershell or Python so you could argue this is also some form of programming/scripting ;-)

 

 

Thanks a lot @Onno van den Berg, the qscript that you shared previously were very helpful and that’s what we were searching for :).

Userlevel 3
Badge +12

The qscript I gave you shows the MediaAgent that is running the job. But you'll have to parse it somehow correctly to make sure you extract the right information. Anyway API's are consumed through Powershell or Python so you could argue this is also some form of programming/scripting ;-)

 

 

Thanks a lot @Onno van den Berg, the qscript that you shared previously were very helpful and that’s what we were searching for :).

Hi @Onno van den Berg 

Had another question if you don’t mind, from the qscript that you shared previously "qoperation execscript -sn GetAllRunningJobs", I can retrieve the list of all the running jobs with the list of used MAs as expected, is there a way (Maybe an option added to the command) to filter the output to only display the column of the MediaAgents ? That way, I can use findstr to filter only the list of the MAs that I need.

 

Userlevel 7
Badge +19

The qscript I gave you shows the MediaAgent that is running the job. But you'll have to parse it somehow correctly to make sure you extract the right information. Anyway API's are consumed through Powershell or Python so you could argue this is also some form of programming/scripting ;-)

 

 

Thanks a lot @Onno van den Berg, the qscript that you shared previously were very helpful and that’s what we were searching for :).

Hi @Onno van den Berg 

Had another question if you don’t mind, from the qscript that you shared previously "qoperation execscript -sn GetAllRunningJobs", I can retrieve the list of all the running jobs with the list of used MAs as expected, is there a way (Maybe an option added to the command) to filter the output to only display the column of the MediaAgents ? That way, I can use findstr to filter only the list of the MAs that I need.

 

@Commvault Engineer use the -format option and make sure the output is csv. this allows you much more easily to get consistent information. 

see → https://documentation.commvault.com/11.24/expert/45269_qoperation_execscript.html

Userlevel 2
Badge +8

 @Onno van den Berg 

Thanks in advance.

I’m getting an error while running this qscript :

 "qoperation execscript -sn GetAllRunningJobs"

"Failed at RunStringQuery_QS! Error: [Failed to execute SQL Script!]."

I was trying to run this using workflow , and the activity fails.

it give a list of jobs i can see that in the logs, but activity fails..

 

 

 

Userlevel 2
Badge +8

or is there an API for this operation?

GetAllRunningJobs

Userlevel 7
Badge +23

@alligator , there’s a few API options here:

https://api.commvault.com/#32817dcd-1d66-4857-8ff0-6b4a5b8e8fd5

GET job and a bunch more that should provide what you need 😎

Userlevel 2
Badge +8

@Mike Struening Thank you :)

somehow i’m not able to filter the DDB verification jobs

i tried filtering with jobCategory=Active & jobFilter=82,100,80 

as mentioned in 

https://documentation.commvault.com/v11/essential/105923_jobfilter_parameter_values.html

Also when i give jobFilter value as ALLOPS, its giving me null 

the output is empty

so ALLOPS means it must include all operations right , like backup/restore/ddb verification/Snapbackup etc

I’m looking to get the data of all active jobs at the moment when i’m running this API

 

Userlevel 2
Badge +8

@Mike Struening 
Also i think something is missing in this documentation 

What is the jobFilter value to use so that it returns all jobtypes?

in the documentation it says to give like this

All job types - for example, Job?clientId=2&jobFilter=

is this the right way, with jobFilter value empty?

https://documentation.commvault.com/v11/essential/47608_rest_api_get_job.html

 

Also this api doesn’t return the media agent in use for the active job :(, i was specifically looking for that

I dont see that in the response parameters 

Userlevel 7
Badge +23

I’ll talk to some of our devs about this and have someone get back to you 😎

Reply