---
sourceDocument: Xanadu API Reference
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - en-US

ft:publication_title :

    - Xanadu API Reference

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# AgentMetrics - Global

# AgentMetrics - Global {#ariaid-title1}

* Release version: Xanadu
* 
* Updated August 1, 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 1 minute to read

The AgentMetrics script include provides methods to process inbound MID Server metrics.  
This script include updates the following tables:

* ECC Agent Counter Metric \[ecc_agent_counter_metric\]
* ECC Agent Memory Metric \[ecc_agent_memory_metric\]
* ECC Agent RGR Metric \[ecc_agent_rgr_metric\]
* ECC Agent Scalar Metric \[ecc_agent_scalar_metric\]
{#c_AgentMetricsAPI__ul_t5p_blf_zt}

Use these methods in server scripts.

## AgentMetrics - AgentMetrics() {#ariaid-title2}

Creates an instance of AgentMetrics.
{#r_AM-AgentMetrics__table_jfn_klf_zt__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 1. Parameters]

{#r_AM-AgentMetrics__table_jfn_klf_zt}  
This example shows how to use AgentMetrics() to instantiate an
AgentMetrics object.

    var amtc = new AgentMetrics();
    amtc.handleMemory('memory', 'server_name', '1098888bbb9483abcd89981ffaeff');
    amtc.updateMetric('ecc_agent_memory_metric', 'm_values', 'memory', '1098888bbb9483abcd89981ffaeff');

## AgentMetrics - handleCounter(String metric, String name, String midId) {#ariaid-title3}

Handles 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).
{#r_AM-handleCounter_S_S_S__table_fg3_vlf_zt__entry__3}

| Name | Type | Description |
|-|-|-|
| metric | String | The counter object from the agent |
| name | String | The device name |
| midId | String | The MID server sys_id |
[Table 2. Parameters]

{#r_AM-handleCounter_S_S_S__table_fg3_vlf_zt} {#r_AM-handleCounter_S_S_S__table_gg3_vlf_zt__entry__2}

| Type | Description |
|-|-|
| void |   |
[Table 3. Returns]

{#r_AM-handleCounter_S_S_S__table_gg3_vlf_zt}  

    var amtc = new AgentMetrics();
    amtc.handleCounter('count', 'server_name', '1098888bbb9483abcd89981ffaeff');

## AgentMetrics - handleMemory(String metric, String name, String midId) {#ariaid-title4}

Updates the memory metrics for the given agent.
{#r_AM-handleMemory_S_S_S__table_wcd_hnf_zt__entry__3}

| Name | Type | Description |
|-|-|-|
| metric | String | The memory object from the agent |
| name | String | The device name |
| midId | String | The MID server sys_id |
[Table 4. Parameters]

{#r_AM-handleMemory_S_S_S__table_wcd_hnf_zt} {#r_AM-handleMemory_S_S_S__table_xcd_hnf_zt__entry__2}

| Type | Description |
|-|-|
| void |   |
[Table 5. Returns]

{#r_AM-handleMemory_S_S_S__table_xcd_hnf_zt}  

    var amtc = new AgentMetrics();
    amtc.handleMemory('mem_obj', 'server_name', '1098888bbb9483abcd89981ffaeff');

## AgentMetrics - handleRGR(String metric, String name, String midId) {#ariaid-title5}

Handles metric information from a remote glide record by putting it into an
array.
{#r_AM-handleRGR_S_S_S__table_rfg_vmf_zt__entry__3}

| Name | Type | Description |
|-|-|-|
| metric | String | The remote object from the agent |
| name | String | The device name |
| midId | String | The MID server sys_id |
[Table 6. Parameters]

{#r_AM-handleRGR_S_S_S__table_rfg_vmf_zt} {#r_AM-handleRGR_S_S_S__table_sfg_vmf_zt__entry__2}

| Type | Description |
|-|-|
| void |   |
[Table 7. Returns]

{#r_AM-handleRGR_S_S_S__table_sfg_vmf_zt}  

    var amtc = new AgentMetrics();
    amtc.handleRGR('remote_obj', 'server_name', '1098888bbb9483abcd89981ffaeff');

## AgentMetrics - handleScalar(String metric, String name, String midId) {#ariaid-title6}

Handles scalar values from the agent by putting them into an array.
{#r_AM-handleScalar_S_S_S__table_hzc_jmf_zt__entry__3}

| Name | Type | Description |
|-|-|-|
| metric | String | The counter object from the agent |
| name | String | The device name |
| midId | String | The MID server sys_id |
[Table 8. Parameters]

{#r_AM-handleScalar_S_S_S__table_hzc_jmf_zt} {#r_AM-handleScalar_S_S_S__table_izc_jmf_zt__entry__2}

| Type | Description |
|-|-|
| void |   |
[Table 9. Returns]

{#r_AM-handleScalar_S_S_S__table_izc_jmf_zt}  

    var amtc = new AgentMetrics();
    amtc.handleScalar('scalar', 'server_name', '1098888bbb9483abcd89981ffaeff');

## AgentMetrics - updateMetric(String tableName, String values, String metric, String
midID) {#ariaid-title7}

Updates the specified metrics table with the new metric information.
{#r_AM-updateMetric_S_S_S_S__table_bzz_snf_zt__entry__3}

| Name | Type | Description |
|-|-|-|
| tableName | String | The metrics table to update |
| values | String | The object containing the values to add to the table |
| metric | String | The metric type to add to the table |
| midID | String | The MID server sys_id |
[Table 10. Parameters]

{#r_AM-updateMetric_S_S_S_S__table_bzz_snf_zt} {#r_AM-updateMetric_S_S_S_S__table_czz_snf_zt__entry__2}

| Type | Description |
|-|-|
| void |   |
[Table 11. Returns]

{#r_AM-updateMetric_S_S_S_S__table_czz_snf_zt}  

    var amtc = new AgentMetrics();
    amtc.handleMemory('memory', 'server_name', '1098888bbb9483abcd89981ffaeff');
    amtc.updateMetric('ecc_agent_memory_metric', 'm_values', 'memory', '1098888bbb9483abcd89981ffaeff');


