From be84a0abae0cd2813ca391b12fca928f791ab687 Mon Sep 17 00:00:00 2001
From: tomsun28 <tomsun28@outlook.com>
Date: Mon, 18 Nov 2024 21:57:50 +0800
Subject: [PATCH] [improve] update windows metrics yml (#2816)

Signed-off-by: tomsun28 <tomsun28@outlook.com>
---
 .../src/main/resources/define/app-windows.yml | 233 ++++++------------
 1 file changed, 73 insertions(+), 160 deletions(-)

diff --git a/hertzbeat-manager/src/main/resources/define/app-windows.yml b/hertzbeat-manager/src/main/resources/define/app-windows.yml
index 6e06b2cbb6d..f3a77e61d19 100644
--- a/hertzbeat-manager/src/main/resources/define/app-windows.yml
+++ b/hertzbeat-manager/src/main/resources/define/app-windows.yml
@@ -193,8 +193,8 @@ metrics:
       - field: hrSWRunIndex
         type: 0
         i18n:
-          zh-CN: 进程 Index
-          en-US: Process Index
+          zh-CN: 编号
+          en-US: Index
       - field: hrSWRunName
         type: 1
         i18n:
@@ -315,8 +315,8 @@ metrics:
       - field: hrSWInstalledIndex
         type: 0
         i18n:
-          zh-CN: 安装 Index
-          en-US: Installed Index
+          zh-CN: 编号
+          en-US: 编号
       - field: hrSWInstalledName
         type: 1
         i18n:
@@ -347,35 +347,6 @@ metrics:
         hrSWInstalledID: 1.3.6.1.2.1.25.6.3.1.3
         hrSWInstalledType: 1.3.6.1.2.1.25.6.3.1.4
 
-  - name: cpu
-    i18n:
-      zh-CN: CPU
-      en-US: CPU
-    priority: 1
-    fields:
-      - field: hrProcessorFrwID
-        type: 1
-        i18n:
-          zh-CN: 处理器 ID
-          en-US: Processor ID
-      - field: hrProcessorLoad
-        type: 0
-        i18n:
-          zh-CN: 处理器负载
-          en-US: Processor Load
-        unit: '%'
-    protocol: snmp
-    snmp:
-      host: ^_^host^_^
-      port: ^_^port^_^
-      timeout: ^_^timeout^_^
-      community: ^_^community^_^
-      version: ^_^version^_^
-      operation: walk
-      oids:
-        hrProcessorFrwID: 1.3.6.1.2.1.25.3.3.1.1
-        hrProcessorLoad: 1.3.6.1.2.1.25.3.3.1.2
-
   - name: storages
     i18n:
       zh-CN: 存储
@@ -385,8 +356,8 @@ metrics:
       - field: index
         type: 0
         i18n:
-          zh-CN: 存储 Index
-          en-US: Storage Index
+          zh-CN: 编号
+          en-US: 编号
       - field: descr
         type: 1
         i18n:
@@ -398,19 +369,19 @@ metrics:
           zh-CN: 存储大小
           en-US: Storage Size
         type: 0
-        unit: MB
+        unit: Mb
       - field: free
         type: 0
         i18n:
           zh-CN: 存储空闲
           en-US: Storage Free
-        unit: MB
+        unit: Mb
       - field: used
         type: 0
         i18n:
           zh-CN: 存储占用
           en-US: Storage Used
-        unit: MB
+        unit: Mb
       - field: usage
         type: 0
         i18n:
@@ -434,8 +405,9 @@ metrics:
       - used=hrStorageUsed * hrStorageAllocationUnits
       - usage= hrStorageUsed / hrStorageSize * 100
     units:
-      - size=B->MB
-      - used=B->MB
+      - size=B->Mb
+      - used=B->Mb
+      - free=B->Mb
     protocol: snmp
     snmp:
       host: ^_^host^_^
@@ -451,192 +423,133 @@ metrics:
         hrStorageUsed: 1.3.6.1.2.1.25.2.3.1.6
         hrStorageAllocationUnits: 1.3.6.1.2.1.25.2.3.1.4
 
-  - name: disk
-    i18n:
-      zh-CN: 磁盘
-      en-US: Disk
-    priority: 2
-    fields:
-      - field: hrDiskStorageAccess
-        type: 0
-        i18n:
-          zh-CN: 磁盘存储访问
-          en-US: Disk Storage Access
-      - field: hrDiskStorageMedia
-        type: 0
-        i18n:
-          zh-CN: 磁盘存储介质
-          en-US: Disk Storage Media
-      - field: hrDiskStorageRemoveble
-        type: 0
-        i18n:
-          zh-CN: 磁盘存储是否可移动
-          en-US: Disk Storage Removeble
-      - field: hrDiskStorageCapacity
-        type: 0
-        i18n:
-          zh-CN: 磁盘存储容量
-          en-US: Disk Storage Capacity
-        unit: MB
-    units:
-      - hrDiskStorageCapacity=KB->MB
-    protocol: snmp
-    snmp:
-      host: ^_^host^_^
-      port: ^_^port^_^
-      timeout: ^_^timeout^_^
-      community: ^_^community^_^
-      version: ^_^version^_^
-      operation: walk
-      oids:
-        hrDiskStorageAccess: 1.3.6.1.2.1.25.3.6.1.1
-        hrDiskStorageMedia: 1.3.6.1.2.1.25.3.6.1.2
-        hrDiskStorageRemoveble: 1.3.6.1.2.1.25.3.6.1.3
-        hrDiskStorageCapacity: 1.3.6.1.2.1.25.3.6.1.4
-
-  - name: network
-    i18n:
-      zh-CN: 网络
-      en-US: Network
-    priority: 3
-    fields:
-      - field: number
-        type: 1
-        i18n:
-          zh-CN: 编号
-          en-US: Number
-    protocol: snmp
-    snmp:
-      host: ^_^host^_^
-      port: ^_^port^_^
-      timeout: ^_^timeout^_^
-      community: ^_^community^_^
-      version: ^_^version^_^
-      oids:
-        number: 1.3.6.1.2.1.2.1.0
 
   - name: interfaces
     i18n:
-      zh-CN: 接口
-      en-US: Interfaces
-    priority: 4
+      zh-CN: 接口详情
+      en-US: Interfaces Detail
+    priority: 1
     fields:
       - field: index
-        type: 0
+        type: 1
         i18n:
-          zh-CN: 序号
+          zh-CN: 编号
           en-US: Index
       - field: descr
         type: 1
-        i18n:
-          zh-CN: 描述
-          en-US: Description
         label: true
-      - field: mtu
-        type: 0
         i18n:
-          zh-CN: 最大传输单元
-          en-US: MTU
-        unit: 'byte'
+          zh-CN: 接口名称
+          en-US: Interface Name
       - field: speed
         type: 0
+        unit: 'Mbps'
         i18n:
-          zh-CN: 速度
-          en-US: Speed
-        unit: 'KB/s'
+          zh-CN: 接口速率
+          en-US: Interface Speed
       - field: in_octets
         type: 0
+        unit: 'Kbps'
         i18n:
-          zh-CN: 输入字节数
+          zh-CN: 入流量
           en-US: In Octets
-        unit: 'byte'
+      - field: out_octets
+        type: 0
+        unit: 'Kbps'
+        i18n:
+          zh-CN: 出流量
+          en-US: Out Octets
+      - field: admin_status
+        type: 1
+        i18n:
+          zh-CN: 配置状态
+          en-US: Config Status
+      - field: oper_status
+        type: 1
+        i18n:
+          zh-CN: 当前状态
+          en-US: Current Status
+      - field: mtu
+        type: 0
+        i18n:
+          zh-CN: MTU
+          en-US: MTU
       - field: in_discards
         type: 0
         i18n:
-          zh-CN: 输入丢弃数
+          zh-CN: 入丢包数
           en-US: In Discards
-        unit: 'package'
       - field: in_errors
         type: 0
         i18n:
-          zh-CN: 输入错误数
+          zh-CN: 入错包数
           en-US: In Errors
-        unit: 'package'
-      - field: out_octets
-        type: 0
-        i18n:
-          zh-CN: 输出字节数
-          en-US: Out Octets
-        unit: 'byte'
       - field: out_discards
         type: 0
         i18n:
-          zh-CN: 输出丢弃数
+          zh-CN: 出丢包数
           en-US: Out Discards
-        unit: 'package'
       - field: out_errors
         type: 0
         i18n:
-          zh-CN: 输出错误数
+          zh-CN: 出错包数
           en-US: Out Errors
-        unit: 'package'
-      - field: admin_status
-        type: 1
-        i18n:
-          zh-CN: 管理状态
-          en-US: Admin Status
-      - field: oper_status
-        type: 1
-        i18n:
-          zh-CN: 运行状态
-          en-US: Oper Status
+    # (optional)metrics field alias name, it is used as an alias field to map and convert the collected data and metrics field
     aliasFields:
       - ifIndex
       - ifDescr
-      - ifMtu
       - ifSpeed
       - ifInOctets
+      - ifOutOctets
+      - ifAdminStatus
+      - ifOperStatus
+      - ifMtu
       - ifInDiscards
       - ifInErrors
-      - ifOutOctets
       - ifOutDiscards
       - ifOutErrors
-      - ifAdminStatus
-      - ifOperStatus
+    # mapping and conversion expressions, use these and aliasField above to calculate metrics value
+    # eg: cores=core1+core2, usage=usage, waitTime=allTime-runningTime
     calculates:
       - index=ifIndex
       - descr=ifDescr
+      - speed=ifSpeed / 1000 / 1000
+      - in_octets=ifInOctets / 1000
+      - out_octets=ifOutOctets / 1000
+      - admin_status=ifAdminStatus
+      - oper_status=ifOperStatus
       - mtu=ifMtu
-      - speed=ifSpeed / 1024
-      - in_octets=ifInOctets
       - in_discards=ifInDiscards
       - in_errors=ifInErrors
-      - out_octets=ifOutOctets
       - out_discards=ifOutDiscards
       - out_errors=ifOutErrors
-      - admin_status=ifAdminStatus
-      - oper_status=ifOperStatus
     protocol: snmp
     snmp:
       host: ^_^host^_^
       port: ^_^port^_^
+      username: ^_^username^_^
+      authPassphrase: ^_^authPassphrase^_^
+      privPassphrase: ^_^privPassphrase^_^
+      privPasswordEncryption: ^_^privPasswordEncryption^_^
+      authPasswordEncryption: ^_^authPasswordEncryption^_^
+      contextName: ^_^contextName^_^
       timeout: ^_^timeout^_^
       community: ^_^community^_^
-      version: ^_^version^_^
+      version: ^_^snmpVersion^_^
       operation: walk
       oids:
         ifIndex: 1.3.6.1.2.1.2.2.1.1
         ifDescr: 1.3.6.1.2.1.2.2.1.2
-        ifMtu: 1.3.6.1.2.1.2.2.1.4
         ifSpeed: 1.3.6.1.2.1.2.2.1.5
         ifInOctets: 1.3.6.1.2.1.2.2.1.10
+        ifOutOctets: 1.3.6.1.2.1.2.2.1.16
+        ifAdminStatus: 1.3.6.1.2.1.2.2.1.7
+        ifOperStatus: 1.3.6.1.2.1.2.2.1.8
+        ifMtu: 1.3.6.1.2.1.2.2.1.4
         ifInDiscards: 1.3.6.1.2.1.2.2.1.13
         ifInErrors: 1.3.6.1.2.1.2.2.1.14
-        ifOutOctets: 1.3.6.1.2.1.2.2.1.16
         ifOutDiscards: 1.3.6.1.2.1.2.2.1.19
         ifOutErrors: 1.3.6.1.2.1.2.2.1.20
-        ifAdminStatus: 1.3.6.1.2.1.2.2.1.7
-        ifOperStatus: 1.3.6.1.2.1.2.2.1.8
 
   - name: devices
     i18n:
@@ -647,7 +560,7 @@ metrics:
       - field: index
         type: 1
         i18n:
-          zh-CN: 序号
+          zh-CN: 编号
           en-US: Index
         label: true
       - field: descr