Easy, but production-ready process monitor in Linux/Unix

8

2

I am looking for a simple process monitor for my account in a popular VPS. I loved Supervisor and Monit, but they seem overkill for me.

I want something

  1. that runs as a daemon (So my VPS account can start it on boot and also "start" by cron in case the monitor itself goes down)
  2. that monitors by spawning stuff as subprocess (like Supervisor) or by doing a polling command that returns true or false (like a BASH if statement)
  3. both easy to use (need minimal configuration) and production stable (somehow few software seems to satisfy both demands)
  4. Suitable in a managed VPS- run in user mode, minimum memory usage

Jesvin Jose

Posted 2011-08-10T07:58:09.423

Reputation: 371

Question was closed 2013-04-16T16:10:54.610

Answers

2

You're looking for the program daemontools. (If this is what you meant by the "Supervisor" monitor, then feel free to ignore the rest of my answer.)

daemontools is a collection of tools for managing UNIX services.

supervise monitors a service. It starts the service and restarts the service if it dies. Setting up a new service is easy: all supervise needs is a directory with a run script that runs the service.

multilog saves error messages to one or more logs. It optionally timestamps each line and, for each log, includes or excludes lines matching specified patterns. It automatically rotates logs to limit the amount of disk space used. If the disk fills up, it pauses and tries again, without losing any data.

It's simple, flexible, and very powerful. The basic idea is that for each service you want to run, daemontools launches a child process (called supervise) that then launches your service. supervise configures the service's environment variables and uid/gid, and then keeps the service's standard in and standard out open so it can send signals. The service does not need to daemonize itself, and you don't have to manage pid files. The main service doesn't require root to run, and you can put the directories of monitored services anywhere.

Handyman5

Posted 2011-08-10T07:58:09.423

Reputation: 258

runit would be an alternative to daemontools. It's also very simple and low-level. Basically all you need for running a proces is a file containing some exec command, e.g. exec sleep 300 Then you create a symlink from directory containing run script to /etc/service/name and your're done. – Tombart – 2013-12-01T11:35:06.660

1

The simple answer is you already have one - Every Unix system does - init and /etc/inittab.

The job of init is to spawn the processes listed in inittab, monitor them and restart them if they exit.

Haqa

Posted 2011-08-10T07:58:09.423

Reputation: 549

-1

lhagemann

Posted 2011-08-10T07:58:09.423

Reputation: 286

2OP mentioned that he already looked at Monit. – Karlson – 2012-01-07T05:11:33.770

ah, damn. Reading is fundamental. – lhagemann – 2012-01-07T14:34:39.347