Node.js Agent troubleshooting

No Agent-loading feedback at application startup

When you do not see Agent-loading feedback when you start your application, you may be using an unsupported Node.js version. Use a supported version of Node.js.

Resolve port conflicts

If conflicting with other applications, you can change the HTTP(S) communication ports. For AppMon 6.3 and later, both configuration locations changed.

  • Server: Collector in <DT_HOME>/server/conf/server.config.xml.
  • Collector: Agents in <DT_HOME>/collector/conf/collector.config.xml.

Look for the <dtang> sub-tree in the settings. For the Collector, the Agent ports are 8043 HTTPS by default.

Additional Collector instances on one machine listen on the port with the offset specified at instance creation. For example: 8143.

There are two <dtang> entries in the AppMon Server settings.The first entry applies to the embedded Collector, and is only used for testing. Its settings should be the same as in collector.config.xml of the stand-alone Collector(s), which by default is 8043 for HTTPS. The second occurrence is the port the Server listens for HTTPS communications from the Collector(s), which by default is 8041).

Tip

For AppMon 6.3 and later, the HTTP port can be changed at startup with the argument -dtangport <port> to the launcher (dtserver or dtcollector) and is persisted in .config.xml. This only needs to be applied once. The HTTPS port is HTTP+1. You can also change a port with -Dcom.dynatrace.diagnostics.dtangport=<port> in the respective .ini files in <DT_HOME>.

Basic Node.js testing setup

To test Node.js, download and unzip it to an appropriate location. For example, unzip Node.js 0.12.4 to ~/node-0.12.4.

Put the most basic Node.js in ~/js/serverHello.js, then reference the actual Node.js Agent installation directory in the first line and adapt to the versions that you are using. For example:

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

var http = require('http');
http.createServer(function (req, res)
    {
        res.writeHead(200, {'Content-Type': 'text/plain'});
        res.end('Hello localhost\n');
    }
    ).listen(1337, '127.0.0.1');
     console.log('Server running at http://127.0.0.1:1337/');

Use the commands similar to the example below to install the Node.js Agent. As seen in this example, AppMon 6.5 is installed in /opt.

cd /opt
sudo tar -xzf ~/Downloads/dynatrace-one-agent-nodejs-6.5.0.1289-linux-x86.tgz

Enter sudo chown -R <username> /opt/[dynatrace-release] for the permissions.

Enter the following to launch an instrumented Node.js web server.

cd js
~/node-0.12.4/bin/node serverHello.js

You should now see the Agent in the Agents Overview dashlet.

If you do not have a Node.js tier in your System Profile, such as the Monitoring system profile, the message Agent did not match System Profile appears to the left of the Agent. In that case you have to add a new tier to the System Profile:

  1. Open the Application Environment Configuration wizard:
    • For a new AppMon installation, click the Configure button on the Monitoring dashboard.
    • For an existing System Profile:
      • AppMon 2017 May Right-click the System Profile of choice and select Add Tier.
      • AppMon 2018 February Select the System Profile in the Session selector, then in the Settings item of the sidebar, select Add Tier.
  2. In the wizard, select Application Type > Other, Add Java, .NET, Native and select Node.js from the application server category.

Tip

You can ignore any yellow alert triangle version alerts at this point.

In the browser, go to http://localhost:1337 to trigger a / PurePath in the PurePath dashlet and a WebRequestHandler() detail.