{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":956,"path":"api-reference/server-api-reference/c_AgentMetricsAPI.md","title":"AgentMetrics - Global","bundle":null,"doc_type":null,"release":"australia","body":"\n# AgentMetrics- Global\n\nThe AgentMetrics script include provides methods to process inbound MID Server metrics.\n\nThis script include updates the following tables:\n\n-   ECC Agent Counter Metric \\[ecc\\_agent\\_counter\\_metric\\]\n-   ECC Agent Memory Metric \\[ecc\\_agent\\_memory\\_metric\\]\n-   ECC Agent RGR Metric \\[ecc\\_agent\\_rgr\\_metric\\]\n-   ECC Agent Scalar Metric \\[ecc\\_agent\\_scalar\\_metric\\]\n\nUse these methods in server scripts.\n\n**Parent Topic:**[Server API reference](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/api-server.md)\n\n## AgentMetrics - AgentMetrics\\(\\)\n\nCreates an instance of AgentMetrics.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\nThis example shows how to use AgentMetrics\\(\\) to instantiate an AgentMetrics object.\n\n```\nvar amtc = new AgentMetrics();\namtc.handleMemory('memory', 'server_name', '1098888bbb9483abcd89981ffaeff');\namtc.updateMetric('ecc_agent_memory_metric', 'm_values', 'memory', '1098888bbb9483abcd89981ffaeff');\n```\n\n## AgentMetrics - handleCounter\\(String metric, String name, String midId\\)\n\nHandles counter metrics from the agent by putting them into an array that can be used to update the ECC Agent Counter Metric table \\(ecc\\_agent\\_counter\\_metric\\).\n\n|Name|Type|Description|\n|----|----|-----------|\n|metric|String|The counter object from the agent|\n|name|String|The device name|\n|midId|String|The MID server sys\\_id|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\n```\nvar amtc = new AgentMetrics();\namtc.handleCounter('count', 'server_name', '1098888bbb9483abcd89981ffaeff');\n```\n\n## AgentMetrics - handleMemory\\(String metric, String name, String midId\\)\n\nUpdates the memory metrics for the given agent.\n\n|Name|Type|Description|\n|----|----|-----------|\n|metric|String|The memory object from the agent|\n|name|String|The device name|\n|midId|String|The MID server sys\\_id|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\n```\nvar amtc = new AgentMetrics();\namtc.handleMemory('mem_obj', 'server_name', '1098888bbb9483abcd89981ffaeff');\n```\n\n## AgentMetrics - handleRGR\\(String metric, String name, String midId\\)\n\nHandles metric information from a remote glide record by putting it into an array.\n\n|Name|Type|Description|\n|----|----|-----------|\n|metric|String|The remote object from the agent|\n|name|String|The device name|\n|midId|String|The MID server sys\\_id|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\n```\nvar amtc = new AgentMetrics();\namtc.handleRGR('remote_obj', 'server_name', '1098888bbb9483abcd89981ffaeff');\n```\n\n## AgentMetrics - handleScalar\\(String metric, String name, String midId\\)\n\nHandles scalar values from the agent by putting them into an array.\n\n|Name|Type|Description|\n|----|----|-----------|\n|metric|String|The counter object from the agent|\n|name|String|The device name|\n|midId|String|The MID server sys\\_id|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\n```\nvar amtc = new AgentMetrics();\namtc.handleScalar('scalar', 'server_name', '1098888bbb9483abcd89981ffaeff');\n```\n\n## AgentMetrics - updateMetric\\(String tableName, String values, String metric, String midID\\)\n\nUpdates the specified metrics table with the new metric information.\n\n|Name|Type|Description|\n|----|----|-----------|\n|tableName|String|The metrics table to update|\n|values|String|The object containing the values to add to the table|\n|metric|String|The metric type to add to the table|\n|midID|String|The MID server sys\\_id|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\n```\nvar amtc = new AgentMetrics();\namtc.handleMemory('memory', 'server_name', '1098888bbb9483abcd89981ffaeff');\namtc.updateMetric('ecc_agent_memory_metric', 'm_values', 'memory', '1098888bbb9483abcd89981ffaeff');\n```\n\n"}}