Skip to content

luizalabs/rey

Repository files navigation

REY

rey

A simple health checker.

How it works?

Rey will read a json based file with a list of components (applications) to perform health checks. On any status change, rey will expose a gauge metric to prometheus.

How to run?

All rey configurations are read by environment variables (except for components list, this configuration is read by a json based file on file system)

Environment Variables

Env Description Default
REY_CHECKER_TIMEOUT http request timeout (in second) 5
REY_CHECKER_MAX_RETRY max retry to perform http request on check a component 3
REY_RUNNER_CIRCLE_INTERVAL checker interval (in second) 10
REY_COMPONENTS_PATH path of components list json based file /etc/rey/components.json
REY_METRICS_SERVER_PORT Port to listen on Prometheus metrics server 5000
REY_NOTIFIER_TOKEN Slack token to perform the notification
REY_NOTIFIER_USERNAME Slack bot username Doc. Rey
REY_NOTIFIER_AVATAR Slack bot avatar https://bit.ly/2Sbf65n
REY_NOTIFIER_CHANNEL Slack channel to send notification

Deploying in a Kubernetes Cluster

We strongly recommend you to put all rey stuff in a new kubernetes namespace

$ kubectl create ns rey

For the component list you can create a simple json file with a list of components following those fields

]
    {
        "name": "<component name>",
        "hc_endpoint": "<component healthcheck url>",
    }
]

And create a kubernetes configmap

$ kubectl create configmap rey-components --from-file=./components.json -n rey

We'll use that configmap to mount a volume with componets file on rey container

Finally you can use the rey-app.yaml template to create a kubernetes deploy and a kubernetes ClusterIP service (to expose prometheus metrics)

$ kubectl create -f rey-app.yaml -n rey

Metrics

When you deploy rey on your Kubernetes cluster rey will expose simple metrics to Prometheus with components health status (same as HTTP status of each request and 500 for request errors [e.g. timeouts]). With these metrics you can create a Grafana dashboard, just use queries like: rey{componente_name="<name of the component>"}.