项目作者: jindrichskupa

项目描述 :
Simple supervisord statuspage for healthcheck
高级语言: Go
项目地址: git://github.com/jindrichskupa/supervisord-statuspage.git
创建时间: 2020-01-25T14:58:22Z
项目社区:https://github.com/jindrichskupa/supervisord-statuspage

开源协议:MIT License

下载


Supervisord status page

Simple supervisord statuspage for healthcheck. Just call simple /healtz via HTTP and get 200 or 500 and process list.

Usage

Supervisord configuration

  1. [supervisord]
  2. nodaemon=true
  3. ; turn on XML-RPC interface
  4. [rpcinterface:supervisor]
  5. supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
  6. ; listen on localhost 9001
  7. [inet_http_server] ; inet (TCP) server disabled by default
  8. port=127.0.0.1:9001
  9. [program:backend]
  10. command=/bin/bash -lc "/usr/local/bin/svd-statuspage"
  11. autorestart=true

Config variables

  • RPC_URL - supervisord RPC endpoint, default http://127.0.0.1:9001/RPC2
  • LISTEN_IP - listen IP, default 0.0.0.0
  • LISTEN_PORT - listen port, default 8080

Build & run

  1. make
  2. make run
  3. ./svd-statuspage
  4. LISTEN_PORT=9090 LISTEN_IP=127.0.0.1 ./svd-statuspage

Get status

  1. curl -v localhost:8080/healtz | jq .

Output ERROR

Return 500 Internal Server Error

  1. {
  2. "status": "ERROR",
  3. "processes": [
  4. {
  5. "name": "backend",
  6. "status": "FATAL",
  7. "description": "Exited too quickly (process log may have details)",
  8. "pid": "0"
  9. }
  10. ]
  11. }

Output OK

Return 200 OK

  1. {
  2. "status": "OK",
  3. "processes": [
  4. {
  5. "name": "backend",
  6. "status": "RUNNING",
  7. "description": "pid 78855, uptime 0:00:05",
  8. "pid": "78855"
  9. }
  10. ]
  11. }