AgentMetrics - Global

concept brazil Updated Sep 10, 2026 2 min read c_AgentMetricsAPI.md
Raw file servicenow.com

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]

Use these methods in server scripts.

Parent Topic:Server API reference

AgentMetrics - AgentMetrics()

Creates an instance of AgentMetrics.

Name Type Description
None

This example shows how to use AgentMetrics() to instantiate an AgentMetrics object.

JavaScript
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)

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).

Name Type Description
metric String The counter object from the agent
name String The device name
midId String The MID server sys_id
Type Description
void
JavaScript
var amtc = new AgentMetrics();amtc.handleCounter('count', 'server_name', '1098888bbb9483abcd89981ffaeff');

AgentMetrics - handleMemory(String metric, String name, String midId)

Updates the memory metrics for the given agent.

Name Type Description
metric String The memory object from the agent
name String The device name
midId String The MID server sys_id
Type Description
void
JavaScript
var amtc = new AgentMetrics();amtc.handleMemory('mem_obj', 'server_name', '1098888bbb9483abcd89981ffaeff');

AgentMetrics - handleRGR(String metric, String name, String midId)

Handles metric information from a remote glide record by putting it into an array.

Name Type Description
metric String The remote object from the agent
name String The device name
midId String The MID server sys_id
Type Description
void
JavaScript
var amtc = new AgentMetrics();amtc.handleRGR('remote_obj', 'server_name', '1098888bbb9483abcd89981ffaeff');

AgentMetrics - handleScalar(String metric, String name, String midId)

Handles scalar values from the agent by putting them into an array.

Name Type Description
metric String The counter object from the agent
name String The device name
midId String The MID server sys_id
Type Description
void
JavaScript
var amtc = new AgentMetrics();amtc.handleScalar('scalar', 'server_name', '1098888bbb9483abcd89981ffaeff');

AgentMetrics - updateMetric(String tableName, String values, String metric, String midID)

Updates the specified metrics table with the new metric information.

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
Type Description
void
JavaScript
var amtc = new AgentMetrics();amtc.handleMemory('memory', 'server_name', '1098888bbb9483abcd89981ffaeff');amtc.updateMetric('ecc_agent_memory_metric', 'm_values', 'memory', '1098888bbb9483abcd89981ffaeff');
Search documentation
Search document titles and file paths on the brazil branch