Node.js Agent configuration

Click here for troubleshooting tips.

Agent installation, update

Defining Agent group/tier

After installing AppMon, be sure to define an Agent Group/tier for Node.js. To do so:

  1. Open the the Application Environment Configuration wizard, by clicking the Configure button on the initial Welcome screen, or later, by clicking the Configure Environment item in the gear menu in the top right corner of the Monitoring dashboard.
  2. At the step 1 of the wizard, select Other.
  3. At the step 2 of the wizard, click Add under Java / .Net / Native.
  4. Select Node.js in the Application Server category in the next step. The wizard lets you select the location and bitness of your Node.js installation, gives you an alternative download, the commands to un-tar or un-zip it and the resulting Agent connection string that you need to put at the beginning of your main JS file.

Integration

To integrate the Node.js Agent with your installation:

Download the Node.js Agent archive for your operating system. The archive contains both 32 and 64-bit versions of the Agent.

Include the following lines at the top of the main JavaScript file of your application.

Note

This is the Agent connection string, and these lines must be the first lines at the beginning of the file to capture PurePaths.

   try
      {
          require('<DT_HOME>/agent/bin/any/onenodeloader.js')({
            server: 'http://<CollectorName>:8043',
            agentName: '<AgentName>'
          });  
      } catch (err) {
          console.error(err.toString());  
      }

The port after <CollectorName> is not optional as with other Agents that use TCP, because with HTTP it defaults to 80.

For example, if all AppMon components are installed to /opt/dynatrace-7.0 and the Node.js Agent - Agent Group/tier mapping is Node.js_Monitoring, then the main JavaScript must start with the following lines:

   try
      {
          require('/opt/dynatrace-7.0/agent/bin/any/onenodeloader.js')({
            server: 'http://localhost:8043',
            agentName: 'Node.js_Monitoring'
          });  
      } catch (err) {
          console.error(err.toString());  
      }

Upgrade

It is strongly recommended to start with a new installation (new folder), when upgrading the Node.js Agent from any older version to 7.0.

Licensing

Licensing is per process on the server side. For example, if you have a license for 100 Node.js Agents you can concurrently run 100 instrumented Node.js processes. Refer to Node.js documentation to learn how to tweak the clustering.