Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remotely check on an app's status in pm2 from a website?

I'd like to check the status of an app registered with pm2 remotely such that other web-based monitoring services can give us a notification when something breaks.

Are there any options available to remotely check the status of a process in pm2 remotely? One possibility is to have a web script remotely eval() the pm2 status command and look for certain keywords, and make that script accessible on the web for the notification tool. This doesn't seem ideal, though, as we're using an eval command and maybe a regex of that output just to see what is going on.

Any advice?

like image 383
user49438 Avatar asked Dec 04 '25 07:12

user49438


2 Answers

I wrote a simple web interface for PM2. You can simply start a websocket connection to /logs and get your application(s) stats updates such as status, uptime, cpu usage, memory usage, restarts in realtime.Feel free to use and contribute. Cheers!

https://github.com/doorbash/pm2-web

pm2-web

like image 151
doorbash Avatar answered Dec 05 '25 21:12

doorbash


The best option is to use keymetrics. It's free to monitor upto 4 processes(great for development and side projects), easy to link an instance/server but quickly turns out to be very expensive when you scale up.

You could always try switching to other alternatives like upstart or pm2-gui.

like image 39
Joe Avatar answered Dec 05 '25 22:12

Joe