Addressing Multiple Application Instances creation with Different Ports in APM Insight PHP Agent

Addressing Multiple Application Instances creation with Different Ports in APM Insight PHP Agent

Issue: After installing the APM Insight PHP Agent, multiple monitor instances appear for the same application with different port numbers (e.g., 0, 80, 443), even though the application is expected to run only on a specific port such as 80 or 443.

Issue Cause:
As per the PHP agent’s auto-discovery behavior, all application runtime ports are detected by design, resulting in monitor instances such as:
  1. apphost:0 (PHP-Application): Instance created to show background application activity.
  2. apphost:80 (PHP-Application):  Instance created to show web activity accessed via port 80.
  3. apphost:443 (PHP-Application): Instance created to show web activity accessed via port 443
Solution:  From PHP Agent v4.8.1, can configure the agent to monitor only specific ports (e.g. 443) and exclude others:
1. Identify the primary web port: Confirm the main port(s) your PHP application uses for web traffic (e.g., 443).
2. Configure included ports: 
  1. For Windows: 
    1. Set "zpa.include_ports" option by modifying the configuration.json file.
      1. e.g.
        1. { ... "zpa.include_ports" : "443", ... } 
        2. { ... "zpa.include_ports" : "443,80", ... }
    2. Set "zpa.include_ports" option for each individual application's 
      1. e.g. Using .user.ini file
        1. zpa.include_ports="443"
        2. zpa.include_ports="443,80"
  2. For Linux:
    1. Set "zpa.include_ports" options using the command-line arguments
      1. e.g. 
        1. sh /opt/zpa/bin/agent_php.sh configure -zpa.include_ports "443" 
        2. sh /opt/zpa/bin/agent_php.sh configure -zpa.include_ports "443,80" 
    2. Set "zpa.include_ports" options using environment variables
      1. e.g.
        1. export ZPA_INCLUDE_PORTS="443"
        2. export ZPA_INCLUDE_PORTS="443,80"
    3. Set "zpa.include_ports" options by modifying the configuration.json file
      1. e.g. 
        1. { ... "zpa.include_ports" : "443", ... } 
        2. { ... "zpa.include_ports" : "443,80", ... }
    4. Set "zpa.include_ports" option for each individual application's
      1. e.g. 
        1. For Apache:  php_value zpa.include_ports "443"
        2. For Nginx:  fastcgi_param PHP_VALUE "zpa.include_ports=443"
        3. For PHP-FPM using  .user.ini file: zpa.include_ports="443"
        4. For Command Line Interface: php -d zpa. include_ports="443" /path/to/your/script
3. Restart the application: Restart your PHP application or your web server and the FastCGI Process Manager (FPM), if used to apply the updated configuration.

4. Remove unwanted monitors: In the Applications Manager UI, delete the monitors associated with ports that are no longer included.

NotesNote: Ports not listed in the include_ports setting will no longer collect data. So, Kindly ensure the correct ports before applying changes.

If any concerns, kindly contact appmanager-support@manageengine.com for further assistance.

                  New to ADSelfService Plus?

                    • Related Articles

                    • Addressing Multiple Instances in a Single APM Insight Application - "PHP-Application"

                      Issue Overview: By default, the PHP Agent configures the application name as "PHP-Application" in APM Insight. This default setting causes multiple PHP applications to be discovered under the same APM Insight Application, leading to data usage limit ...
                    • How to install the APM Insight PHP Agent in an Azure Web App?

                      Follow these steps to install and configure the APM Insight PHP Agent in an Azure Web App. Step 1: Create a deployment script Navigate to the directory /home/apm/ (create it if it doesn’t exist). Create a new shell script named apm-phpagent-deploy.sh ...
                    • Uninstrumented Block of Code - APM Insight

                      In the traces tab --> Slowest Method Calls and Count we show if you find Un-instrumented block of code the reason is as follows: Basically, What is un-instrumented block of code in APM Insight? By default, APM Insight agent monitors known frameworks ...
                    • How to rename an existing APM - Java agent application's monitor?

                      In Applications Manager's APM(Application Performance Monitoring) doesn't support renaming applications/monitors from the web client. However, the application name of an existing application instance can be renamed in the `apminsight.conf` file and ...
                    • How to set the PHP path during agent installation?

                      This is only applicable to the agent versions 4.2 and above. For Linux Step 1: Download the installation script. wget -O InstallAgentPHP.zip https://www.manageengine.com/products/applications_manager/54974026/InstallDataExporter.zip && unzip ...