Coder Social home page Coder Social logo

supervisor-event-listener's Introduction

supervisor-event-listener

Supervisor事件通知, 支持邮件, Slack, WebHook

简介

Supervisor是*nix环境下的进程管理工具, 可以把前台进程转换为守护进程, 当进程异常退出时自动重启.
supervisor-event-listener监听进程异常退出事件, 并发送通知.

下载

v1.0

源码安装

  • go get -u github.com/ouqiang/supervisor-event-listener

Supervisor配置

[eventlistener:supervisor-event-listener]
; 默认读取配置文件/etc/supervisor-event-listener.ini
command=/path/to/supervisor-event-listener
; 指定配置文件路径
;command=/path/to/supervisor-event-listener -c /path/to/supervisor-event-listener.ini
events=PROCESS_STATE_EXITED
......

配置文件, 默认读取/etc/supervisor-event-listener.ini

[default]
# 通知类型 mail,slack,webhook 只能选择一种
notify_type = mail

# 邮件服务器配置
mail.server.user = [email protected]
mail.server.password = 123456
mail.server.host = smtp.163.com
mail.server.port = 25

# 邮件收件人配置, 多个收件人, 逗号分隔
mail.user = [email protected]

# Slack配置
slack.webhook_url = https://hooks.slack.com/services/xxxx/xxx/xxxx
slack.channel = exception

# WebHook通知URL配置 
webhook_url = http://my.webhook.com

通知内容

邮件、Slack

Host: ip(hostname)
Process: process-name
PID: 6152
EXITED FROM state: RUNNING

WebHook, Post请求, 字段含义查看Supervisor文档

{
  "Header": {
    "Ver": "3.0",
    "Server": "supervisor",
    "Serial": 11,
    "Pool": "supervisor-listener",
    "PoolSerial": 11,
    "EventName": "PROCESS_STATE_EXITED",
    "Len": 84
  },
  "Payload": {
    "Ip": "ip(hostname)",
    "ProcessName": "process-name",
    "GroupName": "group-name",
    "FromState": "RUNNING",
    "Expected": 0,
    "Pid": 6371
  }
}

supervisor-event-listener's People

Contributors

ouqiang avatar

Watchers

James Cloos avatar Liu Yongsong avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.