<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Does anyone have a batch script to change the pooling paramaters of all services in a AGS Enterprise folder? in Publishing and Managing Services Questions</title>
    <link>https://community.esri.com/t5/publishing-and-managing-services-questions/does-anyone-have-a-batch-script-to-change-the/m-p/1031821#M339</link>
    <description>&lt;P&gt;I have 80 services which are hardly used. I want to set the pooling parameter to Min=0 and Max=2 for all services using a batch script. Would anyone know how to do this?&lt;/P&gt;</description>
    <pubDate>Tue, 02 Mar 2021 08:25:47 GMT</pubDate>
    <dc:creator>RobertBuckley1</dc:creator>
    <dc:date>2021-03-02T08:25:47Z</dc:date>
    <item>
      <title>Does anyone have a batch script to change the pooling paramaters of all services in a AGS Enterprise folder?</title>
      <link>https://community.esri.com/t5/publishing-and-managing-services-questions/does-anyone-have-a-batch-script-to-change-the/m-p/1031821#M339</link>
      <description>&lt;P&gt;I have 80 services which are hardly used. I want to set the pooling parameter to Min=0 and Max=2 for all services using a batch script. Would anyone know how to do this?&lt;/P&gt;</description>
      <pubDate>Tue, 02 Mar 2021 08:25:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/publishing-and-managing-services-questions/does-anyone-have-a-batch-script-to-change-the/m-p/1031821#M339</guid>
      <dc:creator>RobertBuckley1</dc:creator>
      <dc:date>2021-03-02T08:25:47Z</dc:date>
    </item>
    <item>
      <title>Re: Does anyone have a batch script to change the pooling paramaters of all services in a AGS Enterprise folder?</title>
      <link>https://community.esri.com/t5/publishing-and-managing-services-questions/does-anyone-have-a-batch-script-to-change-the/m-p/1031858#M340</link>
      <description>&lt;P&gt;You could edit this script to loop through your&amp;nbsp; services. &lt;A href="https://enterprise.arcgis.com/en/server/latest/administer/windows/example-edit-service-properties.htm" target="_blank" rel="noopener"&gt;Example Edit Service Properties&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Mar 2021 11:42:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/publishing-and-managing-services-questions/does-anyone-have-a-batch-script-to-change-the/m-p/1031858#M340</guid>
      <dc:creator>DavinWalker2</dc:creator>
      <dc:date>2021-03-02T11:42:14Z</dc:date>
    </item>
    <item>
      <title>Re: Does anyone have a batch script to change the pooling paramaters of all services in a AGS Enterprise folder?</title>
      <link>https://community.esri.com/t5/publishing-and-managing-services-questions/does-anyone-have-a-batch-script-to-change-the/m-p/1031968#M341</link>
      <description>&lt;P&gt;This is exactly the script that I have been trying to adapt. I can't seem to find one which loops through an AGS Folder though.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Mar 2021 16:16:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/publishing-and-managing-services-questions/does-anyone-have-a-batch-script-to-change-the/m-p/1031968#M341</guid>
      <dc:creator>RobertBuckley1</dc:creator>
      <dc:date>2021-03-02T16:16:29Z</dc:date>
    </item>
    <item>
      <title>Re: Does anyone have a batch script to change the pooling paramaters of all services in a AGS Enterprise folder?</title>
      <link>https://community.esri.com/t5/publishing-and-managing-services-questions/does-anyone-have-a-batch-script-to-change-the/m-p/1032275#M342</link>
      <description>&lt;P&gt;Use the python API.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/python/api-reference/arcgis.gis.server.html#service" target="_blank"&gt;https://developers.arcgis.com/python/api-reference/arcgis.gis.server.html#service&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Specifically an edit operation against the GIS admin service object. You would parse back the exact same JSON properties with your edits to minInstancePerNode and maxInstancePerNode.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/python/guide/managing-your-gis-servers/#Administering-services" target="_blank"&gt;https://developers.arcgis.com/python/guide/managing-your-gis-servers/#Administering-services&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Here is the section of the guide that introduces the object.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Mar 2021 00:27:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/publishing-and-managing-services-questions/does-anyone-have-a-batch-script-to-change-the/m-p/1032275#M342</guid>
      <dc:creator>AngusHooper1</dc:creator>
      <dc:date>2021-03-03T00:27:21Z</dc:date>
    </item>
    <item>
      <title>Re: Does anyone have a batch script to change the pooling paramaters of all services in a AGS Enterprise folder?</title>
      <link>https://community.esri.com/t5/publishing-and-managing-services-questions/does-anyone-have-a-batch-script-to-change-the/m-p/1032301#M343</link>
      <description>&lt;P&gt;Add a for loop like in this script.&amp;nbsp;&lt;A href="https://enterprise.arcgis.com/en/server/latest/administer/linux/example-stop-or-start-all-services-in-a-folder.htm" target="_self"&gt;Example Stop or Start All Services in a folder&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Mar 2021 03:20:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/publishing-and-managing-services-questions/does-anyone-have-a-batch-script-to-change-the/m-p/1032301#M343</guid>
      <dc:creator>DavinWalker2</dc:creator>
      <dc:date>2021-03-03T03:20:33Z</dc:date>
    </item>
    <item>
      <title>Re: Does anyone have a batch script to change the pooling paramaters of all services in a AGS Enterprise folder?</title>
      <link>https://community.esri.com/t5/publishing-and-managing-services-questions/does-anyone-have-a-batch-script-to-change-the/m-p/1032318#M344</link>
      <description>&lt;P&gt;This is my script ...but the properties do not get&amp;nbsp; changed. Anyone know why?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# For Http calls&lt;BR /&gt;import httplib, urllib, json&lt;/P&gt;&lt;P&gt;# For system tools&lt;BR /&gt;import sys&lt;/P&gt;&lt;P&gt;# For reading passwords without echoing&lt;BR /&gt;import getpass&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;# Defines the entry point into the script&lt;BR /&gt;def main(argv=None):&lt;BR /&gt;# Print some info&lt;BR /&gt;print&lt;BR /&gt;print "This tool is a sample script"&lt;BR /&gt;print&lt;BR /&gt;&lt;BR /&gt;# Ask for admin/publisher user name and password&lt;BR /&gt;username = "xxx"&lt;BR /&gt;password = "xxx"&lt;BR /&gt;&lt;BR /&gt;# Ask for server name&lt;BR /&gt;serverName = "xxx"&lt;BR /&gt;serverPort = 6080&lt;/P&gt;&lt;P&gt;folder = 'Geobasisdaten'&lt;BR /&gt;&lt;BR /&gt;# Get a token&lt;BR /&gt;token = getToken(username, password, serverName, serverPort)&lt;BR /&gt;if token == "":&lt;BR /&gt;print "Could not generate a token with the username and password provided."&lt;BR /&gt;return&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;folderURL = "/arcgis/admin/services/commandx/"&lt;BR /&gt;&lt;BR /&gt;# This request only needs the token and the response formatting parameter&lt;BR /&gt;params = urllib.urlencode({'token': token, 'f': 'json'})&lt;BR /&gt;&lt;BR /&gt;headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain"}&lt;BR /&gt;&lt;BR /&gt;# Connect to URL and post parameters&lt;BR /&gt;httpConn = httplib.HTTPConnection(serverName, serverPort)&lt;BR /&gt;httpConn.request("POST", folderURL, params, headers)&lt;BR /&gt;&lt;BR /&gt;# Read response&lt;BR /&gt;response = httpConn.getresponse()&lt;BR /&gt;if (response.status != 200):&lt;BR /&gt;httpConn.close()&lt;BR /&gt;print "Could not read folder information."&lt;BR /&gt;return&lt;BR /&gt;else:&lt;BR /&gt;data = response.read()&lt;BR /&gt;&lt;BR /&gt;# Check that data returned is not an error object&lt;BR /&gt;if not assertJsonSuccess(data):&lt;BR /&gt;print "Error when reading folder information. " + str(data)&lt;BR /&gt;else:&lt;BR /&gt;print "Processed folder information successfully. Now processing services..."&lt;/P&gt;&lt;P&gt;# Deserialize response into Python object&lt;BR /&gt;dataObj = json.loads(data)&lt;BR /&gt;httpConn.close()&lt;/P&gt;&lt;P&gt;# Loop through each service in the folder and stop or start it&lt;BR /&gt;for item in dataObj['services']:&lt;/P&gt;&lt;P&gt;# Edit desired properties of the service&lt;BR /&gt;dataObj["minInstancesPerNode"] = 0&lt;BR /&gt;dataObj["maxInstancesPerNode"] = 2&lt;/P&gt;&lt;P&gt;# Serialize back into JSON&lt;BR /&gt;updatedSvcJson = json.dumps(dataObj)&lt;/P&gt;&lt;P&gt;# Call the edit operation on the service. Pass in modified JSON.&lt;BR /&gt;editSvcURL = folderURL + str(item["serviceName"])+ ".MapServer" + "/edit"&lt;BR /&gt;print editSvcURL&lt;BR /&gt;params = urllib.urlencode({'token': token, 'f': 'json', 'service': updatedSvcJson})&lt;BR /&gt;&lt;BR /&gt;httpConn.request("POST", editSvcURL, params, headers)&lt;BR /&gt;&lt;BR /&gt;# Read service edit response&lt;BR /&gt;editResponse = httpConn.getresponse()&lt;BR /&gt;if (editResponse.status != 200):&lt;BR /&gt;httpConn.close()&lt;BR /&gt;print "Error while executing edit."&lt;BR /&gt;return&lt;BR /&gt;else:&lt;BR /&gt;editData = editResponse.read()&lt;BR /&gt;&lt;BR /&gt;# Check that data returned is not an error object&lt;BR /&gt;if not assertJsonSuccess(editData):&lt;BR /&gt;print "Error returned while editing service" + str(editData)&lt;BR /&gt;else:&lt;BR /&gt;print "Service edited successfully."&lt;/P&gt;&lt;P&gt;httpConn.close()&lt;BR /&gt;&lt;BR /&gt;return&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;# A function to generate a token given username, password and the adminURL.&lt;BR /&gt;def getToken(username, password, serverName, serverPort):&lt;BR /&gt;# Token URL is typically http://server[:port]/arcgis/admin/generateToken&lt;BR /&gt;tokenURL = "/arcgis/admin/generateToken"&lt;BR /&gt;&lt;BR /&gt;params = urllib.urlencode({'username': username, 'password': password, 'client': 'requestip', 'f': 'json'})&lt;BR /&gt;&lt;BR /&gt;headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain"}&lt;BR /&gt;&lt;BR /&gt;# Connect to URL and post parameters&lt;BR /&gt;httpConn = httplib.HTTPConnection(serverName, serverPort)&lt;BR /&gt;httpConn.request("POST", tokenURL, params, headers)&lt;BR /&gt;&lt;BR /&gt;# Read response&lt;BR /&gt;response = httpConn.getresponse()&lt;BR /&gt;if (response.status != 200):&lt;BR /&gt;httpConn.close()&lt;BR /&gt;print "Error while fetching tokens from admin URL. Please check the URL and try again."&lt;BR /&gt;return&lt;BR /&gt;else:&lt;BR /&gt;data = response.read()&lt;BR /&gt;httpConn.close()&lt;BR /&gt;&lt;BR /&gt;# Check that data returned is not an error object&lt;BR /&gt;if not assertJsonSuccess(data):&lt;BR /&gt;return&lt;BR /&gt;&lt;BR /&gt;# Extract the token from it&lt;BR /&gt;token = json.loads(data)&lt;BR /&gt;return token['token']&lt;/P&gt;&lt;P&gt;# A function that checks that the input JSON object&lt;BR /&gt;# is not an error object.&lt;BR /&gt;def assertJsonSuccess(data):&lt;BR /&gt;obj = json.loads(data)&lt;BR /&gt;if 'status' in obj and obj['status'] == "error":&lt;BR /&gt;print "Error: JSON object returns an error. " + str(obj)&lt;BR /&gt;return False&lt;BR /&gt;else:&lt;BR /&gt;return True&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;# Script start&lt;BR /&gt;if __name__ == "__main__":&lt;BR /&gt;sys.exit(main(sys.argv[1:]))&lt;/P&gt;</description>
      <pubDate>Wed, 03 Mar 2021 06:42:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/publishing-and-managing-services-questions/does-anyone-have-a-batch-script-to-change-the/m-p/1032318#M344</guid>
      <dc:creator>RobertBuckley1</dc:creator>
      <dc:date>2021-03-03T06:42:57Z</dc:date>
    </item>
    <item>
      <title>Re: Does anyone have a batch script to change the pooling paramaters of all services in a AGS Enterprise folder?</title>
      <link>https://community.esri.com/t5/publishing-and-managing-services-questions/does-anyone-have-a-batch-script-to-change-the/m-p/1032353#M345</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Somewhat off topic but I'll share for your consideration anyway.&amp;nbsp; If your version of ArcGIS Enterprise supports shared instances, suggest changing all your infrequently used services from dedicated to shared pool.&amp;nbsp; In our Enterprise this has improved overall computing resource utilization at the cost of supporting a few ArcSOC processes that are fairly large resource consumers.&amp;nbsp; The major benefit has been an overall reduction in the number of ArcSOC processes running and the ability to host more services without running up against heap space limits in the Windows OS.&lt;/P&gt;&lt;P&gt;Now a question:&amp;nbsp; Who has a script to change existing dedicated service to shared pool.&lt;/P&gt;&lt;P&gt;Todd&lt;/P&gt;</description>
      <pubDate>Wed, 03 Mar 2021 10:20:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/publishing-and-managing-services-questions/does-anyone-have-a-batch-script-to-change-the/m-p/1032353#M345</guid>
      <dc:creator>Todd_Metzler</dc:creator>
      <dc:date>2021-03-03T10:20:10Z</dc:date>
    </item>
  </channel>
</rss>

