A way / tool to count the number of allocated max\min instances for all published services

2341
33
Jump to solution
04-07-2017 10:12 AM
rawansaleh1
Occasional Contributor III

I couldn’t figure out if there are a tool or a way to count the number of allocated max\min instances for all published services. See below

 

Best Regards,

Rawan

0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable

Good Morning Rawan,

Check and download the attached python file and try to run it.

No need to spend time on format this code. 

https://community.esri.com/docs/DOC-9922-arcgis-server-map-service-properties 

View solution in original post

33 Replies
JonathanQuinn
Esri Frequent Contributor

You can look into writing a python script to get the "minInstancesPerNode" and "maxInstancesPerNode" properties from the Admin API:

https://<server>.<domain>.com:6443/arcgis/admin/services/SampleWorldCities.MapServer?f=pjson

rawansaleh1
Occasional Contributor III

Dear Jonthan,

 

Thanks for you reply,I need this to be applied on all services.

How could I add a python script  to get the "minInstancesPerNode" and "maxInstancesPerNode" properties from the Admin API:?

I opened this link, and logins as admin but I couldn’t made any changes, maybe I misunderstand this point.

Best Regards,

Rawan

0 Kudos
JonathanQuinn
Esri Frequent Contributor

You're at the Rest API, not the Admin API:

https://<server>.<domain>.com:6443/arcgis/admin/services/SampleWorldCities.MapServer?f=pjson

The bolded section is the URL to the Admin API.  Log in with administrative credentials to make changes.

I would start with looking at the overview of scripting administration of your Server, and the specific examples of editing service properties and checking a folder for stopped services for pieces of code you can use.

rawansaleh1
Occasional Contributor III

Dear Jonathan,

 

Thanks for your help, I can access to the Admin API but I need to count the number of allocated max\min instances for all published services, not for a specific one.

How could I do apply this for all of them in one go?

 

Best,

Rawan

0 Kudos
JonathanQuinn
Esri Frequent Contributor

Have you been able to review the samples I mentioned, specifically checking a folder for stopped services?

# Loop through each service in the folder and stop or start it 
for item in dataObj['services']: 
  fullSvcName = item['serviceName'] + "." + item['type']

  # Construct URL to stop or start service, then make the request                
  statusURL = "/arcgis/admin/services/" + folder + fullSvcName + "/status"

The section above is where it will loop through every service, construct the URL to the service, and check the status.  You'll want to modify that to grab the JSON of the service, loop through the key:value pairs to find the keys you need, and return them by printing them or writing them to a file.

0 Kudos
rawansaleh1
Occasional Contributor III

Dear Jonthan,

many thanks for your answer, actually I walked through them but I couldn’t deal with them.

I will try to do this. Today. & update you.

Best,

Rawan

0 Kudos
rawansaleh1
Occasional Contributor III

Dear Jonathan,

I could be noisy, but when I tried to login in Generate token to write the python it gives me the following error.

What could be the reason for that.

 

Best,

Rawan

0 Kudos
JonathanQuinn
Esri Frequent Contributor

That's not an error, that's the token.  You can append the token to requests to the Admin API to authenticate.

rawansaleh1
Occasional Contributor III

Dear Jonathan,

 

Thank you for your reply, but I struggling with the begin.

I ‘m not sure from where I can add my code to get my information.

 

Any advice?

Best,

Rawan

0 Kudos