Skip to content

Agent Startup/Online Troubleshooting Process ​

If the Agent fails to go online after starting, follow these steps to identify and resolve the issue:


1. Check Network Connectivity ​

Use the following command to test if the local machine can connect to the Dashboard server's communication port:

bash
nc -v <Domain/IP> <Communication Port>
# Or
telnet <Domain/IP> <Communication Port>

Notes: ​

  • If communication between the server and the Dashboard server fails:
    • Check inbound/outbound firewall rules on both the local and Dashboard servers.
    • Use a port-checking tool like https://port.ping.pe/ to verify if the port is open.

2. Check SELinux Status ​

If the network connection is normal but the Agent is still offline, try disabling SELinux:

Steps to Disable SELinux: ​

  • Check the current SELinux status:
    bash
    sestatus
  • Temporarily disable SELinux (no restart required):
    bash
    sudo setenforce 0
  • Permanently disable SELinux: Edit the /etc/selinux/config file and change SELINUX=enforcing to:
    bash
    SELINUX=disabled
    Then restart the system.

How to Disable SELinux?


3. View Agent Logs ​

Enable debug mode in the configuration file. Check the Agent's running status and logs using the following command:

bash
systemctl status 'nezha-agent*'
journalctl -u 'nezha-agent*' -e --no-pager

Inspect the logs for error messages to pinpoint the cause.


4. Check gRPC Service Communication ​

Verify if the Agent can successfully connect to the gRPC service:

Use the following command to check the gRPC service path: ​

bash
curl http://<Your IP or Domain>:<Port>/proto.NezhaService/ -H "Content-Type:application/grpc" -X POST -v

If the Dashboard entry uses HTTPS, change http:// in the command to https://.

Example of a Normal Response: ​

plain
< HTTP/2 200
< content-type: application/grpc
<
< grpc-message: unknown method  for service proto.NezhaService
< grpc-status: 12

Key Information: ​

  1. content-type should be application/grpc:
    • If not, it indicates that the gRPC service connection is not functioning correctly.
  2. Presence of grpc-message error details:
    • A typical response includes unknown method for service proto.NezhaService.

If the Check Fails: ​

  • Review reverse proxy configurations and ensure traffic routes correctly to the Dashboard server's gRPC service.