Skip to main content

FAQ

View Logs

If the system is not working properly or there is no data, you can usually get more information from the logs to locate the problem.

Aggregator process log: /opt/tingyun-php/logs/daemon.log

PHP extension log: /opt/tingyun-php/logs/php-agent.log

Run:

ll /opt/tingyun-php/logs

Normally, there will be 2 logs (daemon.log and php-agent.log).

  • If php-agent.log does not exist, it means there is a problem with the PHP extension. Please check the PHP extension module.
  • If daemon.log does not exist, it means there is a problem with the aggregator process. Please check the aggregator process.

If both logs exist, the installation is fine. Please run:

grep -E 'CRITICAL|ERROR|error|SIGSEGV' /opt/tingyun-php/logsh/php-agent.log

If php-agent outputs SIGSEGV backtrace, it means the PHP extension has crashed. The specific cause needs to be located by sending the log to the developers.

If the log contains ZendGuardLoader.so, it means the request uses code encryption.

If php-agent outputs ERROR information, it means there is a runtime error in the PHP extension.

grep -E 'CRITICAL|ERROR|error' /opt/tingyun-php/logs/daemon.log

If daemon outputs ERROR information, it may indicate a communication problem with the server.

By default, the log level is info and audit mode is off, so the amount of information is relatively small. By changing the log level to debug and enabling audit mode, the aggregator process and PHP extension will output more log information, which can help locate the problem.

Check PHP Extension Module

  1. Place info.php in a directory of the website.

    echo "<?php phpinfo(); ?>" > /path/to/info.php
  2. Use a browser to access info.php.

  3. Check whether the tingyun extension exists on the page.

    The normal information is similar to the following screenshot:

  4. If there is no tingyun module information, please reinstall the extension module. If it still does not appear after reinstallation, your PHP version may not meet the installation requirements.

Check Aggregator Process

  1. Confirm whether the aggregator process file exists.

    ll /opt/tingyun-php/bin/php-daemon

    If /opt/tingyun-php/bin/php-daemon does not exist, it means it was deleted by mistake. Please reinstall the Agent.

  2. Confirm whether the aggregator process is running.

    ps -e | grep php-daemon

    The normal information is similar to the following screenshot:

    If the php-daemon process does not exist, please restart the Web Server.

    sudo service httpd restart

    or

    sudo service php-fpm restart

    Then run ps -e | grep php-daemon again to check the output.

php-agent Log Error Handling:

  1. When a large number of Resource temporarily unavailable errors occur, for example:
ERROR: connect socket /opt/tingyun-oneagent/run/daemon.sock fail: Resource temporarily unavailable

It may be caused by insufficient ulimit settings on the server, resulting in communication problems between the PHP extension and the daemon process. Each php-fpm worker will open a file descriptor to communicate with the daemon process. When the number of php-fpm workers exceeds the value of ulimit -n, communication will fail due to exceeding the file descriptor limit.

Problem confirmation:

For standard Agent, use ps -ef | grep php-daemon to confirm the pid of the daemon process. For tingyunagent Agent, use ps -ef | grep transagent to confirm the pid of the daemon process.

Check the Max open files limit for the daemon process pid in limits:

cat /proc/[pid]/limits

Check the actual number of open files for the daemon process:

ls /proc/[pid]/fd | wc -l

If the actual number of open files is close to the Max open files limit in limits, you need to adjust the limits.

Standard Agent:

kill the daemon process killall php-daemon

Open the PHP-FPM configuration file, usually located at /etc/php-fpm.conf or /etc/php-fpm.d/www.conf.

Find the line for rlimit_files. If not found, add it. The format is: rlimit_files = <soft limit>:<hard limit>

Where <soft limit> is the soft limit value, <hard limit> is the hard limit value. The soft limit is the maximum number of file descriptors allowed, the hard limit is the maximum allowed by the OS.

For example, if you want to set the soft limit to 65535 and the hard limit to 65535, set the rlimit_files line to: rlimit_files = 65535:65535

Save the file and restart the PHP-FPM service.

tingyunagent Agent:

vi /opt/tingyun-oneagent/bin/cpphostdaemon

Add ulimit -n after the start method, for example:

start() {
ulimit -n 100000
if [ -f "${AGENT_PATH}/cpp_version" ]; then
local version="$(cat ${AGENT_PATH}/cpp_version)"
local daemon=${AGENT_PATH}/cpp_${version}/bin/transagent
if [ -f "${daemon}" ]; then
echo "start ${daemon}"
export PHP_DAEMON_CONFIG="${CONF_PATH}/oneagent.conf:${CONF_PATH}/php.conf"
${daemon} -d -p "${RUN_PATH}/daemon.pid"
else
echo "Error: can not find ${daemon}"
fi
else
echo "Error: can not find ${AGENT_PATH}/cpp_version"
fi
}

Then restart the service

sudo systemctl restart tingyun-oneagent