<?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 Re: How can I collect total ArcGIS Server memory usage? in ArcGIS Enterprise Questions</title>
    <link>https://community.esri.com/t5/arcgis-enterprise-questions/how-can-i-collect-total-arcgis-server-memory-usage/m-p/200989#M7866</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I just finished writing a small script that lets me add the metric. I took the System Monitor help doc advice and instead of setting up a collector for this I'm grabbing the value with a python script and putting it into a table in a database which is queried like anything else from a database in SM. I made a table that isnt part of the geodatabase in our production environment and then execute the tasklist for ArcSOC and javaw on the two servers in our publication environment. That is returned as text so I broke it down to an integer to stick in the database. The table in the database is called SERVERMONITORMETRICS and has two columns, COUNTER and VALUE. pypyodbc updates the corresponding rows in the database and SM grabs those values. Windows Task Scheduler has the script run every 5 minutes. Might be an easier way to do it but this works for me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; pypyodbc&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; subprocess

PUBAGSMEMORY &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; sum&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;int&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;i&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;split&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;' '&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;replace&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;','&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;''&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; i &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; subprocess&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;check_output&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'TASKLIST /s xx.xx.xx.xx /FO LIST /FI "Imagename eq ArcSOC.exe"'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;split&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'\n'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Mem Usage:'&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; i&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; sum&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;int&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;i&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;split&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;' '&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;replace&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;','&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;''&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; i &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; subprocess&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;check_output&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'TASKLIST /s xx.xx.xx.xx /FO LIST /FI "Imagename eq javaw.exe"'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;split&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'\n'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Mem Usage:'&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; i&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
FOAGSMEMORY &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; sum&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;int&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;i&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;split&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;' '&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;replace&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;','&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;''&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; i &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; subprocess&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;check_output&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'TASKLIST /s xx.xx.xx.xx /FO LIST /FI "Imagename eq ArcSOC.exe"'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;split&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'\n'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Mem Usage:'&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; i&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; sum&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;int&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;i&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;split&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;' '&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;replace&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;','&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;''&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; i &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; subprocess&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;check_output&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'TASKLIST /s xx.xx.xx.xx /FO LIST /FI "Imagename eq javaw.exe"'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;split&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'\n'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Mem Usage:'&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; i&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

db &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; pypyodbc&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;connect&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Driver={SQL Server}; Server=bay-arcgis-pro; Database=sde; Uid=*****; Pwd=*****;'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
cursor &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; db&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;cursor&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
query &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'''
UPDATE sde.SERVERMONITORMETRICS
SET VALUE = %s
WHERE COUNTER = 'PUB AGS MEMORY'

UPDATE sde.SERVERMONITORMETRICS
SET VALUE = %s
WHERE COUNTER = 'FO AGS MEMORY'
'''&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;%&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;PUBAGSMEMORY&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; FOAGSMEMORY&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

cursor&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;execute&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;query&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
cursor&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;commit&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;del&lt;/SPAN&gt; cursor&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; db
&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 10:00:22 GMT</pubDate>
    <dc:creator>ChrisMathers1</dc:creator>
    <dc:date>2021-12-11T10:00:22Z</dc:date>
    <item>
      <title>How can I collect total ArcGIS Server memory usage?</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/how-can-i-collect-total-arcgis-server-memory-usage/m-p/200986#M7863</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I want to include AGS memory use in System Monitor but the way each service spins up its own thread makes measuring it a bit tricky since the memory load is spread out. Currently on AGS 10.2.2 but will shortly be updating to 10.5 if that makes a difference.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Feb 2017 16:31:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/how-can-i-collect-total-arcgis-server-memory-usage/m-p/200986#M7863</guid>
      <dc:creator>ChrisMathers1</dc:creator>
      <dc:date>2017-02-13T16:31:49Z</dc:date>
    </item>
    <item>
      <title>Re: How can I collect total ArcGIS Server memory usage?</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/how-can-i-collect-total-arcgis-server-memory-usage/m-p/200987#M7864</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can run a .bat file that runs the &lt;A href="https://technet.microsoft.com/en-us/library/bb491010.aspx"&gt;TASKLIST command&lt;/A&gt; and provide a filter to find all ArcSOC.exe processes as well as javaw.exe processes:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ex of ArcSOC.exe&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;TASKLIST /M /FI "Imagename eq ArcSOC.exe"&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can probably parse the output through the command prompt, or write the response to disk and parse it there.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Feb 2017 17:36:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/how-can-i-collect-total-arcgis-server-memory-usage/m-p/200987#M7864</guid>
      <dc:creator>JonathanQuinn</dc:creator>
      <dc:date>2017-02-13T17:36:07Z</dc:date>
    </item>
    <item>
      <title>Re: How can I collect total ArcGIS Server memory usage?</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/how-can-i-collect-total-arcgis-server-memory-usage/m-p/200988#M7865</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/people/JQuinn-esristaff"&gt;JQuinn-esristaff&lt;/A&gt;&amp;nbsp;, if I used the /M (or /m) it only returned the Image Name, Pid, and Modules (which showed N/A for all).&amp;nbsp; If I left the /M off, it showed me memory used.&amp;nbsp; Any simple way to tie this back to the service, as I assume Chris is asking?&amp;nbsp; My apology that is not what is being asked...not trying hijack this thread, but this would be handy for me too.&amp;nbsp; Any other admin tools for this??&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Feb 2017 20:04:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/how-can-i-collect-total-arcgis-server-memory-usage/m-p/200988#M7865</guid>
      <dc:creator>RebeccaStrauch__GISP</dc:creator>
      <dc:date>2017-02-13T20:04:05Z</dc:date>
    </item>
    <item>
      <title>Re: How can I collect total ArcGIS Server memory usage?</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/how-can-i-collect-total-arcgis-server-memory-usage/m-p/200989#M7866</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I just finished writing a small script that lets me add the metric. I took the System Monitor help doc advice and instead of setting up a collector for this I'm grabbing the value with a python script and putting it into a table in a database which is queried like anything else from a database in SM. I made a table that isnt part of the geodatabase in our production environment and then execute the tasklist for ArcSOC and javaw on the two servers in our publication environment. That is returned as text so I broke it down to an integer to stick in the database. The table in the database is called SERVERMONITORMETRICS and has two columns, COUNTER and VALUE. pypyodbc updates the corresponding rows in the database and SM grabs those values. Windows Task Scheduler has the script run every 5 minutes. Might be an easier way to do it but this works for me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; pypyodbc&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; subprocess

PUBAGSMEMORY &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; sum&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;int&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;i&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;split&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;' '&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;replace&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;','&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;''&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; i &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; subprocess&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;check_output&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'TASKLIST /s xx.xx.xx.xx /FO LIST /FI "Imagename eq ArcSOC.exe"'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;split&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'\n'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Mem Usage:'&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; i&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; sum&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;int&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;i&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;split&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;' '&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;replace&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;','&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;''&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; i &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; subprocess&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;check_output&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'TASKLIST /s xx.xx.xx.xx /FO LIST /FI "Imagename eq javaw.exe"'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;split&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'\n'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Mem Usage:'&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; i&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
FOAGSMEMORY &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; sum&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;int&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;i&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;split&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;' '&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;replace&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;','&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;''&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; i &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; subprocess&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;check_output&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'TASKLIST /s xx.xx.xx.xx /FO LIST /FI "Imagename eq ArcSOC.exe"'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;split&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'\n'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Mem Usage:'&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; i&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; sum&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;int&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;i&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;split&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;' '&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;replace&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;','&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;''&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; i &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; subprocess&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;check_output&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'TASKLIST /s xx.xx.xx.xx /FO LIST /FI "Imagename eq javaw.exe"'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;split&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'\n'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Mem Usage:'&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; i&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

db &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; pypyodbc&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;connect&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Driver={SQL Server}; Server=bay-arcgis-pro; Database=sde; Uid=*****; Pwd=*****;'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
cursor &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; db&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;cursor&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
query &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'''
UPDATE sde.SERVERMONITORMETRICS
SET VALUE = %s
WHERE COUNTER = 'PUB AGS MEMORY'

UPDATE sde.SERVERMONITORMETRICS
SET VALUE = %s
WHERE COUNTER = 'FO AGS MEMORY'
'''&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;%&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;PUBAGSMEMORY&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; FOAGSMEMORY&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

cursor&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;execute&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;query&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
cursor&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;commit&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;del&lt;/SPAN&gt; cursor&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; db
&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:00:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/how-can-i-collect-total-arcgis-server-memory-usage/m-p/200989#M7866</guid>
      <dc:creator>ChrisMathers1</dc:creator>
      <dc:date>2021-12-11T10:00:22Z</dc:date>
    </item>
    <item>
      <title>Re: How can I collect total ArcGIS Server memory usage?</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/how-can-i-collect-total-arcgis-server-memory-usage/m-p/200990#M7867</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That command appears to require elevevated privileges to return information you need:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Non-admin&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/321211_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;P&gt;Admin (not a great screenshot given the amount of stuff returned, but the idea is that it requires Admin privileges)&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/321215_pastedImage_2.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Feb 2017 21:44:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/how-can-i-collect-total-arcgis-server-memory-usage/m-p/200990#M7867</guid>
      <dc:creator>JonathanQuinn</dc:creator>
      <dc:date>2017-02-13T21:44:09Z</dc:date>
    </item>
    <item>
      <title>Re: How can I collect total ArcGIS Server memory usage?</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/how-can-i-collect-total-arcgis-server-memory-usage/m-p/200991#M7868</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nice&amp;nbsp;sample, Chris!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Feb 2017 21:45:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/how-can-i-collect-total-arcgis-server-memory-usage/m-p/200991#M7868</guid>
      <dc:creator>JonathanQuinn</dc:creator>
      <dc:date>2017-02-13T21:45:26Z</dc:date>
    </item>
    <item>
      <title>Re: How can I collect total ArcGIS Server memory usage?</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/how-can-i-collect-total-arcgis-server-memory-usage/m-p/200992#M7869</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ahh yes, I should have guessed.&amp;nbsp; I ran into that on another command when trying to find file locks.&amp;nbsp; Once I opened the command window as admin, I can now seethe addition info.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Feb 2017 22:12:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/how-can-i-collect-total-arcgis-server-memory-usage/m-p/200992#M7869</guid>
      <dc:creator>RebeccaStrauch__GISP</dc:creator>
      <dc:date>2017-02-13T22:12:10Z</dc:date>
    </item>
    <item>
      <title>Re: How can I collect total ArcGIS Server memory usage?</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/how-can-i-collect-total-arcgis-server-memory-usage/m-p/200993#M7870</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ive actually found an even better way of doing this though some googling. Once I had "tasklist" the searching was a bit easier. The code below should be run in a BAT. All the addition is done in the commands and sent to the SQL Server using the sqlcmd command. Because sqlcmd is needed this has to be run in a place where there is SQL Server installed. For us it works out because we have SQL and AGS on the same machine. If they are separate you can add the /s flag to tasklist and give it the IP for the machine with AGS. By removing python from the mix and thus not having to do any imports the speed is up dramatically. Run as a schedualed task same as before but use the BAT instead of the PY. Dont know if Oracle and other DBMSs have a similar command line function but I would imagine they do.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EDIT: I should note that in the query that SM does for this I convert it to GB so its a little less crazy to look at since the is reported in KB. It goes on a graph with the Total Server Memory (KB) metric that SQL Server keeps which is how much memory its currently using.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;@Echo Off
Set "sum=0"
For /F "Tokens=6-7 Delims=., " %%a In (
&amp;nbsp;&amp;nbsp;&amp;nbsp; 'TaskList /NH /FI "ImageName Eq ArcSOC.exe"') Do Set/A sum+=%%a%%b
For /F "Tokens=6-7 Delims=., " %%a In (
&amp;nbsp;&amp;nbsp;&amp;nbsp; 'TaskList /NH /FI "ImageName Eq javaw.exe"') Do Set/A sum+=%%a%%b

set "query="UPDATE sde.SERVERMONITORMETRICS SET VALUE = %sum% WHERE COUNTER = 'FO AGS MEMORY'""
sqlcmd -S bay-arcgis-pro -d sde -Q %query%‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:00:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/how-can-i-collect-total-arcgis-server-memory-usage/m-p/200993#M7870</guid>
      <dc:creator>ChrisMathers1</dc:creator>
      <dc:date>2021-12-11T10:00:24Z</dc:date>
    </item>
  </channel>
</rss>

