46 lines
1.5 KiB
PowerShell
46 lines
1.5 KiB
PowerShell
# 探测新系统智能体 8910 日志落点(只读,不改现网)
|
|
$ErrorActionPreference = 'Continue'
|
|
Write-Output '=== 8910 listen ==='
|
|
$c = Get-NetTCPConnection -LocalPort 8910 -State Listen -ErrorAction SilentlyContinue | Select-Object -First 1
|
|
if ($c) {
|
|
Write-Output ("LISTEN pid=" + $c.OwningProcess)
|
|
} else {
|
|
Write-Output '8910 not listening'
|
|
}
|
|
|
|
Write-Output '=== health ==='
|
|
try {
|
|
$h = Invoke-WebRequest -Uri 'http://127.0.0.1:8910/health' -UseBasicParsing -TimeoutSec 5
|
|
Write-Output $h.Content
|
|
} catch {
|
|
Write-Output ('health_fail: ' + $_.Exception.Message)
|
|
}
|
|
|
|
Write-Output '=== candidate log dirs ==='
|
|
$dirs = @(
|
|
'E:\wwwroot\logs',
|
|
'E:\wwwroot\agent\logs',
|
|
'E:\wwwroot\agent\current',
|
|
'C:\ytd-test\logs'
|
|
)
|
|
foreach ($d in $dirs) {
|
|
if (Test-Path $d) {
|
|
Write-Output ("DIR_OK " + $d)
|
|
Get-ChildItem $d -File -ErrorAction SilentlyContinue |
|
|
Where-Object { $_.Name -match 'agent|wecom|http|worker' } |
|
|
Sort-Object LastWriteTime -Descending |
|
|
Select-Object -First 20 |
|
|
ForEach-Object { Write-Output (" " + $_.FullName + " bytes=" + $_.Length + " mtime=" + $_.LastWriteTime.ToString('s')) }
|
|
} else {
|
|
Write-Output ("DIR_MISSING " + $d)
|
|
}
|
|
}
|
|
|
|
Write-Output '=== python cmdlines matching wwwroot/agent ==='
|
|
Get-CimInstance Win32_Process -Filter "Name='python.exe'" -ErrorAction SilentlyContinue | ForEach-Object {
|
|
$cl = $_.CommandLine
|
|
if ($null -ne $cl -and ($cl -match 'wwwroot|agent\.http_app|8910')) {
|
|
Write-Output ("pid=" + $_.ProcessId + " " + $cl)
|
|
}
|
|
}
|