apache / apache/hertzbeat

[BUG] 使用windows命令监控采集问题

Open
#3,907 5 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
7.4k
Forks
1.3k
Avg merge
1d 20h
Merged PRs (30d)
32

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Current Behavior

1.windows2008服务器,只要是powershell命令都取不到数据
2、自己添加的powersehll命令在服务器中执行没问题,但是添加导监控模板中取不到数据。
这是日志:2025-12-12 12:25:47.525 [583356124740608-windows_script-oggps-7208] INFO org.apache.hertzbeat.collector.dispatch.MetricsCollect Line:471 - [Collect Failed, Run 317ms, All 317ms] Reason: Script response data is null
命令:Write-Host "Program Status Group Lag Time";$t=[System.IO.Path]::GetTempFileName();"info all`nexit"|Out-File -FilePath $t -Encoding ASCII;& ^_^Path^_^\ggsci paramfile $t 2>&1|?{$_-match"^\s*(MANAGER|EXTRACT|REPLICAT)"-and$_-match"^\s*(?

\S+)\s+(?\S+)\s+(?\S+)?\s+(?[\d:]+)?\s+(?[\d:]+)?"}|%{$l=if($matches['l']){$matches['l']-replace":",""-replace"^0+",""}else{"N/A"};$tm=if($matches['tm']){$matches['tm']-replace":",""-replace"^0+",""}else{"N/A"};if($l-eq""){$l="0"};if($tm-eq""){$tm="0"};Write-Host ($matches['p'].PadRight(10)+$matches['s'].PadRight(10)+$(if($matches['g']){$matches['g']}else{"N/A"}).PadRight(10)+$l.PadRight(8)+$tm)};Remove-Item $t -Force
这是命令执行结果
![Image](https://github.com/user-attachments/assets/6ce8b39a-394c-4ee6-b662-ef2a004d9bef)

### Expected Behavior

_No response_

### Steps To Reproduce

_No response_

### Environment

```markdown
HertzBeat version(s):
```

### Debug logs

_No response_

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Research direction

Start at org.apache.hertzbeat.collector.dispatch.MetricsCollect around line 471 and trace the windows_script collection path. Reproduce the reported PowerShell command on Windows Server 2008 and compare its successful shell output with the collector log showing “Script response data is null.” Done means PowerShell commands added to a monitoring template return their collected data.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, powershell
Domain
backend, observability-sre
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.