Superlance is a plugin written in Python and it has a multiple Event Handlers that can trigger SMS or Email notifications or even call an http endpoint to setup a hartbeat signal.
Even though the setup process is very easy, there are a few things that need to be in place for Superlance to function. We'll also tell you how to setup the latest Supervisor and a service (assuming you're running a Linux distribution with systemd), though you can skip this step if you already have an instance of Supervisor running.
Install latest Supervisor & Superlance using pip
Skip this step if your supervisor is already running, though check your
supervisord.conf to make sure supervisor's HTTP server is working.
Instead of installing the Supervisor shipped with your distribution, using
apt-get install supervisor for example, we'll get the latest version using
To get supervisor running, we'll need a minimal configuration. Especially the
[supervisorctl] sections are needed to make Superlance able to talk to Supervisor. Put in the contents below into your
Supervisor Daemon: Systemd supervisord service
You can skip this step if you've installed supervisor trough your package-manager (the supervisord service will already exist). Otherwise, we'll manually have to make a service file, to allow supervisor run as a daemon or background process. Put the following contents in your
And then enable the service and start supervisor, to see if you did right:
Credits go to CloudWaferHQ for providing the outline for the systemd-file, though we've renamed the service to supervisor for it to be consistent with standard installation (trough package managers). The aliases are there to ensure both
supervisord can be used as service name.
Assuming you've already Supervisor and Superlance (see the Install steps above), we'll give an example how to set up an listener to receive an email when a process exists.
To set up other triggers, the configuration steps are the same, though the trigger and command you call will change.
Crashmail event listener:
Even though Superlance documentation states the event-listener should be added to
supervisord.conf , we like it in a separate file.
Put the contents below into your
A few notes on the
-moption defines the target mailaddress, it must be set for crashmail to work.
We've set it to
rootand use an alias in
/etc/aliasesto set the actual final address. You can use your own mailaddress here as well.
- The events option has been set to PROCESS_STATE_EXITED, to only receive a message if a process exists.
Use PROCESS_STATE to receive a message on every state change a process makes, or have a look at other Event Types to set as your trigger.
Separate multiple events with a comma, e.g.:
- The filename
00ensures the event listener is loaded before other processes are.
Optionally you could add
priority=1instead, though we haven't tested this.
Or just put the lines in your
supervisord.conf, might there be issues.
When you're done, simply restart supervisor to apply your changes:
Errors, debugging and troubleshooting Superlance
First and foremost, it's important to understand the chain for an email to be sent: Supervisor → Superlance → Crashmail → Sendmail.
For debugging it's good to follow the chain as it should work, to make sure every chain link works properly.
For all errors on Linux, the troubleshooting is often a matter of reading logs and output messages until you understand where it goes wrong. Mostly…
Use the following commands to get some insights:
Test outgoing mail
Even though the
/var/log/mail.… -examples from abouve should show if an email is sent, sometimes it's easier to just manually invoke sending an email:
Test event trigger: Manually kill process
To see if the event gets triggered at all, you can manually kill the process manually. This should trigger the event listener.