User Tools

Site Tools


Translations of this page:

en:websonix:bot

Script for users notification about the measurement status

The Bot sends notifications about measurement errors by e-mail and/or telegram channel. Information about errors is extracted from the measurement protocol. Moreover, users can send any messages from measurement scripts using the following code:

from bot import messangers
messangers.send_message("<message text>")

Structure

The Bot consists of the three modules and configuration file.

Modules

The package consists form the following modules:

  • protocol_reader - a module for reading measurement protocol;
  • messangers - a module with classes for send messages by e-mail and telegram and function send_message, which sends message by all registered addresses;
  • logwatch - sonix device to scan protocol and send error messages to users.

Configuration file

configuration file in json format:

  1. mail - e-mail configuration:
    1. user - user for e-mail authentication;
    2. password - password for e-mail authentication;
    3. port - e-mail server port;
    4. server - e-mail server ip or domain name;
    5. recipients - e-mail recipients list.
  2. telegram - telegram configuration:
    1. bot-id - the id of the bot sending messages;
    2. channel-id - the id of the channel for sending messages.

Configuration file example:

  1. {
  2. "mail": {
  3. "user": "sonix-bot",
  4. "password": "your_password",
  5. "port": 25,
  6. "server": "smtp.nf.jinr.ru",
  7. "recipients": [
  8. "somebody@mail_address",
  9. "another_if_neccessary@mail_addres"
  10. ]
  11. },
  12. "telegram": {
  13. "bot-id": "your_telegram_bot_id",
  14. "channel-id": "telegram channel_id"
  15. }
  16. }

Bot installation on instrument

Bot installation on instruments consists of the following steps:

  • Package installation;
  • Configuring parameters for messages sending;
  • Configuring loading module logwatch.py as Sonix+ module.
en/websonix/bot.txt · Last modified: by 127.0.0.1