48 lines
2.1 KiB
PowerShell
48 lines
2.1 KiB
PowerShell
# 诊断 Redis 池;不打印密码明文
|
|
$ErrorActionPreference = 'Continue'
|
|
$java = Get-CimInstance Win32_Process -Filter "Name='java.exe'" | Where-Object { $_.CommandLine -like '*inquiry-new*' } | Select-Object -First 1
|
|
if (-not $java) { Write-Host 'no_ledger_java'; exit 1 }
|
|
Write-Host ("pid=" + $java.ProcessId)
|
|
|
|
foreach ($line in (Get-Content 'E:\wwwroot\.env')) {
|
|
$t = $line.Trim()
|
|
if (-not $t -or $t.StartsWith('#')) { continue }
|
|
$i = $t.IndexOf('=')
|
|
if ($i -lt 1) { continue }
|
|
$k = $t.Substring(0, $i).Trim()
|
|
$v = $t.Substring($i + 1).Trim().Trim('"')
|
|
if ($k -match 'REDIS|YTD_REDIS') {
|
|
$pref = if ($v.Length -ge 12) { $v.Substring(0,12) + '...' } else { '***' }
|
|
Write-Host ("envfile $k len=$($v.Length) prefix=$pref")
|
|
}
|
|
}
|
|
|
|
$logDir = 'E:\wwwroot\inquiry-new\logs'
|
|
Get-ChildItem $logDir -Filter '*.log' -ErrorAction SilentlyContinue | Sort-Object LastWriteTime -Descending | Select-Object -First 2 | ForEach-Object {
|
|
Write-Host ("log=$($_.Name) size=$($_.Length)")
|
|
Select-String -Path $_.FullName -Pattern 'Could not get a resource from the pool|JedisConnectionException|NOAUTH|WRONGPASS' | Select-Object -Last 6 | ForEach-Object {
|
|
$s = $_.Line
|
|
if ($s.Length -gt 200) { $s = $s.Substring(0,200) }
|
|
Write-Host (" $s")
|
|
}
|
|
}
|
|
|
|
$login = Invoke-RestMethod -Uri 'http://127.0.0.1:8180/jeecgboot/sys/login' -Method POST -Body '{"username":"admin","password":"123456","captcha":"","checkKey":""}' -ContentType 'application/json;charset=UTF-8'
|
|
$h = @{ 'X-Access-Token' = $login.result.token }
|
|
foreach ($u in @(
|
|
'http://127.0.0.1:8180/jeecgboot/sys/permission/getPermCode',
|
|
'http://127.0.0.1:8180/jeecgboot/inquiry/quoteTemplate/agent/listEnabled',
|
|
'http://127.0.0.1:8180/jeecgboot/sys/user/list?pageNo=1&pageSize=1'
|
|
)) {
|
|
try {
|
|
$r = Invoke-WebRequest -Uri $u -Headers $h -UseBasicParsing -TimeoutSec 15
|
|
$j = $r.Content | ConvertFrom-Json
|
|
$msg = [string]$j.message
|
|
if ($msg.Length -gt 60) { $msg = $msg.Substring(0,60) }
|
|
Write-Host ("API $($u.Split('?')[0].Split('/')[-1]) success=$($j.success) code=$($j.code) msg=$msg")
|
|
} catch {
|
|
Write-Host ("API fail $u $($_.Exception.Message)")
|
|
}
|
|
}
|
|
Write-Host 'REDIS_DIAG_DONE'
|