Skip to main content

Superhooks

Superhooks is a supervisor "event listener" that sends events from processes that run under supervisor to predefined web hooks. When superhooks receives an event, it sends a message notification to a configured URL.

superhooks uses requests full-featured Python http requests library.

Installation

pip install superhooks

Command-Line Syntax

$ superhooks  -u http://localhost:8090/ -e STARTING,RUNNING,BACKOFF,STOPPING,FATAL,EXITED,STOPPED,UNKNOWN -d "a^b^^c^d" -H "p^q^^r^s" 

Options

-u URL, --url=http://localhost:8090/

Post the payload to the url with http POST

-d DATA, --data=a^b^^c^d post body data as key value pair items are separated by ^^ and key and values are separated by ^

-H HEADERS, --headers=p^q^^r^s request headers with as key value pair items are separated by ^^ and key and values are separated by ^

-e EVENTS, --event=EVENTS

The Supervisor Process State event(s) to listen for. It can be any, one of, or all of STARTING, RUNNING, BACKOFF, STOPPING, EXITED, STOPPED, UNKNOWN.

Configuration

An [eventlistener:x] section must be placed in supervisord.conf in order for superhooks to do its work. See the “Events” chapter in the Supervisor manual for more information about event listeners.

The following example assume that superhooks is on your system PATH.

[eventlistener:superhooks]
command=python /usr/local/bin/superhooks -u http://localhost:8090/ -e BACKOFF,FATAL,EXITED,UNKNOWN -d "a^b^^c^d" -H "p^q^^r^s"
events=PROCESS_STATE,TICK_60

The above configuration will produce following payload for an crashing process named envoy

POST / HTTP/1.1
Host: localhost:8090
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 177
Content-Type: application/x-www-form-urlencoded
P: q
R: s
User-Agent: python-requests/2.12.1

from_state=RUNNING&a=b&c=d&event_name=PROCESS_STATE_EXITED&process_name=cat%3Ameow&pheaders_all=from_state%3ARUNNING+processname%3Ameow+pid%3A25232+expected%3A0+groupname%3Acat+

Notes

  • All the events will be buffered for 1 min and pushed to web hooks.

Development

  • Modify the changes.
  • Execute python setup.py publish

0.5 (2019-06-2)

  • Sending the complete supervisor data under the key name pheaders_all

0.4 (2019-05-11)

  • Switched from semicolon(;) to cap(^) as separator

0.2 (2019-05-11)

  • Fixed Readme

0.1 (2019-05-11)

  • Initial release

Release files for superhooks 0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for superhooks 0.6
File Interpreter ABI Platform
superhooks-0.6-py3-none-any.whl Python 3 none any Details

Release files / superhooks-0.6-py3-none-any.whl

Download URL superhooks-0.6-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
be076ffb7618f6ade888d9e63d0301dcb2557e7dd359facb48bebaa36a0cc80b
BLAKE2b-256 checksum
How to use checksums
32a60b0bdd92e61b6c3174595e9515f1ee245fd2ab5760cbd55df99e591ecdee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1

Release history Release notifications | RSS feed

This release

0.6 This release

1 release file

0.5

3 release files

0.4

3 release files

0.3

3 release files

0.2

2 release files

0.1

4 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page