import{_ as n,c as a,o as t,a as e}from"./app.36b81bbc.js";const k='{"title":"Install Agent using one-click script","description":"","frontmatter":{},"headers":[{"level":2,"title":"Install Agent using one-click script","slug":"install-agent-using-one-click-script"},{"level":3,"title":"Preparation","slug":"preparation"},{"level":3,"title":"One-click installation on Linux","slug":"one-click-installation-on-linux"},{"level":3,"title":"One-click installation on Windows","slug":"one-click-installation-on-windows"},{"level":2,"title":"Other ways to install Agent","slug":"other-ways-to-install-agent"},{"level":3,"title":"Installing Agent on Linux","slug":"installing-agent-on-linux"},{"level":3,"title":"Installing Agent on Windows","slug":"installing-agent-on-windows"},{"level":3,"title":"Installing Agent on MacOS","slug":"installing-agent-on-macos"},{"level":3,"title":"Installing Agent on OpenWRT","slug":"installing-agent-on-openwrt"},{"level":2,"title":"Customize Agent","slug":"customize-agent"},{"level":2,"title":"FAQ","slug":"faq"},{"level":3,"title":"Is there a Docker image for Agent?","slug":"is-there-a-docker-image-for-agent"}],"relativePath":"en_US/guide/agent.md","lastUpdated":1655900739000}',s={},o=e(`

The service in the monitored server is called Agent. This document will describe how to install the Agent on the monitored server and connect it with Dashboard

Install Agent using one-click script

Nezha Monitoring now supports one-click installation of the Agent on Windows and Linux. Follow the steps in this document and you can easily deploy it on your server

Preparation

First of all, you need to set up the communication domain name in the settings page of the admin panel, this domain name can not connect to the CDN, here is the sample communication domain name "data.example.com" mentioned earlier for demonstration
Enter the administration panel, go to the "Settings" page, in the item "CDN Bypassed Domain/IP ", fill in the communication domain name, and then click "Save"

One-click installation on Linux

One-click installation on Windows

Other ways to install Agent


Installing Agent on Linux

curl -L https://raw.githubusercontent.com/naiba/nezha/master/script/install_en.sh  -o nezha.sh && chmod +x nezha.sh && sudo ./nezha.sh   

Installing Agent on Windows

Installing Agent on MacOS

This section is adapted from Mitsea Blog, with permission from the original author

WARNING

If you are prompted with "macOS cannot verify this app" during installation, please go to system settings to allow the app to run.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Disabled</key>
	<false/>
	<key>Label</key>
	<string>nezha_agent</string>
	<key>Program</key>
	<string>Change the path of the Agent binary here, e.g. /Users/123/Downloads/nezha-agent</string>
	<key>ProgramArguments</key>
	<array>
		<string>Change the path of the Agent binary here, e.g. /Users/123/Downloads/nezha-agent</string>
		<string>--password</string>
		<string>Communication Secret, eg: 529664783eeb23cc25</string>
		<string>--server</string>
		<string>Communication URL and RPC port, eg:data.example.com:5555</string>
	</array>
	<key>RunAtLoad</key>
	<true/>
</dict>
</plist>
launchctl load /Users/123/Desktop/nezha_agent.plist
launchctl start nezha_agent
launchctl list | grep nezha_agent
launchctl stop nezha_agent
launchctl remove nezha_agent

Installing Agent on OpenWRT

How to make the old version of OpenWRT/LEDE self-boot?

How to make the new version of OpenWRT self-boot? By @\u827E\u65AF\u5FB7\u65AF

#!/bin/sh /etc/rc.common

START=99
USE_PROCD=1

start_service() {
 procd_open_instance
 procd_set_param command /root/nezha-agent -s data.example.com:5555 -p secreat -d
 procd_set_param respawn
 procd_close_instance
}

stop_service() {
    killall nezha-agent
}

restart() {
 stop
 sleep 2
 start
}

Customize Agent

Customize the NIC and hard drive partitions to be monitored

Other Flags

Run ./nezha-agent --help to view supported flags\uFF0Cif you are already using the one-click script, you can edit /etc/systemd/system/nezha-agent.service\uFF0Cat the end of this line ExecStart= add:

FAQ

Is there a Docker image for Agent?

There is currently no Docker image for Agent.
The Agent is designed to be the opposite of the Dashboard, in that the Dashboard is designed to work without affecting the server as much as possible, while the Agent needs to execute monitoring services and run commands in the server.
Putting the Agent in a container does continue to execute monitoring services, but features such as WebShell do not work, so we do not provide Docker image of the Agent.

`,48),i=[o];function l(p,c,r,u,d,g){return t(),a("div",null,i)}var m=n(s,[["render",l]]);export{k as __pageData,m as default};