feat(extend-http-xmlpath): add system info metric and improve XML parsing
- Add new metric 'system_info' to collect device information
- Update 'status' metric to use more accurate XML path
- Introduce aliasFields and calculates sections for better data handling- Improve field naming consistency across languages
diff --git a/home/docs/advanced/extend-http-xmlpath.md b/home/docs/advanced/extend-http-xmlpath.md
index 64eb628..fd1692e 100644
--- a/home/docs/advanced/extend-http-xmlpath.md
+++ b/home/docs/advanced/extend-http-xmlpath.md
@@ -130,6 +130,51 @@
# collect metrics config list
metrics:
+ - name: system_info
+ i18n:
+ zh-CN: 系统信息
+ en-US: System Info
+ priority: 0
+ protocol: http
+ http:
+ host: ^_^host^_^
+ port: ^_^port^_^
+ ssl: ^_^ssl^_^
+ url: /ISAPI/System/deviceInfo
+ method: GET
+ timeout: ^_^timeout^_^
+ authorization:
+ type: Digest Auth
+ digestAuthUsername: ^_^username^_^
+ digestAuthPassword: ^_^password^_^
+ parseType: xmlPath
+ parseScript: //DeviceInfo
+ fields:
+ - field: deviceName
+ type: 1
+ i18n:
+ zh-CN: 设备名称
+ en-US: Device Name
+ - field: deviceID
+ type: 1
+ i18n:
+ zh-CN: 设备ID
+ en-US: Device ID
+ - field: firmwareVersion
+ type: 1
+ i18n:
+ zh-CN: 固件版本
+ en-US: Firmware Version
+ - field: model
+ type: 1
+ i18n:
+ zh-CN: 设备型号
+ en-US: Device Model
+ - field: macAddress
+ type: 1
+ i18n:
+ zh-CN: mac地址
+ en-US: Mac Address
- name: status
i18n:
zh-CN: 设备状态
@@ -148,115 +193,134 @@
digestAuthUsername: ^_^username^_^
digestAuthPassword: ^_^password^_^
parseType: xmlPath
- parseScript: 'DeviceStatus'
+ parseScript: //DeviceStatus
fields:
- - field: cpuUtilization
+ - field: CPU_utilization
i18n:
zh-CN: CPU 利用率
en-US: CPU Utilization
type: 0
unit: '%'
- locator: CPUList/CPU/cpuUtilization
- - field: memoryUsage
+ - field: memory_usage
i18n:
zh-CN: 内存使用量
en-US: Memory Usage
type: 0
unit: MB
- locator: MemoryList/Memory/memoryUsage
- - field: memoryAvailable
+ - field: memory_available
i18n:
zh-CN: 可用内存
en-US: Memory Available
type: 0
unit: MB
- locator: MemoryList/Memory/memoryAvailable
- - field: cacheSize
+ - field: cache_size
i18n:
zh-CN: 缓存大小
en-US: Cache Size
type: 0
unit: MB
- locator: MemoryList/Memory/cacheSize
- - field: netPort1Speed
+ - field: net_port_1_speed
i18n:
zh-CN: 网口1速度
en-US: Net Port 1 Speed
type: 0
unit: Mbps
- locator: NetPortStatusList/NetPortStatus[id='1']/workSpeed
- - field: netPort2Speed
+ - field: net_port_2_speed
i18n:
zh-CN: 网口2速度
en-US: Net Port 2 Speed
type: 0
unit: Mbps
- locator: NetPortStatusList/NetPortStatus[id='2']/workSpeed
- - field: bootTime
+ - field: boot_time
i18n:
zh-CN: 启动时间
en-US: Boot Time
type: 1
- locator: bootTime
- - field: deviceUpTime
+ - field: device_uptime
i18n:
zh-CN: 运行时长
en-US: Device Uptime
type: 1
- locator: deviceUpTime
- - field: lastCalibrationTime
+ - field: last_calibration_time
i18n:
zh-CN: 上次校时时间
en-US: Last Calibration Time
type: 1
- locator: lastCalibrationTime
- - field: lastCalibrationTimeDiff
+ - field: last_calibration_time_diff
i18n:
zh-CN: 上次校时时间差
en-US: Last Calibration Time Diff
type: 0
unit: s
- locator: lastCalibrationTimeDiff
- - field: avgUploadTime
+ - field: avg_upload_time
i18n:
zh-CN: 平均上传耗时
en-US: Avg Upload Time
type: 0
unit: ms
- locator: uploadTimeConsumingList/avgTime
- - field: maxUploadTime
+ - field: max_upload_time
i18n:
zh-CN: 最大上传耗时
en-US: Max Upload Time
type: 0
unit: ms
- locator: uploadTimeConsumingList/maxTime
- - field: minUploadTime
+ - field: min_upload_time
i18n:
zh-CN: 最小上传耗时
en-US: Min Upload Time
type: 0
unit: ms
- locator: uploadTimeConsumingList/minTime
- - field: lastCalibrationMode
+ - field: last_calibration_mode
i18n:
zh-CN: 上次校时模式
en-US: Last Calibration Mode
type: 1
- locator: lastCalibrationTimeMode
- - field: lastCalibrationAddress
+ - field: last_calibration_address
i18n:
zh-CN: 上次校时地址
en-US: Last Calibration Address
type: 1
- locator: lastCalibrationTimeAddress
- - field: responseTime
+ - field: response_time
i18n:
zh-CN: 响应时间
en-US: Response Time
type: 0
unit: ms
+ aliasFields:
+ - CPUList/CPU/cpuUtilization
+ - MemoryList/Memory/memoryUsage
+ - MemoryList/Memory/memoryAvailable
+ - MemoryList/Memory/cacheSize
+ - NetPortStatusList/NetPortStatus[id='1']/workSpeed
+ - NetPortStatusList/NetPortStatus[id='2']/workSpeed
+ - bootTime
+ - deviceUpTime
+ - lastCalibrationTime
+ - lastCalibrationTimeDiff
+ - uploadTimeConsumingList/avgTime
+ - uploadTimeConsumingList/maxTime
+ - uploadTimeConsumingList/minTime
+ - lastCalibrationTimeMode
+ - lastCalibrationTimeAddress
+ - responseTime
+ calculates:
+ - CPU_utilization=CPUList/CPU/cpuUtilization
+ - memory_usage=MemoryList/Memory/memoryUsage
+ - memory_available=MemoryList/Memory/memoryAvailable
+ - cache_size=MemoryList/Memory/cacheSize
+ - net_port_1_speed=NetPortStatusList/NetPortStatus[id='1']/workSpeed
+ - net_port_2_speed=NetPortStatusList/NetPortStatus[id='2']/workSpeed
+ - boot_time=bootTime
+ - device_uptime=deviceUpTime
+ - last_calibration_time=lastCalibrationTime
+ - last_calibration_time_diff=lastCalibrationTimeDiff
+ - avg_upload_time=uploadTimeConsumingList/avgTime
+ - max_upload_time=uploadTimeConsumingList/maxTime
+ - min_upload_time=uploadTimeConsumingList/minTime
+ - last_calibration_mode=lastCalibrationTimeMode
+ - last_calibration_address=lastCalibrationTimeAddress
+ - response_time=responseTime
units:
- - memoryUsage=KB->MB
- - memoryAvailable=KB->MB
- - cacheSize=KB->MB
+ - memory_usage=KB->MB
+ - memory_available=KB->MB
+ - cache_size=KB->MB
diff --git a/home/i18n/zh-cn/docusaurus-plugin-content-docs/current/advanced/extend-http-xmlpath.md b/home/i18n/zh-cn/docusaurus-plugin-content-docs/current/advanced/extend-http-xmlpath.md
index 78c656b..f66f612 100644
--- a/home/i18n/zh-cn/docusaurus-plugin-content-docs/current/advanced/extend-http-xmlpath.md
+++ b/home/i18n/zh-cn/docusaurus-plugin-content-docs/current/advanced/extend-http-xmlpath.md
@@ -130,6 +130,51 @@
# collect metrics config list
metrics:
+ - name: system_info
+ i18n:
+ zh-CN: 系统信息
+ en-US: System Info
+ priority: 0
+ protocol: http
+ http:
+ host: ^_^host^_^
+ port: ^_^port^_^
+ ssl: ^_^ssl^_^
+ url: /ISAPI/System/deviceInfo
+ method: GET
+ timeout: ^_^timeout^_^
+ authorization:
+ type: Digest Auth
+ digestAuthUsername: ^_^username^_^
+ digestAuthPassword: ^_^password^_^
+ parseType: xmlPath
+ parseScript: //DeviceInfo
+ fields:
+ - field: deviceName
+ type: 1
+ i18n:
+ zh-CN: 设备名称
+ en-US: Device Name
+ - field: deviceID
+ type: 1
+ i18n:
+ zh-CN: 设备ID
+ en-US: Device ID
+ - field: firmwareVersion
+ type: 1
+ i18n:
+ zh-CN: 固件版本
+ en-US: Firmware Version
+ - field: model
+ type: 1
+ i18n:
+ zh-CN: 设备型号
+ en-US: Device Model
+ - field: macAddress
+ type: 1
+ i18n:
+ zh-CN: mac地址
+ en-US: Mac Address
- name: status
i18n:
zh-CN: 设备状态
@@ -148,115 +193,134 @@
digestAuthUsername: ^_^username^_^
digestAuthPassword: ^_^password^_^
parseType: xmlPath
- parseScript: 'DeviceStatus'
+ parseScript: //DeviceStatus
fields:
- - field: cpuUtilization
+ - field: CPU_utilization
i18n:
zh-CN: CPU 利用率
en-US: CPU Utilization
type: 0
unit: '%'
- locator: CPUList/CPU/cpuUtilization
- - field: memoryUsage
+ - field: memory_usage
i18n:
zh-CN: 内存使用量
en-US: Memory Usage
type: 0
unit: MB
- locator: MemoryList/Memory/memoryUsage
- - field: memoryAvailable
+ - field: memory_available
i18n:
zh-CN: 可用内存
en-US: Memory Available
type: 0
unit: MB
- locator: MemoryList/Memory/memoryAvailable
- - field: cacheSize
+ - field: cache_size
i18n:
zh-CN: 缓存大小
en-US: Cache Size
type: 0
unit: MB
- locator: MemoryList/Memory/cacheSize
- - field: netPort1Speed
+ - field: net_port_1_speed
i18n:
zh-CN: 网口1速度
en-US: Net Port 1 Speed
type: 0
unit: Mbps
- locator: NetPortStatusList/NetPortStatus[id='1']/workSpeed
- - field: netPort2Speed
+ - field: net_port_2_speed
i18n:
zh-CN: 网口2速度
en-US: Net Port 2 Speed
type: 0
unit: Mbps
- locator: NetPortStatusList/NetPortStatus[id='2']/workSpeed
- - field: bootTime
+ - field: boot_time
i18n:
zh-CN: 启动时间
en-US: Boot Time
type: 1
- locator: bootTime
- - field: deviceUpTime
+ - field: device_uptime
i18n:
zh-CN: 运行时长
en-US: Device Uptime
type: 1
- locator: deviceUpTime
- - field: lastCalibrationTime
+ - field: last_calibration_time
i18n:
zh-CN: 上次校时时间
en-US: Last Calibration Time
type: 1
- locator: lastCalibrationTime
- - field: lastCalibrationTimeDiff
+ - field: last_calibration_time_diff
i18n:
zh-CN: 上次校时时间差
en-US: Last Calibration Time Diff
type: 0
unit: s
- locator: lastCalibrationTimeDiff
- - field: avgUploadTime
+ - field: avg_upload_time
i18n:
zh-CN: 平均上传耗时
en-US: Avg Upload Time
type: 0
unit: ms
- locator: uploadTimeConsumingList/avgTime
- - field: maxUploadTime
+ - field: max_upload_time
i18n:
zh-CN: 最大上传耗时
en-US: Max Upload Time
type: 0
unit: ms
- locator: uploadTimeConsumingList/maxTime
- - field: minUploadTime
+ - field: min_upload_time
i18n:
zh-CN: 最小上传耗时
en-US: Min Upload Time
type: 0
unit: ms
- locator: uploadTimeConsumingList/minTime
- - field: lastCalibrationMode
+ - field: last_calibration_mode
i18n:
zh-CN: 上次校时模式
en-US: Last Calibration Mode
type: 1
- locator: lastCalibrationTimeMode
- - field: lastCalibrationAddress
+ - field: last_calibration_address
i18n:
zh-CN: 上次校时地址
en-US: Last Calibration Address
type: 1
- locator: lastCalibrationTimeAddress
- - field: responseTime
+ - field: response_time
i18n:
zh-CN: 响应时间
en-US: Response Time
type: 0
unit: ms
+ aliasFields:
+ - CPUList/CPU/cpuUtilization
+ - MemoryList/Memory/memoryUsage
+ - MemoryList/Memory/memoryAvailable
+ - MemoryList/Memory/cacheSize
+ - NetPortStatusList/NetPortStatus[id='1']/workSpeed
+ - NetPortStatusList/NetPortStatus[id='2']/workSpeed
+ - bootTime
+ - deviceUpTime
+ - lastCalibrationTime
+ - lastCalibrationTimeDiff
+ - uploadTimeConsumingList/avgTime
+ - uploadTimeConsumingList/maxTime
+ - uploadTimeConsumingList/minTime
+ - lastCalibrationTimeMode
+ - lastCalibrationTimeAddress
+ - responseTime
+ calculates:
+ - CPU_utilization=CPUList/CPU/cpuUtilization
+ - memory_usage=MemoryList/Memory/memoryUsage
+ - memory_available=MemoryList/Memory/memoryAvailable
+ - cache_size=MemoryList/Memory/cacheSize
+ - net_port_1_speed=NetPortStatusList/NetPortStatus[id='1']/workSpeed
+ - net_port_2_speed=NetPortStatusList/NetPortStatus[id='2']/workSpeed
+ - boot_time=bootTime
+ - device_uptime=deviceUpTime
+ - last_calibration_time=lastCalibrationTime
+ - last_calibration_time_diff=lastCalibrationTimeDiff
+ - avg_upload_time=uploadTimeConsumingList/avgTime
+ - max_upload_time=uploadTimeConsumingList/maxTime
+ - min_upload_time=uploadTimeConsumingList/minTime
+ - last_calibration_mode=lastCalibrationTimeMode
+ - last_calibration_address=lastCalibrationTimeAddress
+ - response_time=responseTime
units:
- - memoryUsage=KB->MB
- - memoryAvailable=KB->MB
- - cacheSize=KB->MB
+ - memory_usage=KB->MB
+ - memory_available=KB->MB
+ - cache_size=KB->MB