Translations of this page:
- en
- ru
en:websonix:bot
Table of Contents
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:
- mail - e-mail configuration:
- user - user for e-mail authentication;
- password - password for e-mail authentication;
- port - e-mail server port;
- server - e-mail server ip or domain name;
- recipients - e-mail recipients list.
- telegram - telegram configuration:
- bot-id - the id of the bot sending messages;
- channel-id - the id of the channel for sending messages.
Configuration file example:
{ "mail": { "user": "sonix-bot", "password": "your_password", "port": 25, "server": "smtp.nf.jinr.ru", "recipients": [ "somebody@mail_address", "another_if_neccessary@mail_addres" ] }, "telegram": { "bot-id": "your_telegram_bot_id", "channel-id": "telegram channel_id" } }
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