Process monitoring and service manager for Python web application

5,066

I vote for Monit, and there are plenty of good configuration examples for it.

Don't think of Monit as "more than you need". It does exactly what it says in a lightweight and reliable manner. The daemon is stable and doesn't need babysitting. It will run all of the process, PID, name, connection and file tests you need. The restart and action behavior can be customized. And there's a nice minimal GUI/TUI for process management.

Share:
5,066

Related videos on Youtube

Ben Hoyt
Author by

Ben Hoyt

I’m a software engineer at Canonical. I’m married to the only Franci Hoyt in the world, and we have three lovely daughters. See my personal website benhoyt.com for more info.

Updated on September 18, 2022

Comments

  • Ben Hoyt
    Ben Hoyt over 1 year

    We're setting up a Python web application using the CherryPy web server on a bunch of Linux servers (it's behind an nginx load balancer sending traffic to the various servers). We're in the process of switching from Windows servers to Linux servers, and we'll be running on CentOS 6.5.

    On Windows we had a custom service manager that started and stopped the Python executables, and restarted them if they crashed hard or exited for whatever reason.

    My question is: what's a good tool to do the same thing on Linux? Ideally it would:

    1. Be able to manually start and stop a Python program (our CherryPy-based server and app) using something like service our_app start or /etc/init.d/our_app start.
    2. Automatically restart the program if it exits or crashes
    3. Start the service on system startup

    So far I've come up with various possibilities, kind of in order from simplest to more complex:

    • python-daemon with an /etc/init.d script
    • upstart with a simple upstart script like these: one, two, three
    • supervisor: looks interesting, but how would this be better for us than just using upstart?
    • monit: more than we need at this stage, but perhaps could use this on top of one of the above?

    Note: I'm a developer who's had more experience with Windows than Linux, and more development experience than ops/sysadmin experience. Just sayin'. :-)

    • user9517
      user9517 almost 10 years
      I wouldn't bother with upstart it's not going to be about much longer. EL7 will be using systemd and even Ubuntu is dropping it.