Skip to main content

Agent name identification

Identifying the agent name

WhaTap basically uses the data collected from application servers to identify each server while collecting monitoring data. Basic information uses the application server as a unique identifier by a combination of application server's type, IP address, and such. If necessary, use the name set by the user or change the pattern to a unique value. The agent name must be unique.

The reason why the data extracted from the application server is used, is like the following. When a communication loss caused by the stop of the application server, network disconnection, or agent problem between the collection server and the agent, is restored, the continuity of the data from the reconnected agent is maintained.

Caution
  • The agent names must be unique on a project basis.
  • If the agent ID and name have been changed, previous data is not connected.

The default patterns used to identify the application server are as follows:

Default pattern
NODE-{ip2}-{ip3}
Cluster environment
NODE{cluster}-{ip2}-{ip3}

Variable of the agent name

VariableDescription
{type}Name of the application type (Node)
{ip0}The first byte of the IPv4 address is used. (e.g. 10 in 10.11.12.13)
{ip1}The second byte of the IPv4 address is used. (e.g. 11 in 10.11.12.13)
{ip2}The third byte of the IPv4 address is used. (e.g. 12 in 10.11.12.13)
{ip3}The fourth byte of the IPv4 address is used. (e.g. 13 in 10.11.12.13)
{pid}Application process ID
{hostname}Host name
{cluster}Cluster ID when multiple Node.js files are running on a server

Changing the agent name pattern

You can change the WhaTap agent name through an environment variable. Add the following code to the first line of the application's main module.

process.env.WHATAP_NAME = "NODE-{ip2}-{ip3}";
var whatap=require('whatap').NodeAgent;
...

Agent nameing on the server

Names are automatically assigned by the server rather than determining them based on the agent environment. It is used when a Node.js server operates in the container or PaaS environment.

whatap.conf
auto_oname_enabled=true
auto_oname_prefix=nodejs
Set the .env(app.js)
process.env.WHATAP_LICENSE='x46n3226be1ah-z2rsecfcvlq2ph-z11bc81gfhqpgg';
process.env.WHATAP_SERVER_HOST='52.78.209.94/52.78.224.235';

process.env.auto_oname_enabled=true;
process.env.auto_oname_prefix='mynode';

var whatap=require('whatap').NodeAgent;
...
Note
  • To set in the env, it must be declared before require('whatap').
  • Because the Heroku environment changes the IP address each time the server is restarted, it is changed to a new name.

The auto_oname_prefix option is the prefix of the agent name. The WhaTap server gives an agent name by combining the name and serial number set in the auto_oname_prefix option.

Assigned agent name example, mynode1

Agent name setting options

For more information about the agent name setting in Node.js, see the following.

  • whatap.okind String

    Set the group unit to which the agent belongs. By setting multiple agents together, the topology can be checked by the group name.

  • whatap.onode String

    Set the node unit to which the agent belongs.

  • auto_oname_enabled Boolean

    Default false

    It enables the function to automatically obtain the agent name to register from the server.

  • auto_oname_prefix String

    Default agent

    When an agent name is automatically granted from the server, the prefix of the agent name (business name as usual) is used. The prefix + serial number (from 1) is assigned.

  • auto_oname_reset Int

    Default 0

    Modify it to obtain a new agent name from the server. Once set, the agent name is maintained until Node.js is restarted. For a reset, modify the value of auto_oname_reset. If a different value is assigned, the setting is applied.