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 WhaTap monitoring service.

  2. To create a project, on the left of the screen, select All Projects > + Project.

  3. Select a product in Select product for installation.

  4. Configure the settings for Project name, Data server region, and Time zone.

    Create Project

  5. In Notification language setting, select the language for alert messages.

  6. After all settings are finished, select Creating a project.

Note
  • A Data server region refers to a region (a bundle of data centers installed to provide cloud services). Selecting a specific region stores your data in the datacenter that belongs to that region.

  • Time zone is the reference time for generating alerts and reports.

  • To group multiple projects for management, select a group from Project groups or add a group. For more information about grouping, see the following.

  • To add a project with an organization selected, Groups of organization must be set.

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.

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 consists of the tracers to collect monitoring information, the agents to transmit the collected information to the server, and the installation script files to dynamically apply the tracers and agents to the server. For more information about the agent files, 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

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.

Starting the monitoring

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