Git Product home page Git Product logo

monitor-tgbot's Introduction

monitor-tgbot

This a light weight Telegram bot that watches your systemd enabled Linux machine for service failures.

Dependency

How to build

git clone https://github.com/marty1885/monitor-tgbot
cd monitor-tgbot
mkdir build
cd build
cmake ..
make

How to use

Before using the bot. A few configuations have to be provided by the user. First, you'll need to provide the token that the bot is attached to. If you don't have one, follow Telegram's guide to create one. With your token, you'll need to put the token into a confuration file. The bot will attempt to load ~/.config/monitor-tgbot/monitorbot_config.lua as it's configuration. You may also make one yourself then ask the bot to load it using the -f parameter.

c.bot.token = "132648513:haeohNLANDKban21ja8coanLANlnca64530" -- this is a made up token

Then you'll need to generate a password for the bot. The password authenticaes an account to be added to the list of brodcat. Then you will be notified when services goes down.

cd /path/to/monitor-tgbot/build
❯ ./monitor-tgbot --gen-password
Password:

SHA256:yrmU1VSZtYkC6Oli:a1d9f71497f779b467d4b9b3519b9de06a87725e3487917a89c97bbcdb90517e

Don't worry. I generated the hash by a random monkey pressing randomly on my keyboard. Now put the password into the confuguration file.

c.bot.password = "SHA256:yrmU1VSZtYkC6Oli:a1d9f71497f779b467d4b9b3519b9de06a87725e3487917a89c97bbcdb90517e"

Then just specsify which services you want the bot monitor and how often the bot should check.

c.monitor.services = {"tor", "sshd"}
c.monitor.interval = 300

There are other configurations you can do or overwrite the values via command line. See monitorbot_config.lua and ./monitor-tgbot for more information

Now it's time to launch the bot.

❯ ./monitor-tgbot 

Go to your bot in Telegram. Type in your password. And the bot will confirm that you are added to the list of users.

Supported Commands

ping - Pong!
monitored_services - Replies a list of monitored service
ack - acknowledges that I know the service is down. Don't bother me again

monitor-tgbot's People

Contributors

marty1885 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

battyone

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.