在Debian系统上监控Swagger API的性能,可以采用多种工具和方法。以下是一个综合的方案,结合了性能监控工具和Swagger UI的使用。
git clone https://github.com/brinhosa/apidetector.git
cd apidetector
pip install -r requirements.txt
python apidetector.py -d example.com
可以指定输出文件、使用特定数量的线程、指定HTTP和HTTPS协议等。flatpak install flathub io.missioncenter.MissionCenter
sudo apt updatesudo apt install -y nodejs npm
sudo npm install -g @nestjs/cli
nest new my-project
cd my-project
npm install @nestjs/swagger swagger-ui-express
src/main.ts
中配置Swagger:import { NestFactory } from '@nestjs/core';
import { ExpressAdapter } from '@nestjs/platform-express';
import { AppModule } from './app.module';
import * as express from 'express';
import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';
async function bootstrap() {
const app = await NestFactory.create(AppModule, new ExpressAdapter());
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
const options = new DocumentBuilder()
.setTitle('My Project')
.setDescription('The My Project API description')
.setVersion('1.0')
.addTag('test')
.build();
const document = SwaggerModule.createDocument(app, options);
SwaggerModule.setup('api-doc', app, document);
await app.listen(3000);
}
bootstrap();
npm run start:dev
通过http://localhost:3000/api-doc/#/
访问Swagger UI。top
和htop
命令监控进程状态和资源使用情况。vmstat
、iostat
和netstat
命令监控系统资源使用情况。free
和df
命令监控系统内存和磁盘空间使用情况。uptime
命令监控系统运行时间和平均负载。通过以上步骤和工具,你可以在Debian系统上有效地监控和管理Swagger API的性能。