### Frontend Setup and Startup Source: https://github.com/apache/hertzbeat/blob/master/CONTRIBUTING.md Instructions for setting up the Node.js frontend environment, including installing dependencies and starting the development server. ```shell cd web-app npm install -g pnpm pnpm install or pnpm install --registry=https://registry.npmmirror.com in web-app pnpm start # Browser access localhost:4200 ``` -------------------------------- ### Install Dependencies and Start Preview Source: https://github.com/apache/hertzbeat/blob/master/home/versioned_docs/version-1.8.0/community/document.md Install Node.js dependencies and start a local development server to preview the documentation website in English or Chinese. ```shell cd home && npm install npm run start # or npm run start-zh-cn ``` -------------------------------- ### Start Springboot Startup Service Source: https://github.com/apache/hertzbeat/blob/master/home/versioned_docs/version-1.8.0/community/development.md Execute this command in the project root directory to build and install the project, skipping tests. Ensure Java 17, Maven 3+, and Lombok are set up. ```bash mvn clean install -DskipTests ``` -------------------------------- ### Start HertzBeat Application Source: https://github.com/apache/hertzbeat/blob/master/home/versioned_docs/version-1.8.0/help/risc-v.md Navigates to the HertzBeat bin directory and starts the application using the startup script. Ensure you are in the correct HertzBeat installation directory. ```shell cd apache-hertzbeat-1.7.2-incubating-bin/bin/ ./startup.sh ``` -------------------------------- ### Install Ubuntu on QEMU for RISC-V Source: https://github.com/apache/hertzbeat/blob/master/home/versioned_docs/version-1.8.0/help/risc-v.md Decompresses and expands an Ubuntu image, then starts a RISC-V virtual machine using QEMU and U-Boot. Ensure the image file name and path to uboot.elf are correct for your system. ```shell xz -dk ubuntu-24.04.2-preinstalled-server-riscv64.img.xz qemu-img resize -f raw ubuntu-24.04-preinstalled-server-riscv64.img +5G qemu-system-riscv64 \ -machine virt -nographic -m 2048 -smp 4 \ -kernel /usr/lib/u-boot/qemu-riscv64_smode/uboot.elf \ -device virtio-net-device,netdev=eth0 -netdev user,id=eth0 \ -device virtio-rng-pci \ -drive file=ubuntu-24.04.2-preinstalled-server-riscv64.img,format=raw,if=virtio ``` -------------------------------- ### Install GreptimeDB using Docker Source: https://github.com/apache/hertzbeat/blob/master/home/blog/2023-05-11-greptimedb-store.md Use this Docker command to start a standalone GreptimeDB instance. Mount a local directory for persistent data storage. Ensure the specified local directory exists. ```shell $ docker run -p 4000-4004:4000-4004 \ -p 4242:4242 -v "$(pwd)/greptimedb:/tmp/greptimedb" \ --name greptime \ greptime/greptimedb:0.2.0 standalone start \ --http-addr 0.0.0.0.0:4000 \ --rpc-addr 0.0.0.0:4001 ``` -------------------------------- ### Install GreptimeDB using Docker Source: https://github.com/apache/hertzbeat/blob/master/home/i18n/zh-cn/docusaurus-plugin-content-docs/version-1.8.0/start/greptime-init.md Run this command to start a GreptimeDB standalone instance using Docker. It maps ports and mounts a local directory for data persistence. Replace "$(pwd)/greptimedb" with your desired local path. ```shell docker run -d -p 127.0.0.1:4000-4003:4000-4003 \ -v "$(pwd)/greptimedb:/tmp/greptimedb" \ --name greptime \ greptime/greptimedb:latest standalone start \ --http-addr 0.0.0.0:4000 \ --rpc-addr 0.0.0.0:4001 \ --mysql-addr 0.0.0.0:4002 \ --postgres-addr 0.0.0.0:4003 ``` -------------------------------- ### Install QEMU and Required Packages Source: https://github.com/apache/hertzbeat/blob/master/home/versioned_docs/version-1.8.0/help/risc-v.md Installs QEMU, OpenSBI, and U-Boot for emulating RISC-V architecture on Ubuntu. ```shell sudo apt update sudo apt install opensbi qemu-system-misc u-boot-qemu ``` -------------------------------- ### Download and Extract QuestDB Source: https://github.com/apache/hertzbeat/blob/master/home/i18n/zh-cn/docusaurus-plugin-content-docs/version-1.8.0/start/questdb-init.md Download the QuestDB installation package for your operating system and extract it. This example uses wget for Linux/macOS and assumes a specific version. ```shell # Linux/macOS(以v7.3.9为例,可替换为最新版本号) wget https://github.com/questdb/questdb/releases/download/7.3.9/questdb-7.3.9-no-jre-bin.tar.gz # 解压 tar -zxvf questdb-7.3.9-no-jre-bin.tar.gz mv questdb-7.3.9 /opt/questdb # 移动到常用目录 ``` -------------------------------- ### Check Docker Installation Source: https://github.com/apache/hertzbeat/blob/master/home/i18n/zh-cn/docusaurus-plugin-content-docs/version-1.8.0/start/iotdb-init.md Verify that Docker is installed and accessible by checking its version. This is a prerequisite for using Docker to install IoTDB. ```shell $ docker -v Docker version 20.10.12, build e91ed57 ``` -------------------------------- ### Backend Setup and Startup Source: https://github.com/apache/hertzbeat/blob/master/CONTRIBUTING.md Instructions for setting up the Java backend environment, including prerequisites and startup commands. ```shell mvn clean install -DskipTests # In jvm add parameter --add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED # Start springboot startup service hertzbeat-startup/src/main/java/org/apache/hertzbeat/startup/HertzBeatApplication.java ``` -------------------------------- ### Start Local Development Server Source: https://github.com/apache/hertzbeat/blob/master/home/README.md Starts a local development server for live preview. Changes are reflected without a server restart. ```console pnpm start ``` -------------------------------- ### Basic Time Formatters Source: https://github.com/apache/hertzbeat/blob/master/home/versioned_docs/version-1.8.0/help/time_expression.md Use these formatters to get the current time in various predefined formats. Examples are based on the current time being `2022-04-24 02:40:00.123`. ```shell ${@now} ``` ```shell ${@date} ``` ```shell ${@timestamp10} ``` ```shell ${@timestamp} ``` ```shell ${@time} ``` ```shell ${@year} ``` ```shell ${@month} ``` ```shell ${@day} ``` ```shell ${@hour} ``` ```shell ${@minute} ``` ```shell ${@millisecond} ``` ```shell ${@second} ``` -------------------------------- ### Install HertzBeat via Docker Source: https://github.com/apache/hertzbeat/blob/master/home/blog/2023-09-26-hertzbeat-v1.4.1.md Run this command to quickly start HertzBeat using Docker. Access the web UI at http://localhost:1157 with default credentials admin/hertzbeat. ```docker docker run -d -p 1157:1157 -p 1158:1158 --name hertzbeat apache/hertzbeat ``` -------------------------------- ### Start HertzBeat via Package Source: https://github.com/apache/hertzbeat/blob/master/README.md Instructions for starting HertzBeat after downloading and extracting the release package. Ensure the configuration file is set up if necessary. ```shell ./bin/startup.sh ``` -------------------------------- ### Docker Compose for Redis Cluster Setup Source: https://github.com/apache/hertzbeat/blob/master/home/versioned_docs/version-1.8.0/help/redis_cluster.md Define and manage multiple Redis instances for a cluster using Docker Compose. This example sets up three masters and three slaves. ```yaml services: redis-master-1: image: redis:latest container_name: redis-master-1 command: ["redis-server", "/usr/local/etc/redis/redis.conf"] volumes: - ./redis.conf:/usr/local/etc/redis/redis.conf ports: - "1000:6379" redis-master-2: image: redis:latest container_name: redis-master-2 command: ["redis-server", "/usr/local/etc/redis/redis.conf"] volumes: - ./redis.conf:/usr/local/etc/redis/redis.conf ports: - "2000:6379" redis-master-3: image: redis:latest container_name: redis-master-3 command: ["redis-server", "/usr/local/etc/redis/redis.conf"] volumes: - ./redis.conf:/usr/local/etc/redis/redis.conf ports: - "3000:6379" redis-slave-1: image: redis:latest container_name: redis-slave-1 command: ["redis-server", "/usr/local/etc/redis/redis.conf"] volumes: - ./redis.conf:/usr/local/etc/redis/redis.conf ports: - "1001:6379" redis-slave-2: image: redis:latest container_name: redis-slave-2 command: ["redis-server", "/usr/local/etc/redis/redis.conf"] volumes: - ./redis.conf:/usr/local/etc/redis/redis.conf ports: - "2001:6379" redis-slave-3: image: redis:latest container_name: redis-slave-3 command: ["redis-server", "/usr/local/etc/redis/redis.conf"] volumes: - ./redis.conf:/usr/local/etc/redis/redis.conf ports: - "3001:6379" networks: default: external: name: hertzbeat-redis-cluster ``` -------------------------------- ### Define Plugin Parameters Source: https://github.com/apache/hertzbeat/blob/master/home/versioned_docs/version-1.8.0/help/plugin.md Define custom parameters for your plugin in a YAML file starting with `define-`. This example shows how to define `host` and `port` parameters with their display names, types, and requirements. ```yaml params: - field: host # name-param field display i18n name name: zh-CN: 目标 Host en-US: Target Host # type-param field type(most mapping the html input type) type: text # required-true or false required: true # field-param field key - field: port # name-param field display i18n name name: zh-CN: 端口 en-US: Port # type-param field type(most mapping the html input type) type: number # when type is number, range is required range: '[0,65535]' ``` -------------------------------- ### Install GreptimeDB with Docker Source: https://github.com/apache/hertzbeat/blob/master/home/versioned_docs/version-1.8.0/start/greptime-init.md Run GreptimeDB as a Docker container. This command starts the database in detached mode, maps ports, mounts a local directory for data persistence, and configures network addresses. ```shell docker run -d -p 127.0.0.1:4000-4003:4000-4003 \ v "$(pwd)/greptimedb:/tmp/greptimedb" \ --name greptime \ greptime/greptimedb:latest standalone start \ --http-addr 0.0.0.0:4000 \ --rpc-addr 0.0.0.0:4001 \ --mysql-addr 0.0.0.0:4002 \ --postgres-addr 0.0.0.0:4003 ``` -------------------------------- ### HTTP Service Discovery Configuration Example (Basic Auth) Source: https://github.com/apache/hertzbeat/blob/master/home/i18n/zh-cn/docusaurus-plugin-content-docs/version-1.8.0/help/http_sd.md Configuration example for HTTP Service Discovery with Basic Authentication. Specify the API address, select 'Basic Auth', and provide the username and password for authentication. ```text - 任务名称:Basic-Auth-Discovery - 服务发现地址:http://api.internal.com/discover - 认证方式:选择 Basic Auth - 用户名:admin - 密码:password123 - 监控模板:选择合适的模板 ``` -------------------------------- ### HTTP Service Discovery Configuration Example (No Auth) Source: https://github.com/apache/hertzbeat/blob/master/home/i18n/zh-cn/docusaurus-plugin-content-docs/version-1.8.0/help/http_sd.md Configuration example for setting up HTTP Service Discovery with an API that does not require authentication. Ensure the 'Service Discovery Address' points to your API endpoint and the 'Monitoring Template' is appropriate for the discovered services. ```text - 任务名称:HTTP-Service-Discovery - 服务发现地址:http://service-manager.example.com/api/v1/services - 认证方式:留空(无需认证) - 采集间隔:60 秒 - 监控模板:选择 端口 监控 ``` -------------------------------- ### Run HertzBeat Server with Docker Source: https://github.com/apache/hertzbeat/blob/master/home/versioned_docs/version-1.8.0/start/docker-deploy.md Execute this command to start the HertzBeat server in detached mode. It maps necessary ports, mounts volumes for data persistence and logs, and configures automatic restarts. Ensure Docker is installed and accessible. ```shell docker run -d -p 1157:1157 -p 1158:1158 \ -v $(pwd)/data:/opt/hertzbeat/data \ -v $(pwd)/logs:/opt/hertzbeat/logs \ -v $(pwd)/application.yml:/opt/hertzbeat/config/application.yml \ -v $(pwd)/sureness.yml:/opt/hertzbeat/config/sureness.yml \ --restart=always \ --name hertzbeat apache/hertzbeat ``` -------------------------------- ### Install Dependencies Source: https://github.com/apache/hertzbeat/blob/master/web-app/README.md Run this command in the 'web-app' directory to install project dependencies using pnpm. Consider using a mirror registry for faster downloads. ```bash pnpm install or pnpm install --registry=https://registry.npmmirror.com ``` -------------------------------- ### Import Monitor Configurations Source: https://context7.com/apache/hertzbeat/llms.txt Import monitor configurations from a JSON file. The file should be uploaded as multipart/form-data. ```bash curl -s -X POST http://localhost:1157/api/monitors/import \ -H "Authorization: Bearer $TOKEN" \ -F "file=@monitors-export.json" | jq . ``` -------------------------------- ### Start QuestDB Service (Windows) Source: https://github.com/apache/hertzbeat/blob/master/home/versioned_docs/version-1.8.0/start/questdb-init.md Navigate to the QuestDB binary directory in the Command Prompt and start the QuestDB service. This command initiates the time-series database. ```shell # For Windows (Command Prompt): cd C:\questdb\bin questdb.exe start ``` -------------------------------- ### Run E2E Tests Locally with Docker Compose Source: https://github.com/apache/hertzbeat/blob/master/e2e/README.md Execute the end-to-end tests locally by starting the Docker Compose environment. Ensure Docker Compose v2 is installed. The `--exit-code-from testing` flag ensures the exit code reflects the test results. ```bash docker compose up --exit-code-from testing --remove-orphans ``` -------------------------------- ### Check Docker Installation Source: https://github.com/apache/hertzbeat/blob/master/home/i18n/zh-cn/docusaurus-plugin-content-docs/version-1.8.0/start/greptime-init.md Verify your Docker installation by checking its version. Ensure Docker is installed and accessible in your terminal. ```shell docker -v Docker version 20.10.12, build e91ed57 ``` -------------------------------- ### Start QuestDB Service (Linux/macOS) Source: https://github.com/apache/hertzbeat/blob/master/home/versioned_docs/version-1.8.0/start/questdb-init.md Navigate to the QuestDB binary directory and start the QuestDB service. This command initiates the time-series database. ```shell # For Linux/macOS: Navigate to the installation directory and start the service cd /opt/questdb/bin ./questdb start ``` -------------------------------- ### Install HertzBeat with Binary Package Source: https://github.com/apache/hertzbeat/blob/master/home/static/llms-zh.txt Alternative installation using a downloaded binary package. This involves extracting the archive and running the startup script. ```bash tar -xzf apache-hertzbeat-1.8.0-bin.tar.gz cd apache-hertzbeat-1.8.0 ./bin/startup.sh ``` -------------------------------- ### Install HertzBeat with Docker Source: https://github.com/apache/hertzbeat/blob/master/home/blog/2022-09-04-hertzbeat-v1.1.3.md Use this command to quickly install and run HertzBeat using Docker. Ensure Docker is installed and running on your system. ```bash docker run -d -p 1157:1157 --namehertzbeat apache/hertzbeat ``` -------------------------------- ### Install PostgreSQL with Docker Source: https://github.com/apache/hertzbeat/blob/master/home/versioned_docs/version-1.8.0/start/postgresql-change.md Run a PostgreSQL instance using Docker, mapping the default port and setting root credentials. ```shell docker run -d --name postgresql -p 5432:5432 -e POSTGRES_USER=root -e POSTGRES_PASSWORD=123456 -e TZ=Asia/Shanghai postgres:15 ``` -------------------------------- ### Start HertzBeat Frontend from Source Source: https://github.com/apache/hertzbeat/blob/master/README.md Start the HertzBeat frontend development server using Angular CLI. This command should be run in the 'web-app' directory after the backend has started. ```shell ng serve --open ``` -------------------------------- ### Example: Single VM CPU Information Source: https://github.com/apache/hertzbeat/blob/master/home/versioned_docs/version-1.8.0/advanced/extend-http-default.md An example of single-layer JSON response for CPU information when there is only one virtual machine. ```json { "hostname": "linux-1", "core": 1, "usage": 78.0, "allTime": 200, "runningTime": 100 } ```