junkman 遠端堆疊監控

hikki發表於2019-05-24

About JunkMan

JunkMan 通過xdebug跟蹤遠端服務 獲取php的gc日誌 通過junkmonitor客戶端可以實時監控線上執行狀況

JunkMan PHP xdebug
v1.0 >=7.0 >=2.1

1. build

composer require stream/junkman   

2. startup JunkManTransfer service

windows

start /B (YOUR_PATH)vendor/stream/junkman/src/JunkManTransfer.exe

linux

(YOUR_PATH)vendor/stream/junkman/src/JunkManTransfer &

tips: chmod -R 0777 (YOUR_PATH)vendor/stream/junkman/  

3. set your outpost

stream monitor (monitor code blocks)
JunkMan::stream()->start('stream watching');
#code
JunkMan::stream()->end();
flood monitor (for long time application process)
JunkMan::flood()->start('flood watching');

while(true){
  #code
  #if ... break
  #flush the message to monitor
  JunkMan::flood()->flush();
}

JunkMan::flood()->end();   
spot (monitor a variable)
$data = 'some message';
JunkMan::spot()->dot('spot watching',$data); 

4. Download JunkMonitor

JunkMonitor

tips: 
  the remote server should open firewall to enable port of 9303, 
  that you could connect the server by JunkMonitor

command:
  iptables -A INPUT -p tcp --dport 9303 -j ACCEPT
  iptables -A OUTPUT -p tcp --sport 9303 -j ACCEPT
  service iptables save
本作品採用《CC 協議》,轉載必須註明作者和本文連結

相關文章