在Debian系統中,Swagger(現稱為OpenAPI)的性能監控可以通過多種方法實現。以下是一些推薦的工具和步驟:
使用APIDetector進行API監控:
git clone https://github.com/brinhosa/apidetector.git
cd apidetector
pip install -r requirements.txt
# 掃描單域名
python apidetector.py -d example.com
# 掃描單文件多域名
python apidetector.py -i input_file.txt
# 指定輸出
python apidetector.py -i input_file.txt -o output_file.txt
# 使用特定數量的線程
python apidetector.py -i input_file.txt -t 20
# 使用HTTP和HTTPS協議掃描
python apidetector.py -m -d example.com
# 在安靜模式下運行腳本
python apidetector.py -q -d example.com
# 使用自定義用戶代理運行腳本
python apidetector.py -d example.com -ua "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36"
監控系統整體性能:
top 命令實時顯示系統中運行的進程信息,包括CPU占用率和內存占用率。htop 命令替代 top,提供更直觀的界面。vmstat 命令監控系統資源使用情況,包括虛擬內存、磁盤、CPU和進程活動。iostat 命令監控系統磁盤I/O。netstat 命令監控系統網絡連接。free 命令監控系統內存使用情況。df 命令監控系統磁盤空間使用情況。uptime 命令監控系統運行時間和平均負載。通過這些工具和步驟,你可以在Debian系統中有效地監控和管理Swagger的性能。