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.
pip install superhooks
$ superhooks -u http:https://localhost:8090/ -e STARTING,RUNNING,BACKOFF,STOPPING,FATAL,EXITED,STOPPED,UNKNOWN -d "a^b^^c^d" -H "p^q^^r^s"
-u URL, --url=http:https://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.
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:https://localhost:8090/ -e BACKOFF,FATAL,EXITED,UNKNOWN -d "a^b^^c^d" -H "p^q^^r^s"
events=PROCESS_STATE,TICK_60
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+
- All the events will be buffered for 1 min and pushed to web hooks.
- Modify the changes.
- Execute
python setup.py publish