Skip to main content

superhooks plugin for supervisord

Project description

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-05-11)

  • 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

superhooks-0.5.tar.gz (5.4 kB view details)

Uploaded Source

Built Distributions

superhooks-0.5-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

superhooks-0.5-py2-none-any.whl (7.1 kB view details)

Uploaded Python 2

File details

Details for the file superhooks-0.5.tar.gz.

File metadata

  • Download URL: superhooks-0.5.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for superhooks-0.5.tar.gz
Algorithm Hash digest
SHA256 59e0f81cd4951dc43287896504505aae06d3c206335edf55b66c673c758df92f
MD5 cd6d19c690aa1f011aee1ac195c76e37
BLAKE2b-256 79019d163cfc25dc775d490cb4d46d08fcdf97754fefc2c091132a20eee938b3

See more details on using hashes here.

File details

Details for the file superhooks-0.5-py3-none-any.whl.

File metadata

  • Download URL: superhooks-0.5-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using 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/2.7.15rc1

File hashes

Hashes for superhooks-0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 6f9eedcc7ee9d44ff8cc4ec326874b31f733906aeb6d3d64cfccd82a7985f197
MD5 6a94fa79543ccb6255c18ff4499feed1
BLAKE2b-256 9310c463280954d1bedf576070e8384a457301cff680d3b5a92d44ef0503a90e

See more details on using hashes here.

File details

Details for the file superhooks-0.5-py2-none-any.whl.

File metadata

  • Download URL: superhooks-0.5-py2-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 2
  • Uploaded using 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/2.7.15rc1

File hashes

Hashes for superhooks-0.5-py2-none-any.whl
Algorithm Hash digest
SHA256 7c5f9233e18489315cf5aa3983d8e288edee67a01f7608955ceb73092e963b33
MD5 f57252acb7500f6811eb66d850d22548
BLAKE2b-256 0e06a5f3dfc4d8c9c609642ef996f14b1c0496fa418792eae30e86bc8ad3accc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page