goalive

command module
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2022 License: MIT Imports: 8 Imported by: 0

README

Goalive

Go Report Card

Goalive is a simple tool to monitor health endpoints of your services using modern notification clients.

Functionality

Goalive allows to define a list of custom endpoints that should be polled periodically. These endpoints should be dedicated health endpoints that return a 2xx HTTP status code if the service is running fine. In case of problems, i.e. HTTP status codes != 2xx or connection issues, notifications can be send via Discord, Telegram, or Slack. To avoid messages en masse for a failing endpoint, notifications are only send for the first detected failure or if a previously failing endpoint has been fixed.

Alternatively, the most recent status can be requested manually.

  • For Discord, send !status to the channel with added bot
  • For Telegram, send /status to the bot
  • For Slack, send /health to the channel with the added bot

Setup

The setup consists of two steps:

  • Set up of a Discord or Telegram bot
  • Get Goalive and adjust the configuration to your needs
Setup of Discord, Telegram or Slack

To deliver notifications, you need to run your own bot or app.

Discord

For the configuration of Goalive with Discord, you need a bot token and a channel ID. The bot token is required to connect to your Bot. The channel ID determines the channel to deliver notifications to.

How to create a bot and receive a token is e.g. detailed here. To get the channel ID, simply right-click the channel of choice and copy the ID.

Telegram

For the configuration of Goalive with Telegram, your need a bot token and your User ID.

To set up a new bot and receive a bot token, simply send \newbot to BotFather. To retrieve your user ID, you can for example add the userinfobot in Telegram and start it. The bot will then reply with your user ID.

Slack

The current implementation of the Slack notification client relies on Socket Mode. It thus requires you to create your own Slack Application to retrieve both an app token and a bot token. First create an app (Slack API). In your app's settings under Basic Information you can create an App-Level Token which requires connections:write as scope. Additionally, you have to enable Socket Mode in the settings of the same name.

To retrieve a bot token, go to the OAuth & Permissions tab in the app settings. The required scopes are chat:write and commands.

Finally, install your app to any of your workspaces and add the created bot to a channel of your choice. You can copy the channel ID in the channel's details.

If you need more information on how to create a Slack app, checkout, for example, this official tutorial. For more information on the different token types, take a look here.

Get Goalive and Adjust the Configuration to Your Needs.
Download the Latest Release

You can download a pre-built executable for Windows (goalive.exe) or Linux (goalive) from the release page.

Build from Source

If you need an executable for a different platform, Goalive can be built from source with Go (version >= 1.16).

To create an executable, clone the repository and run go build within the cloned repository.

Create a Configuration

The repo contains an example configuration example-config.yaml. You at least have to add your bot token and channel ID (for Discord) / user ID (for Telegram) to the configuration. For Slack, you need an app token, a bot token and the channel ID.

Additionally, you can define the URLs you want to monitor, the polling interval in seconds, and the location of a log file.

After your configuration is ready, you can start the monitoring with ./goalive --config path/to/your/config.yaml on Linux-based systems or goalive.exe --config path/to/your/config.yaml on Windows.

References

The project relies on fantastic API wrappers for Discord, Slack and Telegram:

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package monitor implements functionality to poll endpoints and send notifications about the retrieved status.
Package monitor implements functionality to poll endpoints and send notifications about the retrieved status.
Package notification implements interfaces to notification clients like Discord.
Package notification implements interfaces to notification clients like Discord.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL