Skip to main content

Agent Installation

To use the WhaTap monitoring service, after Sign in, create a project and install the agent to the target server. For more information about registration as a member, see the following.

See the following video guide.

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. Set items for Project name, Data server region, Time zone, and more in order.

  5. 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.

Enabling the virtual environment

While the applications are using virtualenv, enable the virtual environment. Run the bin/activate file.

Download agent

Get the access key and then go to the Download agent section. Copy the following command to install the agent.

pip install whatap-python
Note

If installation is impossible with the pip command, download the installation file in pypi WhaTap page. Unzip the downloaded file and then proceed with installation.

Docker

  1. In case of the application that is serviced to the docker container, add the following content to DockerFile.

    • Installing the Python agent.

      Dockerfile
      ENV WHATAP_HOME /whatap
      RUN mkdir -p /whatap
      RUN pip install whatap-python
      // In case requirements.txt is used, add whatap-python to the file.
    • Register the settings for access key and collection server IP.

      Dockerfile
      RUN touch /whatap/whatap.conf
      RUN echo "license=[ Granted access key ]" > /whatap/whatap.conf
      RUN echo "whatap.server.host=[ Collection server IP ]" >> /whatap/whatap.conf
      RUN echo "app_name=[ Agent name ]" >> /whatap/whatap.conf
      RUN echo "app_process_name=[ Application process name example)uwsgi, gunicorn.. ]" >> /whatap/whatap.conf
  2. Before the previous command, python manage.py runserver, add whatap-start-agent.

    Dockerfile
    #ENTRYPOINT python manage.py runserver
    ENTRYPOINT whatap-start-agent python manage.py runserver
Note

For more information about the agent file structure, see the Python agent file structure.

Details

Python agent structure file The Python agent file consists of a tracer that extracts the data needed to monitor applications and passes it to the WhaTap collection server, and the elements that help the tracer send the data.

  • whatap.conf

    This basic file is required to set an agent. The agent-related options can be set in whatap.conf.

  • paramkey.txt

    It is used to check the parameters of HTTP and SQL data collected as the trace information of the traced transactions.

    The security key is stored in a file. To check the actual collected data through a browser, enter the security key in the file to retrieve the data.

    You can modify the security key by directly modifying the file. The related options are as follows:

    • profile_http_parameter_enabled Boolean

      Default false

    • profile_sql_param_enabled Boolean

      Default false

Agent CONFIG.

  1. WHATAP_HOME default path configuration

    Specify the $WHATAP_HOME path for log and configuration files. It is recommended to create a new whatap directory.

    $ export WHATAP_HOME=[PATH]
  2. Configuring the access key and collection server IP

    Execute the following command to generate whatap.conf in the path specified in $WHATAP_HOME.

    whatap-setting-config \
    --host [Collection server IP] \
    --license [Access key] \
    --app_name [Entry of user-defined agent name] \
    --app_process_name [Process name, ex. uwsgi, gunicorn]
  3. Checking the configuration

    Check whether the configuration file has been created as follows.

    $ cat $WHATAP_HOME/whatap.conf

Reflection for each application server

With the WHATAP_AGENT startup command, restart the application server. After restarting, the WhaTap agent collects the application's monitoring data.

Command

$ whatap-start-agent python manage.py runserver

uWSGI

Example 1

$ whatap-start-agent uwsgi --ini myapp.ini

Example 2

description "uWSGI application server handling myapp"

start on runlevel [2345]
stop on runlevel [!2345]

exec whatap-start-agent [YOUR_APPLICATION_START_COMMAND]
또는
exec env WHATAP_HOME=[PATH] [절대 경로]/whatap-start-agent [YOUR_APPLICATION_START_COMMAND]

Example 3

$ whatap-start-agent gunicorn myapp.wsgi

Gunicorn

Example 1

NAME="uwsgi"
PATH=/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/local/bin/uwsgi

########## WHATAP_AGENT_CONF ##########
WHATAP_HOME=[PATH]
WHATAP_AGENT=[Absolute Path]/whatap-start-agent
...
do_start(){
env WHATAP_HOME=$WHATAP_HOME $WHATAP_AGENT [YOUR_APPLICATION_START_COMMAND]
}

Example 2

description "Gunicorn application server handling myapp"

start on runlevel [2345]
stop on runlevel [!2345]

exec whatap-start-agent [YOUR_APPLICATION_START_COMMAND]
또는
exec env WHATAP_HOME=[PATH] [Absolute Path]/whatap-start-agent [YOUR_APPLICATION_START_COMMAND]

Example 3

NAME="gunicorn"
PATH=/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/local/bin/gunicorn

########## WHATAP_AGENT_CONF ##########
WHATAP_HOME=[PATH]
WHATAP_AGENT=[Absolute Path]/whatap-start-agent
...
do_start(){
env WHATAP_HOME=$WHATAP_HOME $WHATAP_AGENT [YOUR_APPLICATION_START_COMMAND]
}

Supervisor

[program:app-uwsgi]
environment = WHATAP_HOME=[PATH]
command = [Absolute Path]/whatap-start-agent /usr/local/bin/uwsgi --ini /home/blog/backend/config/uwsgi.ini

[program:nginx-app]
command = /usr/sbin/nginx

Implementing your own WSGI application

import whatap

@whatap.register_app
def simple_app(environ, start_response):
"""Simplest possible application object"""
status = '200 OK'
response_headers = [('Content-type', 'text/plain')]
start_response(status, response_headers)
return ['Hello world!\n']

Applying the agent and checking the service status

  • Application of the WhaTap Agent

    Apply the WhaTap agent by adding the following code that directly calls the top API.

    import whatap
    whatap.agent
  • Checking the service running

    Execute the following command to check if the WhaTap Python service is running normally.

    ps -ef | grep whatap_python