Skip to content

Events & Event handlers

adamkobor edited this page Aug 18, 2020 · 12 revisions

Kuvasz is built around events and their handlers. Every check that Kuvasz makes, emits an event, and the handlers who are subscribed to them handle these events in different ways.

Events

MonitorUpEvent

Has been emitted when a website passes the uptime check, i.e. it's live and "healthy". It also contains the latency of the response.

MonitorDownEvent

Has been emitted when a website is unreachable, an it contains the cause of the error.

RedirectEvent

Kuvasz is following redirects through HTTP calls, so when a call is forwarded to an other address, a RedirectEvent will be emitted. It contains the new location from the Location header of the original response.

Event handlers

LogEventHandler

Handled events:

  • MonitorUpEvent
  • MonitorDownEvent
  • RedirectEvent

This handler writes a simple log message to STDOUT and can be switched off through the ENABLE_LOG_EVENT_HANDLER environment variable.

Examples:

  • Your monitor "test_up" (https://test.com) is UP (200). Latency was: 1826ms.
  • Your monitor "test_down" (https://test2.com) is DOWN. Reason: Connect Error: Connection refused: test2.com
  • Request to "test_redirected" (https://redirected.com) has been redirected

SMTPEventHandler

Handled events:

  • MonitorUpEvent
  • MonitorDownEvent

This handler sends email messages about the state of your monitors, and can be set up through environment variables. Same events would be suppressed, which means that two or more consecutive UP or DOWN events wouldn't result in more than one email notification.

SlackEventHandler

Handled events:

  • MonitorUpEvent
  • MonitorDownEvent

This handler sends notifications through an incoming webhook to Slack about the state of your monitors, and can be set up through environment variables. Same events would be suppressed, which means that two or more consecutive UP or DOWN events wouldn't result in more than one notification.

Clone this wiki locally