Skip to main content

Installing the docker PHP

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

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

Note

EKS Fargate is to be supported later.

Download agent

Install the whatap-php package when building your PHP application docker image.

Red Hat/CentOS

RUN rpm -Uvh https://repo.whatap.io/centos/5/noarch/whatap-repo-1.0-1.noarch.rpm
RUN yum install -y whatap-php

Agent CONFIG.

  • Use the following command to set the installation script. If you enter the WhaTap access key and server IP, the PHP environment data is automatically collected.

    RUN (echo "[Access Key]"; echo "[Server IP]")|/usr/whatap/php/install.sh
  • Using the following method, you can directly enter the PHP environment settings.

    # RUN /usr/whatap/php/install.sh -l [Access Key] -s [Server IP] -v [PHP version x.x] -i [php.ini full path] -p [Process Name] -z [thread safety] 
    RUN /usr/whatap/php/install.sh -l xxxxx -s 1.1.1.1/2.2.2.2 -v 7.0 -i /etc/php.ini -p httpd [-z]
Note

Be careful not to expose the access key to images that are in Docker Public status.

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}}

See the following example:

apiVersion: v1
kind: Pod
metadata:
name: # Pod Name
labels: # Pod Labels
spec:
containers:
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}}
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.

Running the agent

Add the whatap-php startup command before the application startup command.

sh -c "/usr/whatap/php/whatap-php start && [Application Startup Command]"

Execute the following command to check whether the WhaTap service has been run normally. When the application server runs, it begins collecting monitoring information.


ps -ef | grep whatap_php

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 of the container in the /usr/whatap/php/logs path. The file name of the agent log is displayed as logs/{boot or install}-yyyymmdd.log.