Telegram bot monitoring status

Table of contents

Overview

Once the monitoring is connected via Telegram bot, the system automatically collects data every 5 minutes /system/state. If any information is found in the results, it is broadcast via the bot to all connected master domain administrators.

The administrator has the ability to set a silent mode or pause the notifications. The pause will automatically reset when the condition normalizes. In this case, the system will send a message to all administrators.

With the bot, the administrator can request an up-to-date result at any time /system/state.

The administrator connects to the bot by sending the command "/start <Login>:<Password>".

The service interacts with telegram-bot api via long-polling requests.

Internet access to https://api.telegram.org is required (from the servers of the master site, where the role of the mware).

You should create a separate bot for each platform instance. If you register the same token in different instances of the platform, problems may occur.

Connection instructions

Step 1. Create a new bot in Telegram. To do this, you need to search for @BotFather and send a message to him:

tg 02

Step 2: Customize the bot. Optional step.

Set command descriptions:

tg 04
start - Connect to service
stop - Disconnect from service
ping - Ping service
test - Test reply message
testfile - Test reply as file
echo - Echo message back
sendtoall - Forward message to all connected users
disable_subscription - Disable automatic events
pause_subscription - Pause automatic events until state is not clear
enable_subscription - Enable automatic events
set_silent_mode - Make notifications silent
reset_silent_mode - Make notifications not silent
system_state - Get system state

Set icon:

tg 03

Also by analogy, you can set the description with the command "/setdescription"

Step 3. Install the token into the system. Log in to the master domain under the administrator account, open the "Domain/Preferences" section (settings)". Set the token obtained in step 1 as the value of the parameter 'telegram_bot_token'.

tg 01

After that, if there is an internet connection, within a short time the platform will connect to the Telegram.

Step 4. Find the created bot in Telegram by the given name, and connect to it.

tg 06

Every morning after 8am in the server’s time zone, the system informs about its activity with the help of a bot. The absence of this message is an indication of the need for intervention. In normal mode, interaction with the bot looks like this:

tg 05