<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xmlns:tt="http://teletype.in/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:media="http://search.yahoo.com/mrss/"><channel><title>@shakedown</title><generator>teletype.in</generator><description><![CDATA[@shakedown]]></description><link>https://teletype.in/@shakedown?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=shakedown</link><atom:link rel="self" type="application/rss+xml" href="https://teletype.in/rss/shakedown?offset=0"></atom:link><atom:link rel="next" type="application/rss+xml" href="https://teletype.in/rss/shakedown?offset=10"></atom:link><atom:link rel="search" type="application/opensearchdescription+xml" title="Teletype" href="https://teletype.in/opensearch.xml"></atom:link><pubDate>Sun, 05 Apr 2026 15:57:10 GMT</pubDate><lastBuildDate>Sun, 05 Apr 2026 15:57:10 GMT</lastBuildDate><item><guid isPermaLink="true">https://teletype.in/@shakedown/zXmiV4Rbxly</guid><link>https://teletype.in/@shakedown/zXmiV4Rbxly?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=shakedown</link><comments>https://teletype.in/@shakedown/zXmiV4Rbxly?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=shakedown#comments</comments><dc:creator>shakedown</dc:creator><title>Installing and configuring monitoring</title><pubDate>Thu, 30 Jan 2025 16:35:57 GMT</pubDate><media:content medium="image" url="https://img1.teletype.in/files/04/3c/043cf13b-a144-45f8-98b9-54f59581f6ec.png"></media:content><description><![CDATA[<img src="https://img1.teletype.in/files/07/d2/07d2239d-87e0-4d0e-a130-04c1c013cb55.png"></img>Grafana and Prometheus form a powerful bundle for real-time monitoring and visualization of metrics. Grafana is a popular tool for creating informative and interactive dashboards that help users visually track performance, logs, and notifications. Prometheus, on the other hand, is an open source monitoring and alerting system designed to collect metrics in highly dynamic environments such as containerized applications.]]></description><content:encoded><![CDATA[
  <h3 id="jWgW">The example of Prometheus+Grafana+Node_exporter+autonomys_exporter</h3>
  <p id="cDWb"><br />Grafana and Prometheus form a powerful bundle for real-time monitoring and visualization of metrics. Grafana is a popular tool for creating informative and interactive dashboards that help users visually track performance, logs, and notifications. Prometheus, on the other hand, is an open source monitoring and alerting system designed to collect metrics in highly dynamic environments such as containerized applications.</p>
  <p id="LtLV"></p>
  <h3 id="j1fH">What we will do</h3>
  <p id="46F8"><br />In this article, we&#x27;ll go step-by-step through how to install Grafana and Prometheus on your system, as well as import a dashboard to track key metrics for your server.</p>
  <p id="X1Gh"></p>
  <h3 id="LQz5">1) Node-exporter</h3>
  <p id="n9ae"><br />Install node-exporter on the server we want to see on the chart.</p>
  <pre id="a1HL">. &lt;(wget -qO- https://raw.githubusercontent.com/g7AzaZLO/NodeExporter-autoinstaller/main/NodeExporter-auto-install.sh)</pre>
  <p id="gPMm">You can verify that everything installed well</p>
  <p id="YCPu"><code>sudo journalctl -u exporterd -f</code></p>
  <p id="7cbr">**You can also see a list of metrics that the server gives out</p>
  <p id="bcfq"><code>Go to http://&lt;IP_ADDRESS&gt;:9100/metrics , where &lt;IP_ADDRESS&gt; is the ip of our server</code><br /></p>
  <h3 id="Zx8f">2) Prometheus</h3>
  <p id="By9U"><br />Install Prometheus on the same or any other server, it serves as a metrics aggregator and we will need it in a single quantity</p>
  <p id="wWJZ">Download and install</p>
  <pre id="2LNi">wget https://github.com/prometheus/prometheus/releases/download/v2.28.1/prometheus-2.28.1.linux-amd64.tar.gz &amp;&amp; \tar xvf prometheus-2.28.1.linux-amd64.tar.gz &amp;&amp; \rm prometheus-2.28.1.linux-amd64.tar.gz &amp;&amp; \mv prometheus-2.28.1.linux-amd64 prometheus</pre>
  <p id="UNXX"></p>
  <p id="Jrtj">Add our server (on which node-exporter is installed) to the target list<br />Open our Prometheus config for customization</p>
  <pre id="ol8d">nano $HOME/prometheus/prometheus.yml</pre>
  <p id="aGm1">Add our node-exporter (ip-server + port) to the targets</p>
  <p id="HCYy">Example:</p>
  <figure id="fL5V" class="m_original">
    <img src="https://img1.teletype.in/files/07/d2/07d2239d-87e0-4d0e-a130-04c1c013cb55.png" width="332" />
  </figure>
  <p id="gV81">Grant execution rights to our file</p>
  <pre id="w35n">chmod +x $HOME/prometheus/prometheus</pre>
  <p id="LjO9">Create a service file to run at startup</p>
  <pre id="ZfIN">sudo tee /etc/systemd/system/prometheusd.service &gt; /dev/null &lt;&lt;EOF
[Unit]
Description=node_exporter
After=network-online.target
[Service]
User=$USER
ExecStart=$HOME/prometheus/prometheus --config.file=&quot;$HOME/prometheus/prometheus.yml&quot; 
Restart=always 
RestartSec=3 
LimitNOFILE=65535 
[Install] 
WantedBy=multi-user.target 
EOF</pre>
  <p id="raLT"></p>
  <p id="4gFu">After that we start the service</p>
  <pre id="O3j0">sudo systemctl daemon-reload &amp;&amp; \sudo systemctl enable prometheusd &amp;&amp; \sudo systemctl restart prometheusd</pre>
  <p id="vrOT"></p>
  <p id="3KN5">You can check the logs like this</p>
  <p id="2Oa9"><code>sudo journalctl -u prometheusd -f</code></p>
  <p id="lP6Z"></p>
  <p id="lDCm">You can also check if the target is visible for monitoring (our server with exporter(s)).</p>
  <p id="1u7K">Go to the address in the browser: </p>
  <p id="xMk6"><code>http://&lt;IP_ADDRESS&gt;:9090/targets</code></p>
  <p id="xySt"> where &lt;IP_ADDRESS&gt; is the IP of the server we just installed prometheus on.</p>
  <figure id="4OjM" class="m_original">
    <img src="https://img2.teletype.in/files/99/0a/990a53a9-ad8f-4718-9bdb-2cbff4eae91e.png" width="1227" />
  </figure>
  <h3 id="8M8J"></h3>
  <h2 id="EeuY">3) Grafana</h2>
  <p id="g4Qs"></p>
  <p id="I3f1">Grafana serves us for beautiful display of metrics and creation of simple alerts to messengers or mail</p>
  <p id="zlXk">Install on any server, in my case the server is the same where Prometheus is located:</p>
  <pre id="AffP">sudo apt-get install -y adduser libfontconfig1 &amp;&amp; \wget https://dl.grafana.com/oss/release/grafana_8.0.6_amd64.deb &amp;&amp; \sudo dpkg -i grafana_8.0.6_amd64.deb</pre>
  <p id="Iv33">*It is possible to install a newer version</p>
  <p id="7hkJ">Start and activate the service with graphana</p>
  <pre id="qrW9">sudo systemctl daemon-reload &amp;&amp; \sudo systemctl enable grafana-server &amp;&amp; \sudo systemctl restart grafana-server</pre>
  <p id="nLxl"></p>
  <p id="6PIn">You can check the logs like this:</p>
  <pre id="7q61">sudo journalctl -u grafana-server -f</pre>
  <p id="OoNG"></p>
  <p id="RPn6">Finally, log into grafana, the default path is as follows:</p>
  <p id="s0ra"><br />http://&lt;IP_ADDRESS&gt;:3000, where &lt;IP_ADDRESS&gt; is the IP of the server we installed grafana on.</p>
  <p id="X38D"><code>login : admin</code></p>
  <p id="jEqb"><code>password : admin</code></p>
  <p id="Gt35"><strong>*Make sure you change your password </strong></p>
  <p id="zInq"></p>
  <h2 id="fgjf">4) Add DataSource<br /></h2>
  <p id="meai">It is necessary to show the grafana from where to take data for plotting.</p>
  <p id="TaiS">In our case it is Prometheus</p>
  <figure id="qZX4" class="m_original">
    <img src="https://img1.teletype.in/files/05/42/0542d843-25da-4d7b-a8e1-f11d2fb30331.png" width="683" />
  </figure>
  <p id="gu6L"></p>
  <h2 id="hn1Z">5) Import and edit graphics</h2>
  <p id="AlN2"></p>
  <p id="5M84">Grafana has its own gallery of dashboards, in our case this one will do:</p>
  <p id="9VjB"><a href="https://grafana.com/grafana/dashboards/1860-node-exporter-full/" target="_blank">https://grafana.com/grafana/dashboards/1860-node-exporter-full/</a></p>
  <p id="4YsZ">It can be imported by ID or as a whole.</p>
  <p id="3wmH">The result is something like this</p>
  <figure id="1ZeO" class="m_retina">
    <img src="https://img4.teletype.in/files/3f/22/3f2275cd-fe79-4138-ba9c-02dbaee55389.png" width="1068" />
  </figure>
  <p id="sj9A">This is just a basic dashboard for tracking basic server metrics, there are a great number of them and can be easily customized.</p>
  <p id="3JG5">In the next part we will talk about alerts and metrics exporter for Autonomys (Subspace)</p>

]]></content:encoded></item><item><guid isPermaLink="true">https://teletype.in/@shakedown/0-RZZIWU8NL</guid><link>https://teletype.in/@shakedown/0-RZZIWU8NL?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=shakedown</link><comments>https://teletype.in/@shakedown/0-RZZIWU8NL?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=shakedown#comments</comments><dc:creator>shakedown</dc:creator><title>Установка и настройка мониторинга </title><pubDate>Tue, 28 Jan 2025 19:17:36 GMT</pubDate><description><![CDATA[Grafana и Prometheus образуют мощную связку для мониторинга и визуализации метрик в режиме реального времени. Grafana — это популярный инструмент для создания информативных и интерактивных дашбордов, который помогает пользователям наглядно отслеживать производительность, логи и уведомления. Prometheus, в свою очередь, представляет собой открытую систему мониторинга и алертинга, разработанную для сбора метрик в высокодинамичных средах, таких как контейнеризированные приложения.]]></description><content:encoded><![CDATA[
  <h3 id="xInN">На примере Prometheus+Grafana+Node_exporter+autonomys_exporter</h3>
  <p id="WPAo">Grafana и Prometheus образуют мощную связку для мониторинга и визуализации метрик в режиме реального времени. Grafana — это популярный инструмент для создания информативных и интерактивных дашбордов, который помогает пользователям наглядно отслеживать производительность, логи и уведомления. Prometheus, в свою очередь, представляет собой открытую систему мониторинга и алертинга, разработанную для сбора метрик в высокодинамичных средах, таких как контейнеризированные приложения.</p>
  <p id="grlN"></p>
  <h3 id="Jw67">Что мы будем делать</h3>
  <p id="pWUF">В этой статье мы шаг за шагом разберем, как установить Grafana и Prometheus на вашу систему, а также импортировать дашборд для отслеживания ключевых метрик вашего сервера.</p>
  <h3 id="pqjN"></h3>
  <h3 id="QLJR">1) Node-exporter</h3>
  <p id="tLD7">Устанавливаем на сервер, который хотим видеть на графике node-exporter</p>
  <pre id="gX8G">. &lt;(wget -qO- https://raw.githubusercontent.com/g7AzaZLO/NodeExporter-autoinstaller/main/NodeExporter-auto-install.sh)</pre>
  <p id="dFy7">Можно проверить, что все хорошо установилось<br /><code>sudo journalctl -u exporterd -f</code></p>
  <p id="1cDf">**Также можно посмотреть список метрик, которые отдает сервер</p>
  <p id="wS30"><code>Зайти по адресу http://&lt;IP_ADDRESS&gt;:9100/metrics , где &lt;IP_ADDRESS&gt; - ip нашего сервера</code></p>
  <p id="AMSs"></p>
  <p id="cLDW"></p>
  <h2 id="h9cp">2) Prometheus</h2>
  <p id="AeWs">Устанавливаем на этот же или любой другой сервер Prometheus, он служит как агрегатор метрик и понадобится нам в единичном количестве</p>
  <p id="B1Iu">Скачиваем и устанавливаем</p>
  <pre id="SsiM">wget https://github.com/prometheus/prometheus/releases/download/v2.28.1/prometheus-2.28.1.linux-amd64.tar.gz &amp;&amp; \tar xvf prometheus-2.28.1.linux-amd64.tar.gz &amp;&amp; \rm prometheus-2.28.1.linux-amd64.tar.gz &amp;&amp; \mv prometheus-2.28.1.linux-amd64 prometheus</pre>
  <p id="bGW9"></p>
  <p id="4MqY">Добавляем в список целей наш сервер (на котором установлен node-exporter)<br />Открываем конфиг нашего Prometheus для настройки</p>
  <pre id="eYIc">nano $HOME/prometheus/prometheus.yml</pre>
  <p id="8Lsb">Добавляем в таргеты наш node-exporter (ip-server + port)</p>
  <p id="kSwi">Пример:</p>
  <figure id="bmo5" class="m_original">
    <img src="https://img4.teletype.in/files/b8/4f/b84f5663-7558-4095-a20d-0ebebb4318ff.png" width="332" />
  </figure>
  <p id="fLB0">Выдаем права на исполнение нашего файла</p>
  <pre id="LVlq">chmod +x $HOME/prometheus/prometheus</pre>
  <p id="58cJ"></p>
  <p id="ehAj">Создаем сервисный файл для запуска при старте</p>
  <pre id="RNyY">sudo tee /etc/systemd/system/prometheusd.service &gt; /dev/null &lt;&lt;EOF
[Unit]
Description=node_exporter
After=network-online.target
[Service]
User=$USER
ExecStart=$HOME/prometheus/prometheus --config.file=&quot;$HOME/prometheus/prometheus.yml&quot; 
Restart=always 
RestartSec=3 
LimitNOFILE=65535 
[Install] 
WantedBy=multi-user.target 
EOF</pre>
  <p id="zgGs"></p>
  <p id="FI61">После чего запускаем сервис</p>
  <pre id="9oJz">sudo systemctl daemon-reload &amp;&amp; \sudo systemctl enable prometheusd &amp;&amp; \sudo systemctl restart prometheusd</pre>
  <p id="jktv">Проверять логи можно так<br /><code>sudo journalctl -u prometheusd -f</code></p>
  <p id="lUTc"></p>
  <p id="nbLi">Также можно проверить, видна ли цель для мониторинга(наш сервер с экспортером(ми))</p>
  <p id="Sybx">Переходим в браузере по адресу: </p>
  <p id="Oa3Q">http://&lt;IP_ADDRESS&gt;:9090/targets</p>
  <p id="pkCM"> где <strong>&lt;IP_ADDRESS&gt;</strong> - IP сервера, на который мы только что установили <strong>prometheus</strong>.</p>
  <figure id="DTfj" class="m_original">
    <img src="https://img4.teletype.in/files/7a/d6/7ad64d59-8c10-4164-8cf9-facc40c11a7e.png" width="1227" />
  </figure>
  <h2 id="5pRc">3) Grafana</h2>
  <p id="SNRa">Графана нам служит для красивого отображения метрик и создания простейших алертов в мессенджеры или на почту</p>
  <p id="QySu"></p>
  <p id="b4xK">Устанавливаем на любом сервере, в моем случае сервер тот же, где расположен прометеус:</p>
  <p id="kRch"></p>
  <pre id="betq">sudo apt-get install -y adduser libfontconfig1 &amp;&amp; \wget https://dl.grafana.com/oss/release/grafana_8.0.6_amd64.deb &amp;&amp; \sudo dpkg -i grafana_8.0.6_amd64.deb</pre>
  <p id="LU5B">*можно установить версию свежее</p>
  <p id="dlRf"></p>
  <p id="mVo1">Запускаем и активируем сервис графаной</p>
  <pre id="hcMZ">sudo systemctl daemon-reload &amp;&amp; \sudo systemctl enable grafana-server &amp;&amp; \sudo systemctl restart grafana-server</pre>
  <p id="VyBL"></p>
  <p id="yyfm">Проверить логи можно так:</p>
  <pre id="3Dlf">sudo journalctl -u grafana-server -f</pre>
  <p id="uDey"></p>
  <p id="ZM1v">Наконец, заходим в графану, по-умолчанию путь следующий:</p>
  <p id="765T"><br />http://&lt;IP_ADDRESS&gt;:3000, где <strong>&lt;IP_ADDRESS&gt;</strong> - IP сервера, на который мы установили <strong>grafana</strong>.</p>
  <p id="QpTg"><code>логин : admin</code></p>
  <p id="VwQP"><code>пароль: admin</code></p>
  <p id="lu9Y">*Обязательно смените пароль</p>
  <p id="Rmwb"></p>
  <h2 id="K1GC">4) Добавляем Data Source</h2>
  <p id="UJYc">Необходимо показать графане, откуда брать данные для построения графиков.</p>
  <p id="STzx">В нашем случае это  прометеус</p>
  <figure id="9S5T" class="m_original">
    <img src="https://img1.teletype.in/files/8f/0f/8f0f026d-6edb-473d-ac75-385d6e8829f7.png" width="683" />
  </figure>
  <h2 id="v6wd">5) Импортируем и редактируем графики</h2>
  <p id="Mz9Q"></p>
  <p id="2vLm">У графаны есть своя галерея дашбордов, в нашем случае подойдет этот:</p>
  <p id="E0od"><a href="https://grafana.com/grafana/dashboards/1860-node-exporter-full/" target="_blank">https://grafana.com/grafana/dashboards/1860-node-exporter-full/</a></p>
  <p id="8izt">Его можно импортиртировать по ID или целиком </p>
  <p id="zmMr">По итогу получаем нечто похожее</p>
  <figure id="Eg7Q" class="m_retina">
    <img src="https://img4.teletype.in/files/b2/89/b289f475-bb30-445a-a7cd-34a3710cecb8.png" width="1068" />
  </figure>
  <p id="lljw">Это только базовый дашборд для отслеживания основных метрик сервера, их существует великое множество и легко можно кастомизировать.</p>
  <p id="iIyx">В следующей части мы поговорим об алертах и экспортере метрик для Autonomys (Subspace)</p>

]]></content:encoded></item><item><guid isPermaLink="true">https://teletype.in/@shakedown/subspace-bot-eng</guid><link>https://teletype.in/@shakedown/subspace-bot-eng?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=shakedown</link><comments>https://teletype.in/@shakedown/subspace-bot-eng?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=shakedown#comments</comments><dc:creator>shakedown</dc:creator><title>Telegram-bot for Subspace</title><pubDate>Sat, 28 Jan 2023 17:08:47 GMT</pubDate><media:content medium="image" url="https://img1.teletype.in/files/43/fa/43fa8c0a-76e7-4ba8-a4c8-4e97d6cbffa4.png"></media:content><description><![CDATA[<img src="https://img3.teletype.in/files/e1/36/e136e3ed-d0f8-40fd-bbce-9dfd4a418421.png"></img>In this guide, I will show you how you can create your own Telegram bot to manage and monitor your Subspace node.]]></description><content:encoded><![CDATA[
  <p id="o64q">In this guide, I will show you how you can create your own Telegram bot to manage and monitor your Subspace node.</p>
  <p id="39ZL">The guide consists of 2 parts:</p>
  <p id="MlnD">1) Creating a Telegram bot and getting API keys<br />2) Installing and configuring the bot on your node</p>
  <h2 id="s31a">1.1) Registering a bot</h2>
  <p id="dcgP">Send a message to <a href="https://t.me/BotFather" target="_blank">https://t.me/BotFather</a> in telegram</p>
  <pre id="cwlF">/newbot</pre>
  <p id="7mO6">Invent description and name(should MUST end with bot) for bot, examples:</p>
  <p id="SRQ1">abcde<em>_<strong>bot</strong></em> or abcdetest<em><strong>Bot</strong></em><br /></p>
  <p id="fk4g">Save <strong>HTTP API token</strong>, generated by BotFather - it will be useful to us</p>
  <h2 id="37zV">1.2) Getting api_hash for telegram-api-server</h2>
  <p id="Kf8w">When using the standard Telegram server, there are restrictions and timeouts after which the bot may stop responding.</p>
  <p id="pNMp">In order for our bot to be stable and available, we will deploy our own telegram-api-server on our node.</p>
  <p id="3F0T">Go and log in to the official apps section in the web version</p>
  <p id="xt9N"> Telegram: <a href="https://my.telegram.org" target="_blank">https://my.telegram.org</a></p>
  <p id="0zZW">Go to <strong>API development tools</strong></p>
  <figure id="73L1" class="m_custom">
    <img src="https://img3.teletype.in/files/e1/36/e136e3ed-d0f8-40fd-bbce-9dfd4a418421.png" width="472" />
  </figure>
  <p id="sgzZ">Fill in the fields:<br /><strong>App title</strong>: any text<br /><strong>Shortname</strong>: any text without spaces<br /><strong>Url</strong>: any link or IP<br /><strong>Platform</strong>: <strong>Desktop</strong><br /><strong>Description</strong>: any description</p>
  <p id="qnPY">Then press <strong>Create application.</strong></p>
  <p id="Gs4B">In case of success (not always the first time, sometimes it gives &quot;ERROR&quot; without a description), we get something like this</p>
  <figure id="VlcV" class="m_custom">
    <img src="https://img3.teletype.in/files/60/cb/60cbea7e-30c9-4fb6-bc1d-44ecc94d8751.png" width="736" />
  </figure>
  <p id="VkKr">Save your <strong>api_id</strong> и <strong>api_hash</strong></p>
  <p id="aP9h">This completes the registration of the bot and the application for it.</p>
  <h2 id="X3IY">2.1) Installing the bot on the server</h2>
  <h3 id="sRiT">Clone the repo:</h3>
  <p id="ayqg"><code>git clone <a href="https://github.com/mrShakedown/subspace-bot.git" target="_blank">https://github.com/mrShakedown/subspace-bot.git</a></code></p>
  <p id="7cI7"><code>mv ./subspace-bot/* ~/</code></p>
  <h3 id="jzFS">Make service unit for bot:</h3>
  <p id="aoHp">nano - text editor in Linux</p>
  <p id="E7zo"><code>nano /etc/systemd/system/telegram-bot.service</code></p>
  <p id="waqg">write there:</p>
  <pre id="msEz">[Unit]
Description=Telegram-bot
After=network.target
[Service]
Type=simple
ExecStart=/root/bot.sh
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target</pre>
  <p id="iMu1">To save and exit the editor:<em> CTRL+O, CTRL+X</em></p>
  <h3 id="6uH2">make script for run bot:</h3>
  <p id="zYxl"><code>nano /root/bot.sh</code></p>
  <p id="hOg7">write there:</p>
  <pre id="mCJ3">#!/bin/bash
python3 /root/bot.py</pre>
  <p id="FU37">Grant right for execution:<br /><code>chmod +x /root/bot.sh</code></p>
  <h3 id="tkux">Edit configuration:</h3>
  <p id="kRBS"><code>nano /root/config.py</code></p>
  <p id="g3ZK">Where:</p>
  <p id="WoZi"><strong>token = &#x27;YOUR_TOKEN&#x27; </strong> - token of your bot</p>
  <p id="0Jg5"><strong>data_path = &#x27;/dev&#x27;</strong> - path to track disk usage and alerts</p>
  <p id="SURV"><strong>timer = 10</strong> - frequency of checking the stats node and for alerts (in seconds)</p>
  <p id="2NPQ"><strong>admin_id = 123</strong> - Your unique account ID, you can get it from the bot <a href="https://t.me/my_id_bot" target="_blank">https://t.me/my_id_bot</a> (a person with a different ID will not be able to use your bot)</p>
  <h2 id="Ajys">2.2) Preparing the environment</h2>
  <h3 id="Ob7Q">Install the library for  bot <a href="https://github.com/eternnoir/pyTelegramBotAPI" target="_blank">https://github.com/eternnoir/pyTelegramBotAPI</a></h3>
  <pre id="6aQX">apt install python3-pip</pre>
  <pre id="UKrW">pip install pyTelegramBotAPI</pre>
  <h3 id="RlHN">Install environment for telegram-api-server (<a href="https://core.telegram.org/bots/api#using-a-local-bot-api-server" target="_blank">official guide</a>)</h3>
  <p id="vynR"><code>cd ~</code></p>
  <p id="T4f8"><code>git clone --recursive <a href="https://github.com/tdlib/telegram-bot-api.git" target="_blank">https://github.com/tdlib/telegram-bot-api.git</a></code></p>
  <p id="jlJ4"><code>cd telegram-bot-api</code></p>
  <p id="6XJV"><code>mkdir build &amp;&amp; cd build/</code></p>
  <p id="kUK1"><code>apt-get install libssl-dev build-essential checkinstall zlib1g-dev cmake openssl ccache gperf -y</code></p>
  <h3 id="fSLL">Build</h3>
  <p id="7iaz"><code>cmake -DCMAKE_BUILD_TYPE=Release ..</code></p>
  <p id="haaQ"><code>cmake --build . --target install</code></p>
  <h3 id="fJoa"></h3>
  <h3 id="irQE">Create a service for telegram-api-server</h3>
  <p id="lGFg"><code>nano /etc/systemd/system/telegram-api.service</code></p>
  <p id="TuNf">Write there:</p>
  <pre id="T0Al">[Unit]
Description=telegram-api-server
After=network.target
[Service]
Type=simple
ExecStart=telegram-bot-api --api-id=123 --api-hash=123 -p 8080
[Install]
WantedBy=multi-user.target</pre>
  <p id="bLel">where:<br /><strong>api-id </strong>and <strong>api_hash</strong><br />from your app configuration</p>
  <figure id="o6DL" class="m_custom">
    <img src="https://img1.teletype.in/files/8e/08/8e085f13-4265-4965-ad09-db120656b403.png" width="455" />
  </figure>
  <p id="fKEK">and <strong>p</strong> = free port for your choice (default <strong>8080)</strong></p>
  <p id="BoJC"><em>To save and exit from editor: CTRL+O, CTRL+X</em></p>
  <h3 id="fxAM">Save and run</h3>
  <p id="l8vh">Update the created services for the bot and api-server</p>
  <p id="hS8f"><code>source ~/.bash_profile</code></p>
  <p id="ERlS">let&#x27;s run</p>
  <p id="8wEY"><code>systemctl enable telegram-api.service</code></p>
  <p id="BhGC"><code>systemctl enable telegram-bot.service</code></p>
  <p id="CCbm"><code>systemctl restart telegram-api.service telegram-bot.service</code></p>
  <h2 id="5z1F">Result:</h2>
  <p id="PdiU">You have a bot running on the server, to which only you have access, with which you can monitor the state of the node manually (the list of commands in /help)</p>
  <figure id="6bTk" class="m_custom">
    <img src="https://img3.teletype.in/files/e0/42/e04274f5-3dd2-48c2-a71c-db1fec8511ad.png" width="635" />
  </figure>
  <p id="t0ig">or automatically (alerts on click <strong>/on</strong> или <strong>/off</strong> )</p>
  <figure id="OZbS" class="m_custom">
    <img src="https://img4.teletype.in/files/72/91/72915e31-38cb-4f84-9796-a4362fa7cf6f.png" width="660" />
  </figure>
  <p id="v8yP">The main list of commands can be obtained from the bot in the chat:<br />/help - will show actual commands </p>
  <p id="k2OZ">You can also add your commands directly to bot.py and restart the service</p>
  <p id="eSAu"> (<code>systemctl restart telegram-bot.service)</code></p>
  <p id="ySBL">As soon as I&#x27;m added different features - the guide will be updated (I really want to make shorter installation script)</p>
  <p id="PH8E">P.s. I&#x27;m not a professional programmer - adequate criticism is not forbidden (<a href="https://github.com/mrShakedown/subspace-bot" target="_blank">fork it ;</a>)</p>

]]></content:encoded></item><item><guid isPermaLink="true">https://teletype.in/@shakedown/subspace-bot-rus</guid><link>https://teletype.in/@shakedown/subspace-bot-rus?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=shakedown</link><comments>https://teletype.in/@shakedown/subspace-bot-rus?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=shakedown#comments</comments><dc:creator>shakedown</dc:creator><title>Телеграм бот для Subspace</title><pubDate>Sat, 28 Jan 2023 16:31:06 GMT</pubDate><media:content medium="image" url="https://img1.teletype.in/files/43/fa/43fa8c0a-76e7-4ba8-a4c8-4e97d6cbffa4.png"></media:content><description><![CDATA[<img src="https://img3.teletype.in/files/e1/36/e136e3ed-d0f8-40fd-bbce-9dfd4a418421.png"></img>В этом гайде я расскажу, как вы можете создать собственного бота в Telegram для управления и мониторинга вашей ноды Subspace.]]></description><content:encoded><![CDATA[
  <p id="HTRj">В этом гайде я расскажу, как вы можете создать собственного бота в Telegram для управления и мониторинга вашей ноды Subspace.</p>
  <p id="E1sr">Гайд состоит из 2х частей:</p>
  <p id="szxn">1) Создание бота Telegram и получение API ключей</p>
  <p id="HUrX">2) Установка и настрйока бота на вашу ноду</p>
  <p id="xoyx"></p>
  <h2 id="s31a">1.1) Регистрируем бота</h2>
  <p id="s8bz"></p>
  <p id="dcgP">Пишем в телеграме <a href="https://t.me/BotFather" target="_blank">https://t.me/BotFather</a> в сообщении</p>
  <pre id="BnSH">/newbot</pre>
  <p id="FpIj">Придумываем название(произвольно) и имя ( должно ОБЯЗАТЕЛЬНО заканчиваться на bot, <br /><em>Пример</em>: abcde<em>_<strong>bot</strong></em> или abcdetest<em><strong>Bot </strong>)</em></p>
  <p id="fk4g">Сохраняем <strong>HTTP API token</strong>, который выдал BotFather, он нам пригодится</p>
  <p id="m3Pz"></p>
  <h2 id="37zV">1.2) Получаем api_hash для telegram-api-server</h2>
  <p id="BhYL"></p>
  <p id="dOYz">При использовании стандартного сервера Telegram ограничения и тайм-ауты, после которых бот может перестать отвечать.</p>
  <p id="8ZDu">Для того, чтобы наш бот был стабилен и доступен -  мы развернем свой собственный telegram-api-server на нашей ноде. </p>
  <p id="bPBN"></p>
  <p id="xt9N">Переходим и авторизовываемся в официальный раздел apps в веб-версии Telegram: <a href="https://my.telegram.org" target="_blank">https://my.telegram.org</a></p>
  <p id="0zZW">Переходим в раздел <strong>API development tools</strong></p>
  <figure id="73L1" class="m_original">
    <img src="https://img3.teletype.in/files/e1/36/e136e3ed-d0f8-40fd-bbce-9dfd4a418421.png" width="472" />
  </figure>
  <p id="bDUO">Заполняем поля:<br /><strong>App title</strong>: Любое название на английском языке<br /><strong>Shortname</strong>: Любое название английском языке без пробелов<br /><strong>Url</strong>: Произвольная ссылка или IP<br /><strong>Platform</strong>: <strong>Desktop</strong><br /><strong>Description</strong>: Придумайте любое описание</p>
  <p id="qnPY">После чего нажимаем <strong>Create application.</strong></p>
  <p id="NuYC">В случае успеха ( не всегда с первого раза, иногда отдает &quot;ОШИБКА&quot; без описания) получаем что-то подобное</p>
  <figure id="VlcV" class="m_original">
    <img src="https://img3.teletype.in/files/60/cb/60cbea7e-30c9-4fb6-bc1d-44ecc94d8751.png" width="736" />
  </figure>
  <p id="UK97"> </p>
  <p id="VkKr">Сохраняем себе <strong>api_id</strong> и <strong>api_hash</strong></p>
  <p id="vfpx">На это регистрация бота и приложения для него завершена.</p>
  <p id="yFnW"></p>
  <h2 id="X3IY">2.1) Устанавливаем бота на сервер</h2>
  <p id="RJX2"></p>
  <h3 id="sRiT">Клонируем репозиторий:</h3>
  <p id="ayqg"><code>git clone <a href="https://github.com/mrShakedown/subspace-bot.git" target="_blank">https://github.com/mrShakedown/subspace-bot.git</a></code></p>
  <p id="7cI7"><code>mv ./subspace-bot/* ~/</code></p>
  <h3 id="jzFS">Создаем сервис для бота:</h3>
  <p id="aoHp">nano - текстовый редактор</p>
  <p id="E7zo"><code>nano /etc/systemd/system/telegram-bot.service</code></p>
  <p id="waqg">туда вписываем:</p>
  <pre id="tCWS">[Unit]
Description=Telegram-bot
After=network.target
[Service]
Type=simple
ExecStart=/root/bot.sh
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target</pre>
  <p id="Sagh"><em>Для сохранения и выхода из редактора: CTRL+O, CTRL+X</em></p>
  <p id="VusE"></p>
  <h3 id="6uH2">Создаем скрипт для запуска бота:</h3>
  <p id="zYxl"><br /><code>nano /root/bot.sh</code></p>
  <p id="hOg7">туда вписываем:</p>
  <pre id="BCeL">#!/bin/bash
python3 /root/bot.py</pre>
  <p id="FU37">Выдаем права на исполнение:<br /><code>chmod +x /root/bot.sh</code></p>
  <p id="OZ9s"></p>
  <h3 id="tkux">Правим конфигурацию:</h3>
  <p id="kRBS"><code>nano /root/config.py</code></p>
  <p id="g3ZK">Где:</p>
  <p id="WoZi"><strong>token = &#x27;YOUR_TOKEN&#x27; </strong> - Ваш токен бота</p>
  <p id="0Jg5"><strong>data_path = &#x27;/dev&#x27;</strong> - путь, для отслеживания места</p>
  <p id="SURV"><strong>timer = 10</strong> - частота проверки условия для алертов и их отправки (в секундах)</p>
  <p id="2NPQ"><strong>admin_id = 123</strong>  - Ваш уникальный ID учетной записи, поолучить можно у бота <a href="https://t.me/my_id_bot" target="_blank">https://t.me/my_id_bot</a>  (человек с другим ID не сможет пользоваться вашим ботом)</p>
  <h2 id="Ajys">2.2) Подготовка окружения<br /></h2>
  <h3 id="Ob7Q">Устанавливаем библиотеку для работы бота <a href="https://github.com/eternnoir/pyTelegramBotAPI" target="_blank">https://github.com/eternnoir/pyTelegramBotAPI</a></h3>
  <pre id="Hz7a">apt install python3-pip</pre>
  <pre id="ua0F">pip install pyTelegramBotAPI</pre>
  <p id="Bbkz"></p>
  <h3 id="RlHN">Устанавливаем окружение для telegram-api-server (<a href="https://core.telegram.org/bots/api#using-a-local-bot-api-server" target="_blank">официальное руководство</a>)</h3>
  <p id="vynR"><code>cd ~</code></p>
  <p id="T4f8"><code>git clone --recursive <a href="https://github.com/tdlib/telegram-bot-api.git" target="_blank">https://github.com/tdlib/telegram-bot-api.git</a></code></p>
  <p id="jlJ4"><code>cd telegram-bot-api</code></p>
  <p id="6XJV"><code>mkdir build &amp;&amp; cd build/</code></p>
  <p id="kUK1"><code>apt-get install libssl-dev build-essential checkinstall zlib1g-dev cmake openssl ccache gperf -y</code></p>
  <h3 id="fSLL">Собираем</h3>
  <p id="7iaz"><code>cmake -DCMAKE_BUILD_TYPE=Release ..</code></p>
  <p id="haaQ"><code>cmake --build . --target install</code></p>
  <p id="5k4s"></p>
  <h3 id="fJoa">Создаем сервис для работы telegram-api-server</h3>
  <p id="lGFg"><code>nano /etc/systemd/system/telegram-api.service</code></p>
  <p id="TuNf">Туда вписываем:</p>
  <pre id="gEOX">[Unit]
Description=telegram-api-server
After=network.target
[Service]
Type=simple
ExecStart=telegram-bot-api --api-id=123 --api-hash=123 -p 8080
[Install]
WantedBy=multi-user.target</pre>
  <p id="bLel">где:<br /><strong>api-id </strong>и <strong>api_hash</strong><br />отсюда</p>
  <figure id="o6DL" class="m_custom">
    <img src="https://img1.teletype.in/files/8e/08/8e085f13-4265-4965-ad09-db120656b403.png" width="455" />
  </figure>
  <p id="fKEK">и <strong>p</strong> = порт на ваш выбор, по умолчанию <strong>8080</strong></p>
  <p id="BoJC"><em>Для сохранения и выхода из редактора: CTRL+O, CTRL+X</em></p>
  <p id="76po"></p>
  <h3 id="fxAM">Сохраняем и запускаем</h3>
  <p id="eF4r"></p>
  <p id="T2hT">Обновляем созданные сервисы для бота и апи-сервера</p>
  <p id="hS8f"><code>source ~/.bash_profile</code></p>
  <p id="ERlS">Запускаем</p>
  <p id="8wEY"><code>systemctl enable telegram-api.service</code></p>
  <p id="BhGC"><code>systemctl enable telegram-bot.service</code></p>
  <p id="CCbm"><code>systemctl restart telegram-api.service telegram-bot.service</code></p>
  <p id="4pXQ"></p>
  <h2 id="5z1F">Итог:</h2>
  <p id="6jh4">У вас на сервере запущен бот, к которому только вы имеете доступ, с помощью которого можно отслеживать состояние ноды в ручном (список команд  в /help) </p>
  <figure id="6bTk" class="m_custom">
    <img src="https://img3.teletype.in/files/e0/42/e04274f5-3dd2-48c2-a71c-db1fec8511ad.png" width="635.0027247956403" />
  </figure>
  <p id="tcdJ">или автоматически(алерты по нажатию /on или /off )</p>
  <figure id="OZbS" class="m_custom">
    <img src="https://img4.teletype.in/files/72/91/72915e31-38cb-4f84-9796-a4362fa7cf6f.png" width="660" />
  </figure>
  <p id="Hp06">Основной список команд можно получить  у бота в чате:<br />/help -  покажет команды на настоящий момент</p>
  <p id="pWmM"></p>
  <p id="eSAu">Также вы можете добавить свои команду непосредственно в bot.py и перезапустить сервис (<code>systemctl restart telegram-bot.service)</code></p>
  <p id="cJZX">По мере добавления разных фич -  гайт будет обновляться ( очень хочется сократить</p>
  <p id="PH8E">P.s. я не профессиональный прогер, адекватная критика не возбраняется (<a href="https://github.com/mrShakedown/subspace-bot" target="_blank">fork it</a>)</p>

]]></content:encoded></item></channel></rss>