Skip to content

Commit

Permalink
[doc] Add doc for linux_script and windows_script (#2646)
Browse files Browse the repository at this point in the history
Co-authored-by: shown <yuluo08290126@gmail.com>
Co-authored-by: aias00 <rokkki@163.com>
  • Loading branch information
3 people authored Sep 3, 2024
1 parent 9024b2a commit 7b886fe
Show file tree
Hide file tree
Showing 7 changed files with 377 additions and 5 deletions.
100 changes: 100 additions & 0 deletions home/docs/help/linux_script.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
---
id: linux_script
title: Monitoring:Using Scripts to Monitor Linux Operating System
sidebar_label: Using Scripts to Monitor Linux OS
keywords: [open source monitoring system, open source network monitoring, using scripts to monitor Linux OS]
---

### Preparation

> To monitor the local machine, simply deploy Hertzbeat. To monitor other hosts, you need to deploy a collector on the target host. Refer to [this link](https://github.com/apache/hertzbeat?tab=readme-ov-file#2install-via-package) for step 5 of the installation process.
> When creating a monitoring task and selecting a collector, choose the corresponding collector deployed on the target host.
### Configuration Parameters

| Parameter Name | Parameter Description |
|:---------------|-----------------------------------------------------|---|
| Monitor Host | The IPv4, IPv6, or domain of the monitored endpoint. Note ⚠️ Do not include protocol headers (e.g., https://, http://). |
| Task Name | The name identifying this monitoring task, which needs to be unique. |
| Collector | Specifies which collector will be used for data collection in this monitoring task. |
| Monitoring Interval | The time interval for periodic data collection, in seconds. |
| Binding Tag | Classification management tags for monitoring resources. |
| Description Notes | Additional notes to describe this monitoring task. Users can add remarks here. |

### Metrics Collection

#### Metric Set: basic

| Metric Name | Metric Unit | Metric Description |
|-------------|-------------|--------------------------|
| hostname | None | Name of the host |
| version | None | Operating system version |
| uptime | None | System uptime |

#### Metric Set: cpu

| Metric Name | Metric Unit | Metric Description |
|----------------|-------------|-----------------------------------------------|
| info | None | CPU model |
| cores | Number | Number of CPU cores |
| interrupt | Count | Number of CPU interrupts |
| load | None | Average CPU load over the last 1/5/15 minutes |
| context_switch | Count | Current number of context switches |
| usage | % | CPU usage percentage |

#### Metric Set: memory

| Metric Name | Metric Unit | Metric Description |
|-------------|-------------|------------------------------|
| total | Mb | Total memory capacity |
| used | Mb | Memory used by user programs |
| free | Mb | Free memory capacity |
| buff_cache | Mb | Memory used by cache |
| available | Mb | Available memory capacity |
| usage | % | Memory usage percentage |

#### Metric Set: disk

| Metric Name | Metric Unit | Metric Description |
|---------------|-------------|-------------------------------------------|
| disk_num | Count | Total number of disks |
| partition_num | Count | Total number of partitions |
| block_write | Count | Total number of blocks written to disk |
| block_read | Count | Total number of blocks read from disk |
| write_rate | iops | Rate of blocks written to disk per second |

#### Metric Set: interface

| Metric Name | Metric Unit | Metric Description |
|----------------|-------------|-------------------------------|
| interface_name | None | Network interface name |
| receive_bytes | byte | Inbound data traffic (bytes) |
| transmit_bytes | byte | Outbound data traffic (bytes) |

#### Metric Set: disk_free

| Metric Name | Metric Unit | Metric Description |
|-------------|-------------|------------------------|
| filesystem | None | Name of the filesystem |
| used | Mb | Used disk size |
| available | Mb | Available disk size |
| usage | % | Disk usage percentage |
| mounted | None | Mount point directory |

#### Metric Set: Top 10 Programs by CPU Usage

| Metric Name | Metric Unit | Metric Description |
|-------------|-------------|-------------------------|
| id | None | Process ID |
| cpu | % | CPU usage percentage |
| ws | % | Memory usage percentage |
| command | None | Executed command |

#### Metric Set: Top 10 Programs by Memory Usage

| Metric Name | Metric Unit | Metric Description |
|-------------|-------------|-------------------------|
| id | None | Process ID |
| cpu | % | CPU usage percentage |
| ws | % | Memory usage percentage |
| command | None | Executed command |
85 changes: 85 additions & 0 deletions home/docs/help/windows_script.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
id: windows_script
title: Monitoring:Using Scripts to Monitor Windows Operating System
sidebar_label: Using Scripts to Monitor Windows OS
keywords: [open source monitoring system, open source network monitoring, using scripts to monitor Windows OS]
---

### Preparation

> To monitor the local machine, simply deploy Hertzbeat. To monitor other hosts, you need to deploy a collector on the target host. Refer to [this link](https://github.com/apache/hertzbeat?tab=readme-ov-file#2install-via-package) for step 5 of the installation process.
> When creating a monitoring task and selecting a collector, choose the corresponding collector deployed on the target host.
### Configuration Parameters

| Parameter Name | Parameter Description |
|:---------------|-----------------------------------------------------|---|
| Monitor Host | The IPv4, IPv6, or domain of the monitored endpoint. Note ⚠️ Do not include protocol headers (e.g., https://, http://). |
| Task Name | The name identifying this monitoring task, which needs to be unique. |
| Collector | Specifies which collector will be used for data collection in this monitoring task. |
| Monitoring Interval | The time interval for periodic data collection, in seconds. |
| Binding Tag | Classification management tags for monitoring resources. |
| Description Notes | Additional notes to describe this monitoring task. Users can add remarks here. |

### Metrics Collection

#### Metric Set: basic

| Metric Name | Metric Unit | Metric Description |
|-------------|-------------|--------------------------|
| hostname | None | Name of the host |
| version | None | Operating system version |

#### Metric Set: cpu

| Metric Name | Metric Unit | Metric Description |
|----------------|-------------|------------------------------------|
| info | None | CPU model |
| cores | Number | Number of CPU cores |
| interrupt | Count | Number of CPU interrupts |
| load | None | Average recent CPU load |
| context_switch | Count | Current number of context switches |
| usage | % | CPU usage percentage |

#### Metric Set: memory

| Metric Name | Metric Unit | Metric Description |
|---------------|-------------|--------------------------------|
| totalPhysical | Mb | Total physical memory capacity |
| freePhysical | Mb | Free physical memory capacity |
| totalVirtual | Mb | Total virtual memory capacity |
| freeVirtual | Mb | Free virtual memory capacity |

#### Metric Set: disk

| Metric Name | Metric Unit | Metric Description |
|----------------|-------------|----------------------------|
| Model | None | Disk model |
| Size | Mb | Disk size |
| BytesPerSector | Bytes | Number of bytes per sector |

#### Metric Set: disk_free

| Metric Name | Metric Unit | Metric Description |
|-------------|-------------|----------------------|
| Caption | None | Disk label |
| FreeSpace | Mb | Available disk space |
| Size | Mb | Total disk space |

#### Metric Set: Top 10 Programs by CPU Usage

| Metric Name | Metric Unit | Metric Description |
|-------------|-------------|---------------------|
| name | None | Process name |
| id | None | Process ID |
| cpu | Seconds | CPU usage time |
| ws | Mb | Memory usage |

#### Metric Set: Top 10 Programs by Memory Usage

| Metric Name | Metric Unit | Metric Description |
|-------------|-------------|---------------------|
| name | None | Process name |
| id | None | Process ID |
| cpu | Seconds | CPU usage time |
| ws | Mb | Memory usage |
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
---
id: linux_script
title: 监控:使用脚本监控 Linux 操作系统
sidebar_label: 使用脚本监控 Linux 操作系统
keywords: [开源监控系统, 开源网络监控, 使用脚本监控 Linux 操作系统]
---

### 准备工作

> 若要监控本机,部署 Hertzbeat 即可,若要监控其他主机,需在目标主机上部署采集器,部署采集器可参考[此链接](https://github.com/apache/hertzbeat?tab=readme-ov-file#2install-via-package)的第 5 步。
> 在创建监控任务选择采集器时,需选择目标主机上对应的采集器。
### 配置参数

| 参数名称 | 参数帮助描述 |
|:-------|---------------------------------|---|
| 监控 Host | 被监控的对端 IPV4,IPV6 或域名。注意⚠️不带协议头(eg: https://, http://)。 |
| 任务名称 | 标识此监控的名称,名称需要保证唯一性。 | |
| 采集器 | 配置此监控使用哪台采集器调度采集。 |
| 监控周期 | 监控周期性采集数据间隔时间,单位秒。 |
| 绑定标签 | 对监控资源的分类管理标签。 |
| 描述备注 | 更多标识和描述此监控的备注信息,用户可以在这里备注信息。 |

### 采集指标

#### 指标集合:basic

| 指标名称 | 指标单位 | 指标帮助描述 |
|----------|------|--------|
| hostname || 主机名称 |
| version || 操作系统版本 |
| uptime || 系统启动时间 |

#### 指标集合:cpu

| 指标名称 | 指标单位 | 指标帮助描述 |
|----------------|------|-----------------------|
| info || CPU 型号 |
| cores | 核数 | CPU 内核数量 |
| interrupt | 个数 | CPU 中断数量 |
| load || CPU 最近 1/5/15 分钟的平均负载 |
| context_switch | 个数 | 当前上下文切换数量 |
| usage | % | CPU 使用率 |

#### 指标集合:memory

| 指标名称 | 指标单位 | 指标帮助描述 |
|------------|------|----------|
| total | Mb | 总内存容量 |
| used | Mb | 用户程序内存量 |
| free | Mb | 空闲内存容量 |
| buff_cache | Mb | 缓存占用内存 |
| available | Mb | 剩余可用内存容量 |
| usage | % | 内存使用率 |

#### 指标集合:disk

| 指标名称 | 指标单位 | 指标帮助描述 |
|---------------|------|-----------|
| disk_num | 块数 | 磁盘总数 |
| partition_num | 分区数 | 分区总数 |
| block_write | 块数 | 写入磁盘的总块数 |
| block_read | 块数 | 从磁盘读出的块数 |
| write_rate | iops | 每秒写磁盘块的速率 |

#### 指标集合:interface

| 指标名称 | 指标单位 | 指标帮助描述 |
|----------------|------|---------------|
| interface_name || 网卡名称 |
| receive_bytes | byte | 入站数据流量(bytes) |
| transmit_bytes | byte | 出站数据流量(bytes) |

#### 指标集合:disk_free

| 指标名称 | 指标单位 | 指标帮助描述 |
|------------|------|---------|
| filesystem || 文件系统的名称 |
| used | Mb | 已使用磁盘大小 |
| available | Mb | 可用磁盘大小 |
| usage | % | 使用率 |
| mounted || 挂载点目录 |

#### 指标集合:CPU 占用率前10的程序

| 指标名称 | 指标单位 | 指标帮助描述 |
|---------|------|---------|
| id || 进程 id |
| cpu | % | cpu 占用率 |
| ws | % | 内存占用率 |
| command || 执行的命令 |

#### 指标集合:内存占用率前10的程序

| 指标名称 | 指标单位 | 指标帮助描述 |
|---------|------|---------|
| id || 进程 id |
| cpu | % | cpu 占用率 |
| ws | % | 内存占用率 |
| command || 执行的命令 |
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
id: windows_script
title: 监控:使用脚本监控 Windows 操作系统
sidebar_label: 使用脚本监控 Windows 操作系统
keywords: [开源监控系统, 开源网络监控, 使用脚本监控 Windows 操作系统]
---

### 准备工作

> 若要监控本机,部署 Hertzbeat 即可,若要监控其他主机,需在目标主机上部署采集器,部署采集器可参考[此链接](https://github.com/apache/hertzbeat?tab=readme-ov-file#2install-via-package)的第 5 步。
> 在创建监控任务选择采集器时,需选择目标主机上对应的采集器。
### 配置参数

| 参数名称 | 参数帮助描述 |
|:-------|---------------------------------|---|
| 监控 Host | 被监控的对端 IPV4,IPV6 或域名。注意⚠️不带协议头(eg: https://, http://)。 |
| 任务名称 | 标识此监控的名称,名称需要保证唯一性。 | |
| 采集器 | 配置此监控使用哪台采集器调度采集。 |
| 监控周期 | 监控周期性采集数据间隔时间,单位秒。 |
| 绑定标签 | 对监控资源的分类管理标签。 |
| 描述备注 | 更多标识和描述此监控的备注信息,用户可以在这里备注信息。 |

### 采集指标

#### 指标集合:basic

| 指标名称 | 指标单位 | 指标帮助描述 |
|----------|------|--------|
| hostname || 主机名称 |
| version || 操作系统版本 |

#### 指标集合:cpu

| 指标名称 | 指标单位 | 指标帮助描述 |
|----------------|------|-------------|
| info || CPU 型号 |
| cores | 核数 | CPU 内核数量 |
| interrupt | 个数 | CPU 中断数量 |
| load || CPU 最近的平均负载 |
| context_switch | 个数 | 当前上下文切换数量 |
| usage | % | CPU 使用率 |

#### 指标集合:memory

| 指标名称 | 指标单位 | 指标帮助描述 |
|---------------|------|----------|
| totalPhysical | Mb | 总物理内存容量 |
| freePhysical | Mb | 空闲物理内存容量 |
| totalVirtual | Mb | 总虚拟内存容量 |
| freeVirtual | Mb | 空闲虚拟内存容量 |

#### 指标集合:disk

| 指标名称 | 指标单位 | 指标帮助描述 |
|----------------|------|---------|
| Model || 磁盘型号 |
| Size | Mb | 磁盘大小 |
| BytesPerSector | 字节 | 每个扇区字节数 |

#### 指标集合:disk_free

| 指标名称 | 指标单位 | 指标帮助描述 |
|-----------|------|--------|
| Caption || 盘符 |
| FreeSpace | Mb | 可用空间大小 |
| Size | Mb | 总空间大小 |

#### 指标集合:CPU 占用率前10的程序

| 指标名称 | 指标单位 | 指标帮助描述 |
|------|------|----------|
| name || 进程名称 |
| id || 进程 id |
| cpu || cpu 使用时间 |
| ws | Mb | 内存占用量 |

#### 指标集合:内存占用率前10的程序

| 指标名称 | 指标单位 | 指标帮助描述 |
|------|------|----------|
| name || 进程名称 |
| id || 进程 id |
| cpu || cpu 使用时间 |
| ws | Mb | 内存占用量 |
4 changes: 3 additions & 1 deletion home/sidebars.json
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,9 @@
"help/freebsd",
"help/redhat",
"help/rockylinux",
"help/euleros"
"help/euleros",
"help/linux_script",
"help/windows_script"
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions manager/src/main/resources/define/app-linux_script.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ help:
en-US: Hertzbeat uses a collector as an agent to directly execute <a class='help_module_content' href='https://hertzbeat.apache.org/docs/advanced/extend-script'> Shell commands </a> to collect and monitor general performance metrics of the Linux operating system (system information, CPU, memory, disk, network card, file system, TOP resource processes, etc.).<br>You can click “<i>Create New Linux Script</i>” to add it. Or select “<i>More Actions</i>” to import an existing configuration.
zh-TW: Hertzbeat 使用采集器作為 agent 直接運行 <a class='help_module_content' href='https://hertzbeat.apache.org/docs/advanced/extend-script'> Shell 命令 </a> 對 Linux 操作系統的通用性能指標 (系統信息、CPU、內存、磁盤、網卡、文件系統、TOP資源進程等) 進行採集監控。<br>您可以點擊“<i>新建 Linux Script</i>”進行添加。或者選擇“<i>更多操作</i>”,導入已有配置。
helpLink:
zh-CN: https://hertzbeat.apache.org/zh-cn/docs/help/script
en-US: https://hertzbeat.apache.org/docs/help/script
zh-CN: https://hertzbeat.apache.org/zh-cn/docs/help/linux_script
en-US: https://hertzbeat.apache.org/docs/help/linux_script
# Input params define for monitoring(render web ui by the definition)
params:
# field-param field key
Expand Down
Loading

0 comments on commit 7b886fe

Please sign in to comment.