You can use the Telegram messenger to receive status notifications for virtual machines and cluster nodes. VMmanager uses a Telegram bot to send notifications.

To configure sending notifications to Telegram:

  1. Create a Telegram bot.
  2. Connect the bot to VMmanager.
  3. Add Telegram as the notification channel.

Configuration on Telegram side


  1. Open the chat with @BotFather.
  2. Send the command /newbot.
  3. Enter the bot name. E.g. VMmanager Notifier
  4. Enter the bot user name. It must finish with “bot”. E.g., vmnotifybot.
  5. Save the token value from the response.
  6. Add the bot to the Telegram group for notifications.

    In order for the bot to send messages to a Telegram user, the user must open the chat with the bot and click Start.

Example of creating a bot

Configuration on VMmanager side


Connecting the bot

  1. Enter MessengersConnect a messenger.
  2. Insert the Bot token.
  3. Click Activate button.
  4. Select the required chats for sending notifications.
  5. Select the Messages language.
  6. Click Save button.

To change the bot settings, click icon → enter the Bot tokenSave button.

To delete a connected bot, click icon → Delete the botDelete button.

Example of deleting a bot

Managing channels

In Messengers section you can manage channels to which the bot will send notifications. Channels may include groups and individual Telegram users.

To add a channel:

  1. Click Add channel button.
  2. Select the Messages language.
  3. Specify the discretionary Channel name.
  4. Select the channel from the list or Enter the chat ID.
  5. Specify the discretionary Comment for the channel.
  6. Click Add button.

Click icon to edit the channel settings.

Click icon to enable/disable notifications to the channel.

Click icon to delete the channel.

Messengers section of the interface

Adding a channel to notification

To use Telegram as the notification channel:

  1. Enter the Notifications center: Notification settings.
  2. Click the notification name.
  3. Select channels in To the messengers' channels field.
  4. Click Save button.

Read more about managing notifications in Notifications.


Adding a notification channel

Configuring simultaneous notifications


By default, VMmanager sends no more than five notifications to Telegram at a time. To change this setting:

  1. Connect to the server with VMmanager via SSH.
  2. Go to the vm_msgsender_1 docker container:

    docker exec -it vm_msgsender_1 bash
    BASH
  3. Add to the [program:msgs_writer] section of the configuration file /etc/supervisord.conf.d/msgsender.conf parameter:

    environment=TELEGRAM_TASK_LIMIT=<number>
    CODE

    <number> — number of notifications to be sent simultaneously

    It is not recommended to set <number> value higher than 10. This may cause the bot to be blocked by Telegram.

  4. Execute the command:

    supervisorctl update
    BASH
  5. Exit the docker container:

    exit
    BASH

To check the simultaneous sending of messages:

  1. Connect to the server with VMmanager via SSH.
  2. Connect to the platform database:

    docker exec -it mysql bash -c "mysql isp -p\$MYSQL_ROOT_PASSWORD"
    BASH
  3. Perform the request:

    SELECT id, name, lock_tag from taskmgr_task WHERE name = 'msgsender_telegram_send' ORDER BY id desc LIMIT 10;
    SQL

    The number in the lock_tag column shows the number of the message in the queue.

    Example answer

    +-------+-------------------------+--------------------------------+
    | id    | name                    | lock_tag                       |
    +-------+-------------------------+--------------------------------+
    | 11493 | msgsender_telegram_send | ["msgsender_telegram_send.6"]  |
    | 11492 | msgsender_telegram_send | ["msgsender_telegram_send.5"]  |
    | 11485 | msgsender_telegram_send | ["msgsender_telegram_send.4"]  |
    | 11484 | msgsender_telegram_send | ["msgsender_telegram_send.3"]  |
    | 11483 | msgsender_telegram_send | ["msgsender_telegram_send.2"]  |
    | 11482 | msgsender_telegram_send | ["msgsender_telegram_send.1"]  |
    | 11481 | msgsender_telegram_send | ["msgsender_telegram_send.7"]  |
    | 11480 | msgsender_telegram_send | ["msgsender_telegram_send.10"] |
    | 11479 | msgsender_telegram_send | ["msgsender_telegram_send.9"]  |
    | 11478 | msgsender_telegram_send | ["msgsender_telegram_send.8"]  |
    +-------+-------------------------+--------------------------------+
    CODE
  4. Exit the MySQL console:

    exit
    BASH

Useful tips

Related topics: