An open API service indexing awesome lists of open source software.

https://github.com/misskecupbung/monitbot-tele

Simple Bot Telegram to Monitor Website, Database and Ping Server.
https://github.com/misskecupbung/monitbot-tele

bot cron notification telegram

Last synced: about 1 year ago
JSON representation

Simple Bot Telegram to Monitor Website, Database and Ping Server.

Awesome Lists containing this project

README

          

# monitbot-telegram

This guide is refered from https://github.com/matriphe/monit2telegram/ . Goals:
* Monitoring database, website and ping.
* If fails, it will send notification via bot.

### Requirements
* Bot Telegram , you can create from eg: @botfather. Remember the token!
* Curl
* Bash
* JQ
* Cron

### Chat ID

```
$ curl --silent "https://api.telegram.org/bot{TOKEN}/getUpdates" | jq
```

### Deployment

```
cd /opt
git clone https://github.com/misskecupbung/monitbot-telegram
cd monitbot-tele
vim tokenbot
...
TOKEN={{ Telegram Bot Token }}
CHATID={{ Chat ID }}
...

#If you want to custom token path, you must edit :

vim monitbot-tele/telegramrc
...
elif [ -f /path/custom ]; then . /path/custom;
...

```
### Testing
```
chmod +x pingcheck && ./pingcheck
chmod +x dbcheck && ./dbcheck
chmod +x httpcheck && ./httpcheck

```

## Cron
We use cronjob for monitoring everyday. Eg: if every 3 minutes website don't give a response, it will send notification via bot to telegram :

```
crontab -e
...
*/3 * * * * /opt/monitbot-tele/httpcheck
*/3 * * * * /opt/monitbot-tele/dbcheck
*/3 * * * * /opt/monitbot-tele/pingcheck
...
```