service-monitor-tgbot

module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2023 License: Apache-2.0

README

Contributors Forks Stargazers Issues MIT License


Logo

Service Monitor Telegram Bot

Telegram bot for monitoring the availability of network services.
· Report Bug · Request Feature

About The Project

Monitoring the availability of network services is an important task for any project. At the same time, it is not always necessary to deploy universal solutions like Prometheus, a fairly simple solution. It is for such cases that this bot was created.

The bot will allow you to monitor the availability of HTTP(S) and TCP services and notify Telegram about changes in their status.

The project is in the MVP stage.

(back to top)

Built With

  • Golang

(back to top)

Getting Started

Follow the instructions below to run a bot using Docker.

Prerequisites

To run a bot, it is enough to have Docker or another environment for running containers.

Installation

  1. Register a new bot and get a token for it: https://core.telegram.org/bots/features#creating-a-new-bot
  2. Create a channel or group to which notifications will be sent
  3. Add the bot to the channel/group as an administrator with the ability to send messages
  4. Copy the configuration file config.example.yml to your working directory as config.yml
  5. Make changes to the configuration file:
    • specify the bot token;
    • specify the channel/group ID, you can find out the ID, for example, by following the link like https://api.telegram.org/bot/getUpdates?allowed_updates=[] after adding the bot to a channel/group and finding the value of my_chat_member.chat.id;
    • list the services to monitor.
  6. Run the docker container: docker run -d -v "$(pwd)/config.yml:/app/config.yml:ro" --name tgbot capcom6/service-monitor-tgbot:latest

(back to top)

Usage

HTTP service monitoring example

services:
  - name: Google
    initialDelaySeconds: 5
    periodSeconds: 10
    timeoutSeconds: 1
    successThreshold: 1
    failureThreshold: 3
    httpGet:
      scheme: https
      host: google.com
      path: /
      port: 443
      httpHeaders:
        - name: X-Header
          value: value

HTTP Alert

TCP service monitoring example

services:
  - name: MySQL
    initialDelaySeconds: 5
    periodSeconds: 10
    timeoutSeconds: 1
    successThreshold: 1
    failureThreshold: 3
    tcpSocket:
      host: localhost
      port: 3306

TCP Alert

(back to top)

Roadmap

  • Add Changelog
  • Add the ability to change the text of messages
  • Send notifications to multiple channels/groups
  • Display event time in notifications
  • Online/offline time count
  • Active bot mode
    • Request current state of services
    • SLA report
    • The event log
  • Separation of bot and monitoring service
  • Dynamic list of services
  • Service discovery

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the Apache-2.0 license. See LICENSE.txt for more information.

(back to top)

Contact

Project Link: https://github.com/capcom6/service-monitor-tgbot

(back to top)

Directories

Path Synopsis
cmd
internal
bot

Jump to

Keyboard shortcuts

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