20182018. 11. 7. 13:48

네트워크 문제로 간헐적인 원격지의 DB 연결 실패가 의심될 때, 클라이언트에서 PsPing 툴을 이용하여 TCP Ping 테스트 결과를 로그로 남길 수 있습니다. TCP 특정 포트 연결 성공 여부와 지연을 체크해 볼 수 있겠습니다.

우선 탐색기에서 Psping.exe 를 실행하여 Sysinternals Software License Terms 을 체크합니다.

이후 아래 파워쉘 명령을 통해 1초 단위의 PsPing 결과를 PsPing_log.txt 에 기록합니다. 간격, 대상 IP, 포트, 파일명을 명시해 주시면 됩니다.

PS F:\PSTools> .\psping -t -i 1 192.168.1.10:1433 | foreach{"{0} - {1}" -f (Get-Date),$_} | Tee-object -FilePath PsPing_log.txt


기록된 로그를 살펴 봅니다.

11/7/2018 1:37:37 PM -
11/7/2018 1:37:37 PM - PsPing v2.10 - PsPing - ping, latency, bandwidth measurement utility
11/7/2018 1:37:37 PM - Copyright (C) 2012-2016 Mark Russinovich
11/7/2018 1:37:37 PM - Sysinternals - www.sysinternals.com
11/7/2018 1:37:37 PM -
11/7/2018 1:37:37 PM - TCP connect to 192.168.1.10:1433:
11/7/2018 1:37:37 PM - Infinite iterations (warmup 1) ping test:
11/7/2018 1:37:37 PM - Connecting to 192.168.1.10:1433 (warmup): from 10.10.10.22:62275: 2.75ms
11/7/2018 1:37:38 PM - Connecting to 192.168.1.10:1433: from 10.10.10.22:62276: 2.50ms
11/7/2018 1:37:39 PM - Connecting to 192.168.1.10:1433: from 10.10.10.22:62277: 10.59ms
11/7/2018 1:37:40 PM - Connecting to 192.168.1.10:1433: from 10.10.10.22:62280: 2.28ms
11/7/2018 1:37:41 PM - Connecting to 192.168.1.10:1433: from 10.10.10.22:62281: 2.77ms
11/7/2018 1:37:42 PM - Connecting to 192.168.1.10:1433: from 10.10.10.22:62282: 2.88ms
11/7/2018 1:37:43 PM - Connecting to 192.168.1.10:1433: from 10.10.10.22:62283: 2.54ms
~ (중략)
11/7/2018 1:38:02 PM - Connecting to 192.168.1.10:1433: from 10.10.10.22:62306: 2.07ms
11/7/2018 1:38:03 PM - Connecting to 192.168.1.10:1433: from 10.10.10.22:62307: 1.91ms
11/7/2018 1:38:04 PM - Connecting to 192.168.1.10:1433: from 10.10.10.22:62308: 3.38ms

// SQL Server 서비스를 중지했던 시점
11/7/2018 1:38:10 PM - Connecting to 192.168.1.10:1433: from 0.0.0.0:62309:
11/7/2018 1:38:15 PM - Connecting to 192.168.1.10:1433: from 0.0.0.0:62312:
11/7/2018 1:38:20 PM - Connecting to 192.168.1.10:1433: from 0.0.0.0:62316:
11/7/2018 1:38:25 PM - Connecting to 192.168.1.10:1433: from 0.0.0.0:62317:
11/7/2018 1:38:30 PM - Connecting to 192.168.1.10:1433: from 0.0.0.0:62318:

// SQL Server 서비스가 다시 시작된 시점
11/7/2018 1:38:33 PM - Connecting to 192.168.1.10:1433: from 10.10.10.22:62319: 3003.71ms
11/7/2018 1:38:33 PM - Connecting to 192.168.1.10:1433: from 10.10.10.22:62320: 2.46ms
11/7/2018 1:38:34 PM - Connecting to 192.168.1.10:1433: from 10.10.10.22:62321: 2.80ms
11/7/2018 1:38:35 PM - Connecting to 192.168.1.10:1433: from 10.10.10.22:62324: 2.57ms
11/7/2018 1:38:36 PM - Connecting to 192.168.1.10:1433: from 10.10.10.22:62325: 2.77ms
11/7/2018 1:38:37 PM - Connecting to 192.168.1.10:1433: from 10.10.10.22:62326: 3.18ms
11/7/2018 1:38:38 PM - Connecting to 192.168.1.10:1433: from 10.10.10.22:62327: 2.34ms
11/7/2018 1:38:39 PM - Connecting to 192.168.1.10:1433: from 10.10.10.22:62328: 2.90ms


[참고자료]
PsPing
https://docs.microsoft.com/en-us/sysinternals/downloads/psping


작성자: Lai Go / 작성일자: 2018.11.07

Posted by Lai Go