Customizing Agent Monitoring Items
The Agent's functionality and behavior can be tailored to specific monitoring needs by configuring its runtime parameters.
Runtime Parameters
Configuration Parameters
If you installed the Agent using the one-click script, you can edit the /opt/nezha/agent/config.yml
file to add or modify parameters.
Multiple Agents can run on the same server, and each Agent's configuration file is independent.
Below is a list of runtime parameters and their functions:
client_secret:
- The client secret used for secure communication with the Dashboard.
- This parameter must match the configuration in the Dashboard to enable proper communication.
debug:
- When set to
true
, enables debug mode and logs detailed information.
- When set to
disable_auto_update:
- When set to
true
, disables the automatic update feature, enhancing system stability and security.
- When set to
disable_command_execute:
- When set to
true
, disables the execution of online terminals, file management, and scheduled tasks for increased security.
- When set to
disable_force_update:
- When set to
true
, disables forced updates, allowing only manual updates.
- When set to
disable_nat:
- When set to
true
, disables the NAT traversal feature to protect internal network data.
- When set to
disable_send_query:
- When set to
true
, prevents the Agent from initiatingTCP Ping
,ICMP Ping
, andHTTP GET
requests.
- When set to
gpu:
- When set to
true
, enables GPU monitoring. - Note: Additional dependencies may be required for GPU monitoring. See the GPU Monitoring Guide for details.
- When set to
insecure_tls:
- When set to
true
, disables certificate validation, suitable for scenarios using self-signed certificates.
- When set to
ip_report_period:
- Sets the interval (in seconds) for local IP updates. The default is
1800
seconds (30 minutes). - If this value is less than the
report_delay
setting, thereport_delay
value will take precedence.
- Sets the interval (in seconds) for local IP updates. The default is
report_delay:
- Sets the interval (in seconds) for system information reporting. The default is
1
second. To reduce resource usage, a value of3
seconds is recommended (valid range: 1-4 seconds).
- Sets the interval (in seconds) for system information reporting. The default is
server:
- The domain or IP address of the Dashboard for communication, including the port number.
skip_connection_count:
- When set to
true
, disables monitoring of network connection counts, suitable for servers with high connection volumes or limited resources.
- When set to
skip_procs_count:
- When set to
true
, disables monitoring of process counts to lower resource usage.
- When set to
temperature:
- When set to
true
, enables hardware temperature monitoring (only supported for specific hardware; unavailable for some VPS instances).
- When set to
tls:
- When set to
true
, enables SSL/TLS encryption for communication between the Agent and the Dashboard. - Enable this option if the Agent uses an SSL/TLS-enabled Nginx reverse proxy.
- When set to
hard_drive_partition_allowlist:
- A string array specifying the list of hard drive partitions to monitor.
- Monitoring will only include the listed partitions.
nic_allowlist:
- A
map[string]bool
type whitelist specifying the network interfaces to monitor. - The key is the network interface name, and the value is
true
for monitoring andfalse
for exclusion. - If not specified, all available interfaces are monitored by default.
- A
use_gitee_to_upgrade:
- When set to
true
, uses the Gitee repository as the automatic update source, better suited for servers in mainland China.
- When set to
use_ipv6_country_code:
- When set to
true
, forces the use of IPv6 addresses for country code queries (default uses IPv4).
- When set to
uuid:
- The unique identifier for the current Agent, used by the Dashboard to recognize the data source.
- To replace an existing Agent in the Dashboard, manually set this parameter.
dns:
- A string array to set custom DNS server lists.
- When specified, the Agent will prioritize these DNS servers for domain resolution.
custom_ip_api:
- A string array specifying custom IP query API endpoints.
- The Agent will use these APIs to retrieve the server's public IP information.
Apply Changes
After modifying the configuration file, restart the Agent service to apply changes. Follow these steps:
Restart the Service
Use the following command to restart the default Agent service:bashsudo systemctl restart nezha-agent.service
For Multiple Agent Services
If running multiple Agent services on the same server, first list all Agent services:bashsudo systemctl list-units --type=service | grep nezha-agent
Then restart each Agent service using the following command:
bashsudo systemctl restart <service-name>
Replace
<service-name>
with the actual service name, such asnezha-agent@2.service
.