pm2-web
A web based monitor for PM2.

Multiple hosts
With the release of 0.11 pm2 no longer uses TCP sockets for the event bus, instead using unix sockets. TCP sockets make monitoring hosts remotely possible so that functionality is currently broken.
Hopefully the pm2 team have a solution for this.
Prerequisites
For debugging to work, node-inspector must be installed and running on the same machine as pm2 (not necessarily the same as pm2-web).
To run
Install pm2-web:
Then run:
Configuration
All configuration options are documented in the default configuration file.
pm2-web will load one of the following files if they exist (in order of preference)
- A file specified by the
--config /path/to/config.jsonargument - From the current users' home directory:
~/.config/pm2-web/config.json - A global configuration file:
/etc/pm2-web/config.json
The default configuration file is always loaded and other config files will be applied to the default configuration.
The configuration file(s) loaded and the final configuration object will both be recorded in the logs.
Configuration files are loaded using cjson so comments are ok.
All options can be passed as command line arguments and will override any settings found in configuration files.
Authentication
To use HTTP basic auth, set www:authentication:enabled to true in your configuration file. See the default configuration file for more information.
N.b. Your password will be sent in plain text. If you enable HTTP auth, you should probably enable SSL as well.
SSL support
pm2-web can start a https server if so desired. To do so, set www:ssl:enabled to true in your configuration file and supply your certificate details. If you do not have a SSL certificate, the generate_certificate.sh script in the /certs directory will create a self-signed certificate for you.
Debugging running processes
To debug a running process, node-inspector must be installed and running on the same host as the process.
Specify the port it's running on as the inspector property of pm2:host. E.g.:
You should then see a debug icon appear next to the stop/restart/reload icons when the process is running.
Clicking this icon will send a SIGUSR1 signal to the process to put it into debug mode and open node-inspector in a new window.
N.b. you may need to change which source file you are looking at in node-inspector to see anything useful.
Debugging multiple processes
By default node will listen for debugger connections on port 5858. If you attempt to debug multiple processes you must specify different debug ports for them:
Debugging multiple instances
This is not possible because:
will start four separate processes all listening on port 7000.
If you are expecting to debug your process, please only start one of them.
Reload/restart processes
Restarting a process stops the current process and starts a new one, dropping connections in the process.
Reloading starts a new process in the background, killing the old process after the new one has initialised which reduces downtime.
N.b. your process must exit cleanly (e.g. close sockets, database connections) otherwise the old process will never be killed.
Hard vs soft reloading
Soft reloading (the default) will cause pm2 to send your process a shutdown message and kill it shortly afterwards. Hard reloading will kill it immediately.
To control this behaviour, specify the following in your config file:
To listen for the shutdown event, add the following to your program:
Resource usage graphs
You can tweak the resource usage graph to be more or less specific. The thinking here is that lots of processes with lots of process usage data will make your browser a bit crashey.
By default it will retain 1000 resource usage measurements of a process (CPU and memory) over a maximum of five days with 40% of the measurements taken in the last 24 hours, 25% from the day before, 10% each from the two days before that and 5% from the day before that.
The update frequency of the graph is controlled by --updateFrequency as detailed above.
The number of data points that will be plotted on the graph in total. If you've got a lot of processes, you may wish to set this to a lowish number to minimise memory consumption in your browser and the pm2-web process itself.
The number of --graph.distribution arguments is the number of days worth of data to graph (default 5) and the value is what percentage of --graph.datapoints should be plotted on a given day (the first --graph.distribution argument is today, the second is yesterday, etc).
What this means is that any recent resource usage data will have a more accurate representation in the graph at the cost of consuming more memory and older data will be less accurate but also less likely to crash your browser.
Logs
pm2-web will display log lines emitted by monitored processes after pm2-web itself was started. In order to keep resource usage reasonable by default it will show 1000 log lines.
You can alter this behaviour by specifying --logs:max, so for example to lower this to 500 lines:
Release notes
2.0.x
- Uses 2.x version of pm2-interface, even though it breaks monitoring multiple hosts
- Shows an error message when attempting to monitor an old/incompatible version of pm2
1.6.x
- Allow reloading of processes as well as restarting
- Debug button added to use node-inspector to debug running processes
- Batch UI updates together in an attempt to improve performance
- Supports http basic auth
- Supports serving over HTTPS
- Serve websockets and UI from a single port to make proxying easier
1.5.x
- Introduced external configuration file
1.4.x
- Swapped d3/xCharts for HighCharts due to a memory leak
1.3.x
- Display logs from processes emitted after pm2-web was started
- Caches logging output between browser refreshes
- Respects ANSI colour in logging output
1.2.x
- Must have been something interesting here
1.1.x
- Displays graphs of memory and cpu output
1.0.x
- Initial release
- Process listing
- Restarting, stopping & starting processes
Credits
Code by achingbrain, originally based on work done by dunxrion.
Uses pm2 and pm2-interface by unitech.
Special thanks to joewalnes for reconnecting-websocket and Luegg for angularjs-scroll-glue.
pm2-web的更多相关文章
- pm2使用
简单教程 首先需要安装pm2: npm install -g pm2 运行: pm2 start app.js 初次安装并运行,会有一个高大上的界面: 高大上的界面 直接我们介绍过forever,那么 ...
- Node.Js —— PM2介绍
pm2 是一个带有负载均衡功能的Node应用的进程管理器.当你要把你的独立代码利用全部的服务器上的所有CPU,并保证进程永远都活着,0秒的重载, PM2是完美的.它非常适合IaaS结构,但不要把它用于 ...
- nodejs高大上的部署方式-PM2
1.最常用的属nohup了,其实就是在后台执行进程,末尾加个& [zhoujie@ops-dev ~]$ nohup node /home/zhoujie/ops/app.js & ...
- Node之pm2
最近在项目中使用了Node,在程序部署的时候直接使用命令:node app.js ,这样我们的程序就可以host起来了,但是只要dos窗口关掉之后node就关闭了,这使得我们很不方便,于是乎发现了pm ...
- PM2的使用
PM2 是一个带有负载均衡功能的 Node 应用的进程管理器. 安装 npm install -g pm2 启动程序:pm2 start <app_name|id|all> 列举进程:pm ...
- 告别node-forever,拥抱PM2
告别node-forever,拥抱PM2 返回原文英文原文:Goodbye node-forever,hello PM2 devo.ps团队对JavaScript的迷恋已经不是什么秘密了;node.j ...
- PM2 管理nodejs项目
pm2 是一个带有负载均衡功能的Node应用的进程管理器. 当你要把你的独立代码利用全部的服务器上的所有CPU,并保证进程永远都活着,0秒的重载, PM2是完美的. 它非常适合IaaS结构,但不要把它 ...
- pm2安装及常用命令
安装:npm install -g pm2 启动程序:pm2 start <app_name|id|all> 列举进程:pm2 list 退出程序:pm2 stop <app_nam ...
- 使用pm2躺着实现负载均衡
事实上,pm2 是一个带有负载均衡功能的Node应用的进程管理器,Node实现进程管理的库有很多,forever也是其中一个很强大但是也相对较老的进程管理器. 为什么要使用pm2 对于这个问题,先说说 ...
- PM2使用心得
PM2是node进程管理工具,可以利用它来简化很多node应用管理的繁琐任务,如性能监控.自动重启.负载均衡等,而且使用非常简单. 安装 npm install -g pm2 常用命令 $ npm i ...
随机推荐
- mac 安装mongodb与常用操作
1.安装 brew update brew install mongodb 2.启动mongo mongod --config /usr/local/etc/mongod.conf 3.启动 mong ...
- 《自己动手写docker》之namespace部门实验
动手写一遍,印象不一样! package main import ( "log" "os" "os/exec" "syscall& ...
- 用递归法计算从n个人中选选k个人组成一个委员会的不同组合数
用递归法计算从n个人中选选k个人组成一个委员会的不同组合数. 分析 由n个人里选k个人的组合数= 由n-1个人里选k个人的组合数+由n-1个人里选k-1个人的组合数: 当n = k或k = 0时,组合 ...
- css特效-一道闪光在图片上划过
在百度音乐 http://music.baidu.com/ 看到这么一个图片效果,当鼠标移上去的时候,会有一道闪光在图片上划过,效果挺酷炫的.于是把这个效果再实现一下:大体思想是,设计一个透明层i,s ...
- 使用CSS更改图标的颜色
我们经常在很多网站上见到更改网站的主题时,图标的颜色也改变了,我们总是觉的这一项功能非常伟大,因为我们知道使用CSS是无法完成更改图片的颜色的.那么,网站上随心所欲的图标颜色是采用N多个图片不断的切换 ...
- AngularJS核心01:如何启动
启动 下面解释了AngularJS是如何运行下面Html的(用一张图和一个例子来解释): 浏览器载入HTML,然后把它解析成DOM. 浏览器载入angular.js脚本. AngularJS等到DOM ...
- SQL Server 执行计划分析
当一个查询到达数据库引擎时,SQL Server执行两个主要的步骤来产生期望的查询结果: 第一步:查询编译,生成查询计划. 第二步:执行这个查询计划. 1. 用于演示分析执行计划的查询语句 /* 查询 ...
- 七牛刷新接口PHP实现
<?php require_once '../autoload.php'; use Qiniu\Auth; use Qiniu\Http\Client; $accessKey = 'access ...
- 转:[译]CSV 注入:被人低估的巨大风险
转:https://yq.aliyun.com/articles/225847 原文地址:The Absurdly Underestimated Dangers of CSV Injection 原文 ...
- 《大话设计模式》--UML图
类图分三层: 第一层:类的名称,如果是抽象类,就用斜体显示 第二层:类的特性,通常是字段和属性 第三层:类的操作,通常是方法或行为 接口图:第一行是接口名称,第二行是接口方法 继承:用空心三角形+实线 ...