httpok is a supervisor “event listener” which may be subscribed to
When httpok receives a
TICK_60 is recommended, indicating activity every 60 seconds),
httpok makes an HTTP GET request to a confgured URL. If the request
fails or times out, httpok will restart the “hung” child
process(es). httpok can be configured to send an email notification
when it restarts a process.
httpok can only monitor the process status of processes which are supervisord child processes.
httpok is a “console script” installed when you install
superlance. Although httpok is an executable program, it
isn’t useful as a general-purpose script: it must be run as a
supervisor event listener to do anything useful.
$ httpok [-p processname] [-a] [-g] [-t timeout] [-c status_code] \ [-b inbody] [-m mail_address] [-s sendmail] URL
Restart the supervisord child process named
process_nameif it is in the
RUNNINGstate when the URL returns an unexpected result or times out.
This option can be provided more than once to have httpok monitor more than one process.
To monitor a process which is part of a supervisord group, specify its name as
Restart any child of supervisord in the
RUNNINGstate if the URL returns an unexpected result or times out.
-pparameters passed in the same httpok process invocation.
Use the specifed program to
gcorethe supervisord child process. The program should accept two arguments on the command line: a filename and a pid. Defaults to
If a core directory is specified, httpok will try to use the
-g) to write a core file into this directory for each hung process before restarting it. It will then append any gcore stdout output to the email message, if mail is configured (see the
The number of seconds that httpok should wait for a response to the HTTP request before timing out.
If this timeout is exceeded, httpok will attempt to restart child processes which are in the
RUNNINGstate, and specified by
Defaults to 10 seconds.
Specify the expected HTTP status code for the configured URL.
If this status code is not the status code provided by the response, httpok will attempt to restart child processes which are in the
RUNNINGstate, and specified by
Defaults to 200.
Specify a string which should be present in the body resulting from the GET request.
If this string is not present in the response, httpok will attempt to restart child processes which are in the RUNNING state, and specified by
The default is to ignore the body.
Specify the sendmail command to use to send email.
Must be a command which accepts header and message data on stdin and sends mail. Default is
/usr/sbin/sendmail -t -i.
Specify an email address to which notification messages are sent. If no email address is specified, email will not be sent.
Enable “eager” monitoring: check the URL and emit mail even if no monitored child process is in the
Enabled by default.
Disable “eager” monitoring: do not check the URL or emit mail if no monitored process is in the RUNNING state.
The URL to which to issue a GET request.
An optional name that identifies this httpok process. If given, the email subject will start with
httpok [<httpok name>]:instead of
httpok:In case you run multiple supervisors on a single host that control different processes with the same name (eg zopeinstance1) you can use this option to indicate which project the restarted instance belongs to.
Configuring httpok Into the Supervisor Config¶
[eventlistener:x] section must be placed in
in order for httpok to do its work.
See the “Events” chapter in the
Supervisor manual for more information about event listeners.
The following example assumes that httpok is on your system
[eventlistener:httpok] command=httpok -p program1 -p group1:program2 http://localhost:8080/tasty events=TICK_60