Skip to main content

Agent Installation

An agent must be installed on the same server to forward data from the monitored application server through TCP communication and to transfer the data to the WhaTap collection server. The agent can be installed using the package.

Note

The agent works as the default 127.0.0.1:6600 TCP server. It receives data from the Go application and forwards the data to the WhaTap collection server via the outbound 6600 port.

  1. Install the WhaTap repository.

  2. Install the whatap-agent Linux package (yum, apt-get).

  3. Run the whatap-agent service.

Go Monitoring

To use the WhaTap monitoring service, after Sign up, create a project and then install the agent to the target server.

Creating a project

Create a project before installing the agent.

  1. Log in to the WhaTap Monitoring Service.

  2. In the left side menu, click All Projects > + Project.

  3. On the Select product screen, select the product you want to install.

  4. Enter or select the following items:

    • Project name: Enter the project name.

    • Data server region: Select the data server region. A region is a group of data centers that provide cloud services. Your data will be stored in the selected region.

    • Time zone: Set the time zone to be used for alerts and report generation.

    • Notification language setting: Set the language for alert notifications. (Supports Korean and English)

    • Project groups: Group multiple projects for easier management. Select a group if applicable.

    • Project description: Add additional details or a description for your project.

  5. After completing all settings, click the Creating a project button.

Note

If you add a project while an organization is selected, you must set the Groups of organization field.

For more information about groups, see the related document.

Checking the access key

The access key is the unique ID to enable the WhaTap service.

In the installation guide section, select Getting the access key. After the access key has been issued automatically, proceed to the next step.

Note

After a project has been created, the Agent installation page appears automatically. If the Agent installation does not appear, select Management > Agent installation on the left of the screen.

Configuring the Go library

Add the github.com/whatap/go-api package to the Go application source code.

go get github.com/whatap/go-api

Configure for initialization and shutdown with the trace.Init() and trace.Shutdown() functions. Set the startup and end for transactions with the trace.Start() and trace.End() functions.

Go
import "github.com/whatap/go-api/trace"

func main(){
trace.Init(nil)
//It must be executed before closing the app.
defer trace.Shutdown()

ctx, _ := trace.Start(context.Bacground(), "Start Tx")

...

trace.End(ctx, err)
}
Note

For more information about the library configuration, see the following.

Agent setting

Default settings

Execute the following commands in order to set the access key and collection server IP in whatap.conf.

  • Create the whatap.conf file in the path of the application startup script.

  • If the WHATAP_HOME environment variable has not been set, the path of the application startup script is recognized as the one of the whatap.conf file.

SH
# Creation of whatap.conf in the script running path
$ echo "license={Access Key}" >> ./whatap.conf
$ echo "whatap.server.host={Collection Server IP}" >> ./whatap.conf
$ echo "app_name={Application Name}" >> ./whatap.conf

# 애플리케이션 실행
./app
  • license: Enter the access key.

  • whatap.server.host: Enter the collection server IP address.

  • app_name: Enter the application name. Set the user as a string.

    Note

    app_name is a component to determine the agent name. For more information, see the following.

Setting the WHATAP_HOME variable

You can set the whatap.conf path as the WHATAP_HOME variable. Create the WHATAP_HOME path first.

# Set the whatap.conf path after setting the WHATAP_HOME path.
mkdir ./whatap_home
echo "license={Access Key}" >> ./whatap_home/whatap.conf
echo "whatap.server.host={Collection Server IP}" >> ./whatap_home/whatap.conf
echo "app_name={Application Name}" >> ./whatap_home/whatap.conf

# Run the application.
WHATAP_HOME=./whatap_home ./app
Tip

The priority of the agent configuration is that the whatap.conf file is applied first, followed by the environment variables. To prioritize environment variables, set the use_env_first option to true. Alternatively, you can set the environment variable as WHATAP_USE_ENV_FIRST=true.

Setting the agent names for each process

If one whatap.conf file is shared by the applications running in multiple processes, any changes may not be reflected. It is recommended to set a whatap.conf for each process.

To avoid duplicate agent names, you can add a string to each agent name for identification. The value set with the app_name option is added to the beginning of the agent name.

You can avoid duplicate names of agents run with the same command and the same instance.

# Set the whatap.conf path after setting the WHATAP_HOME path.
mkdir ./whatap_home
echo "license={Access Key}" >> ./whatap_home/whatap.conf
echo "whatap.server.host={Collection Server IP}" >> ./whatap_home/whatap.conf
echo "app_name={Application Name-1}" >> ./whatap_home/whatap.conf

# Run the application.
WHATAP_HOME=./whatap_home ./app

# Set the whatap.conf path after setting the WHATAP_HOME path.
mkdir ./whatap_home1
echo "license={Access Key}" >> ./whatap_home1/whatap.conf
echo "whatap.server.host={Collection Server IP}" >> ./whatap_home1/whatap.conf
echo "app_name={Application Name-2}" >> ./whatap_home1/whatap.conf

# Run the application
WHATAP_HOME=./whatap_home1 ./app

Download agent

Once you have received the access key, download the agent with the following command.

SH
## Register the package repository
$ sudo rpm -Uvh https://repo.whatap.io/centos/5/noarch/whatap-repo-1.0-1.noarch.rpm

## Install the package
$ sudo yum install whatap-agent

The agent is a data relay process that receives monitoring information from the user application through internal IPC (TCP) and then forwards that data to the WhaTap collection server.

Starting the monitoring

Once the application server has been restarted, the agent starts collecting data.