在CentOS上监控Node.js项目的性能可以通过多种工具和方法实现。以下是一些常用的方法和工具:
sudo npm install -g pm2@latest
pm2 start app.js --name myapi
pm2 list
pm2 monit
pm2 logs myapi
pm2 startup
和 pm2 save
wget https://github.com/prometheus/prometheus/releases/download/v2.35.0/prometheus-2.35.0.linux-amd64.tar.gztar xvfz prometheus-2.35.0.linux-amd64.tar.gz
./prometheus --config.file prometheus.yml
wget https://dl.grafana.com/oss/release/grafana-8.2.0.linux-amd64.tar.gztar -zxvf grafana-8.2.0.linux-amd64.tar.gz
./bin/grafana-server
process
模块来获取进程信息,如CPU使用率和内存使用情况。express-status-monitor
来提供实时的服务器性能指标和健康检查。sudo yum install htop
vmstat 3
iostat -x /dev/hdb6
free -m
sar -u 1 3
APM(Application Performance Management)工具可以帮助监控Node.js应用程序的性能,包括CPU使用率、内存使用量、垃圾收集、事件循环和面向用户的延迟等。
通过上述方法,可以有效地监控CentOS上的Node.js应用的性能和健康状况。选择合适的工具和方法取决于具体的监控需求和场景。