Skip to main content

Installing Docker Node.js

At the bottom of Management > Agent installation, click Install Application > Select the Docker Node.js tab in Install guide.

This process applies the WhaTap monitoring agent to the Node.js application running on the Docker container and packages the container image as follows.

Note
  • EKS Fargate is to be supported later.

  • To help you understand the Node.js application integration process, Git example codes are provided. See the following.

Download agent

Execute the following command to install WhaTap.

npm install --save whatap

To update the agent, execute the following command.

npm update whatap

Agent CONFIG.

Add the following code to the first line of your application's main module.

Example
const WhatapAgent = require('whatap').NodeAgent;
WhatapAgent.NodeAgent;

When using ECMAScript (ES), add the following code:

import WhatapAgent from 'whatap';
WhatapAgent.NodeAgent;

Configuring the container environment variables

After building Docker, set container environment variables in the Kubernetes environment. Add the following items in the yaml file for releasing the application.

env:
- name: NODE_IP
valueFrom: {fieldRef: {fieldPath: status.hostIP}}
- name: NODE_NAME
valueFrom: {fieldRef: {fieldPath: spec.nodeName}}
- name: POD_NAME
valueFrom: {fieldRef: {fieldPath: metadata.name}}
- name: OKIND
value: {YOUR_OKIND_NAME}
- name: license
value: {licenseKey}
- name: whatap_server_host
value: {proxyServer}
- name: whatap_micro_enabled
value: "true"

See the following example:

apiVersion: apps/v1
kind: Deployment
metadata:
name: #DeploymentName
labels:
app: #AppLabel
spec:
selector:
matchLabels:
app: #AppLabel
replicas: 3
template:
metadata:
labels:
app: #AppLabel
spec:
containers:
- name: #ContainerName
image: nginx
ports:
- containerPort: 80
env:
- name: NODE_IP
valueFrom: {fieldRef: {fieldPath: status.hostIP}}
- name: NODE_NAME
valueFrom: {fieldRef: {fieldPath: spec.nodeName}}
- name: POD_NAME
valueFrom: {fieldRef: {fieldPath: metadata.name}}
- name: OKIND
value: #DeploymentName
- name: license
value: {licenseKey}
- name: whatap_server_host
value: {proxyServer}
- name: whatap_micro_enabled
value: "true"
Note

Roles of environment variables

  • NODE_IP: Collects the IP address of the node where the current Pod has been hosted.

  • NODE_NAME: Collects the name of the node where the current Pod is running.

  • POD_NAME: Collects the name of the current Pod.

  • OKIND (optional): Groups applications for Pods. If set to a deployment name, the corresponding Pods are grouped together.

  • license: Key for agent authentication.

  • whatap_server_host: Host IP of the WhaTap collection server

  • whatap_micro_enabled: Enables integration with containers.

Checking the agent installation

  • To check whether the agent has been installed, go to Dashboard > Application Service Dashboard.

  • If you have manually installed the downloaded file but cannot see the agent in Dashboard, check the following.

    • Execute the command, ps -ef | grep whatap in the container, and then check whether the agent options have been applied properly.

    • Check the content in the /whatap/logs path of the container.