<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title>Mikrotik.moscow [тема: Отправка почты при сбое BGP. Ошибка скрипта.]</title>
		<link>http://mikrotik.moscow</link>
		<description>Новое в теме Отправка почты при сбое BGP. Ошибка скрипта. форума RouterOS на сайте Mikrotik.moscow [mikrotik.moscow]</description>
		<language>ru</language>
		<docs>http://backend.userland.com/rss2</docs>
		<pubDate>Wed, 15 Jul 2026 00:33:11 -0400</pubDate>
		<item>
			<title>Отправка почты при сбое BGP. Ошибка скрипта.</title>
			<description><![CDATA[<b><a href="http://mikrotik.moscow/forum/forum57/87752-otpravka-pochty-pri-sboe-bgp.-oshibka-skripta./message420057">Отправка почты при сбое BGP. Ошибка скрипта.</a></b> <i>RouterOS</i> в форуме <a href="http://mikrotik.moscow/forum/forum57/">RouterOS</a>. <br />
			Здравствуйте, может кто-нибудь подсказать решение: я использую этот скрипт, и он отправляет предупреждения на электронную почту; время от времени у меня сбиваются BGP-сессии, и в таких случаях мне приходится вручную отключать и включать BGP-пира, чтобы восстановить сессию; хотелось бы, чтобы этот скрипт автоматически выключал и включал пира при обнаружении разрыва BGP-сессии; есть какие-нибудь предложения? Заранее спасибо за помощь. Даниэль <br />
			<i>11.09.2023 07:32:00, ditud.</i>]]></description>
			<link>http://mikrotik.moscow/forum/forum57/87752-otpravka-pochty-pri-sboe-bgp.-oshibka-skripta./message420057</link>
			<guid>http://mikrotik.moscow/forum/forum57/87752-otpravka-pochty-pri-sboe-bgp.-oshibka-skripta./message420057</guid>
			<pubDate>Mon, 11 Sep 2023 07:32:00 -0400</pubDate>
			<category>RouterOS</category>
		</item>
		<item>
			<title>Отправка почты при сбое BGP. Ошибка скрипта.</title>
			<description><![CDATA[<b><a href="http://mikrotik.moscow/forum/forum57/87752-otpravka-pochty-pri-sboe-bgp.-oshibka-skripta./message420056">Отправка почты при сбое BGP. Ошибка скрипта.</a></b> <i>RouterOS</i> в форуме <a href="http://mikrotik.moscow/forum/forum57/">RouterOS</a>. <br />
			Я написал небольшую программу на Python, которая запускается прямо на роутере с моего хоста для мониторинга. Она также уведомит вас, если сессия указана в /routing/bgp/connection, но при этом не отображается в /routing/bgp/sessions, а ещё покажет сессии, которые в /routing/bgp/sessions не установлены. <noindex><a href="https://github.com/edgenative/mikrotik-bgpmon" target="_blank" rel="nofollow" >https://github.com/edgenative/mikrotik-bgpmon</a></noindex> <br />
			<i>19.06.2023 04:39:00, kerfuffle.</i>]]></description>
			<link>http://mikrotik.moscow/forum/forum57/87752-otpravka-pochty-pri-sboe-bgp.-oshibka-skripta./message420056</link>
			<guid>http://mikrotik.moscow/forum/forum57/87752-otpravka-pochty-pri-sboe-bgp.-oshibka-skripta./message420056</guid>
			<pubDate>Mon, 19 Jun 2023 04:39:00 -0400</pubDate>
			<category>RouterOS</category>
		</item>
		<item>
			<title>Отправка почты при сбое BGP. Ошибка скрипта.</title>
			<description><![CDATA[<b><a href="http://mikrotik.moscow/forum/forum57/87752-otpravka-pochty-pri-sboe-bgp.-oshibka-skripta./message420055">Отправка почты при сбое BGP. Ошибка скрипта.</a></b> <i>RouterOS</i> в форуме <a href="http://mikrotik.moscow/forum/forum57/">RouterOS</a>. <br />
			Привет, я тоже ищу похожий скрипт для V7. <br />
			<i>29.05.2023 13:58:00, chubbs596.</i>]]></description>
			<link>http://mikrotik.moscow/forum/forum57/87752-otpravka-pochty-pri-sboe-bgp.-oshibka-skripta./message420055</link>
			<guid>http://mikrotik.moscow/forum/forum57/87752-otpravka-pochty-pri-sboe-bgp.-oshibka-skripta./message420055</guid>
			<pubDate>Mon, 29 May 2023 13:58:00 -0400</pubDate>
			<category>RouterOS</category>
		</item>
		<item>
			<title>Отправка почты при сбое BGP. Ошибка скрипта.</title>
			<description><![CDATA[<b><a href="http://mikrotik.moscow/forum/forum57/87752-otpravka-pochty-pri-sboe-bgp.-oshibka-skripta./message420054">Отправка почты при сбое BGP. Ошибка скрипта.</a></b> <i>RouterOS</i> в форуме <a href="http://mikrotik.moscow/forum/forum57/">RouterOS</a>. <br />
			Привет, есть у кого-нибудь скрипт ошибки BGP is down для версии v7? <br />
			<i>26.03.2023 17:01:00, deanp.</i>]]></description>
			<link>http://mikrotik.moscow/forum/forum57/87752-otpravka-pochty-pri-sboe-bgp.-oshibka-skripta./message420054</link>
			<guid>http://mikrotik.moscow/forum/forum57/87752-otpravka-pochty-pri-sboe-bgp.-oshibka-skripta./message420054</guid>
			<pubDate>Sun, 26 Mar 2023 17:01:00 -0400</pubDate>
			<category>RouterOS</category>
		</item>
		<item>
			<title>Отправка почты при сбое BGP. Ошибка скрипта.</title>
			<description><![CDATA[<b><a href="http://mikrotik.moscow/forum/forum57/87752-otpravka-pochty-pri-sboe-bgp.-oshibka-skripta./message420053">Отправка почты при сбое BGP. Ошибка скрипта.</a></b> <i>RouterOS</i> в форуме <a href="http://mikrotik.moscow/forum/forum57/">RouterOS</a>. <br />
			Привет! Твой скрипт сработал у меня идеально, единственное, что я изменил: &nbsp;<br />Send Email /tool e-mail send to=$mailToX subject=$mailSubjectX body=$mailBodyX start-tls=yes; &nbsp;<br />на &nbsp;<br />Send Email /tool e-mail send to=$mailToX subject=$mailSubjectX body=$mailBodyX start-tls=tls-only; <br />
			<i>17.11.2020 19:27:00, deanp.</i>]]></description>
			<link>http://mikrotik.moscow/forum/forum57/87752-otpravka-pochty-pri-sboe-bgp.-oshibka-skripta./message420053</link>
			<guid>http://mikrotik.moscow/forum/forum57/87752-otpravka-pochty-pri-sboe-bgp.-oshibka-skripta./message420053</guid>
			<pubDate>Tue, 17 Nov 2020 19:27:00 -0500</pubDate>
			<category>RouterOS</category>
		</item>
		<item>
			<title>Отправка почты при сбое BGP. Ошибка скрипта.</title>
			<description><![CDATA[<b><a href="http://mikrotik.moscow/forum/forum57/87752-otpravka-pochty-pri-sboe-bgp.-oshibka-skripta./message420052">Отправка почты при сбое BGP. Ошибка скрипта.</a></b> <i>RouterOS</i> в форуме <a href="http://mikrotik.moscow/forum/forum57/">RouterOS</a>. <br />
			Здравствуйте, недавно я внедрил скрипт (нашёл в интернете) для мониторинга BGP-пиров, чтобы при падении одного из них получать уведомление на почту. Проблема в том, что скрипт, похоже, не работает (не отправляет письма). Почтовый инструмент настроен и работает, если отправлять письма вручную. Ниже сам скрипт:<br /><br /># EDIT HERE &nbsp;<br />:local arrEmails [:toarray "mail@mail.com"];  <br />:local debug false &nbsp;<br /># EDIT END &nbsp;<br /><br /># Определение переменных &nbsp;<br />:global arrBgpState; &nbsp;<br />:global gotKey false; &nbsp;<br />:local hostNameX ([/system identity get name]);  <br />:local statusX; &nbsp;<br />:local peerX; &nbsp;<br />:local peerXarrEl; &nbsp;<br />:local mailToX; &nbsp;<br />:local mailSubjectX; &nbsp;<br />:local mailBodyX; &nbsp;<br />:local peerStatusX; &nbsp;<br />:local arrBgpPeers [:toarray ""];  <br />:local peername ""; &nbsp;<br />:local peerTotal ""; &nbsp;<br /><br />if ($debug = true) do={ &nbsp;<br /> &nbsp; :log info ("=============НАЧАЛО ПРОВЕРКИ СТАТУСА BGP ПИРОВ=============" ) &nbsp;<br />} &nbsp;<br /><br /># Инициализация глобального массива — немного корявая реализация :P &nbsp;<br />:if ( [:len $arrBgpState] =0 ) do={  <br /> &nbsp; :set $arrBgpState {"false"="false"} &nbsp;<br />} &nbsp;<br /><br /># Заполнение массива arrBgpPeers именами пиров &nbsp;<br />:foreach i in=[/routing bgp peer find] do={  <br />:set peername [/routing bgp peer get $i name];  <br />:set peerTotal ($peerTotal . "," .$peername); &nbsp;<br />} &nbsp;<br />:set arrBgpPeers [:toarray $peerTotal];  <br /><br /># Цикл по массиву пирингов &nbsp;<br />:local arrPos &nbsp;<br />:for arrPos from=0 to=([:len $arrBgpPeers]-1) do={  <br /><br /> &nbsp; # Устанавливаем peerX в текущее имя пира &nbsp;<br /> &nbsp; :set peerX [:pick $arrBgpPeers $arrPos];  <br /><br /> &nbsp; # Проверяем, включен ли пир, и идём дальше &nbsp;<br /> &nbsp; :if ([/routing bgp peer get [find name=$peerX] disabled ] != true) do={  <br /> &nbsp; &nbsp; &nbsp;<br /> &nbsp; &nbsp; &nbsp;# Получаем статус пира &nbsp;<br /> &nbsp; &nbsp; &nbsp;:set peerStatusX [/routing bgp peer get [find name="$peerX"] state]  <br /><br /> &nbsp; &nbsp; &nbsp;# Ищем ключ пира в глобальном массиве &nbsp;<br /> &nbsp; &nbsp; &nbsp;:foreach k,v in=$arrBgpState do={ &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; if ($k != "false") do={ &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;:if ($gotKey = false) do={ &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; :if ($k = $peerX) do={ &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;:set gotKey true &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;} &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp;<br /> &nbsp; &nbsp; &nbsp;} &nbsp;<br /> &nbsp; &nbsp; &nbsp;<br /> &nbsp; &nbsp; &nbsp;# Инициализируем элемент массива arrBgpState с именем пира, если его ещё нет &nbsp;<br /> &nbsp; &nbsp; &nbsp;:if ($gotKey = false) do={ &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; :set ($arrBgpState-&gt;"$peerX") "up" &nbsp;<br /> &nbsp; &nbsp; &nbsp;} &nbsp;<br /> &nbsp; &nbsp; &nbsp;<br /> &nbsp; &nbsp; &nbsp;# Сбрасываем флаг для следующей итерации &nbsp;<br /> &nbsp; &nbsp; &nbsp;:set gotKey false &nbsp; <br /> &nbsp; &nbsp; &nbsp;<br /> &nbsp; &nbsp; &nbsp;# Предыдущий статус пира &nbsp;<br /> &nbsp; &nbsp; &nbsp;:set statusX ($arrBgpState-&gt;"$peerX") &nbsp;<br /> &nbsp; &nbsp; &nbsp;<br /> &nbsp; &nbsp; &nbsp;# Формируем тело письма &nbsp;<br /> &nbsp; &nbsp; &nbsp;:set mailBodyX ("Имя маршрутизатора: " . $hostNameX . "\nСтатус BGP-пира: " . $peerStatusX . "\nИмя BGP-пира: " . $peerX . "\n"); &nbsp;<br /> &nbsp; &nbsp; &nbsp;<br /> &nbsp; &nbsp; &nbsp;# Проверяем, не установлен ли пир &nbsp;<br /> &nbsp; &nbsp; &nbsp;:if ($peerStatusX != "established") do={ &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# Проверяем, первый ли раз пир упал &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;:if ( $statusX &nbsp;= "up" ) do={ &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# Ставим статус 'down' для глобальной переменной пира &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;:set ($arrBgpState-&gt;$peerX) "down" &nbsp;<br /><br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# Лог для отладки &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if ($debug = true) do={ &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; :log error ("Статус BGP-пира ". $peerX ." — " . $peerStatusX . ". Отправляю уведомление по почте!") &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;} &nbsp;<br /><br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# Тема письма &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;:set mailSubjectX ("BGP-пир ". $peerX ." на ". $hostNameX . " НЕ установлен!"); &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# Цикл по массиву email для отправки всем получателям &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;:local arrPos2 &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;:for arrPos2 from=0 to=([:len $arrEmails]-1) do={  <br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; :set mailToX [:pick $arrEmails $arrPos2]  <br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; :log error ("Статус BGP-пира " . $peerX . " — " .$peerStatusX. "! Отправка Email уведомления на " . $mailToX . "." ) &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /tool e-mail send to=$mailToX subject=$mailSubjectX body=$mailBodyX start-tls=yes; &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;} &nbsp; &nbsp; &nbsp; &nbsp;<br /><br /> &nbsp; &nbsp; &nbsp; &nbsp; } else={ &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# Пир уже падает, уведомление отправлено — пропускаем &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if ($debug = true) do={ &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; :log info ("BGP-пир ". $peerX ." уже не работает. Игнорирую!") &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;} &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp;<br /><br /> &nbsp; &nbsp; &nbsp;} else={ &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; <br /> &nbsp; &nbsp; &nbsp; &nbsp; # Проверяем, если пир только что восстановился, отправляем уведомление &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; if ($statusX = "down") do={ &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;:set mailSubjectX ("BGP-пир ". $peerX ." на ". $hostNameX . " восстановился!"); &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;:local arrPos2 &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;:for arrPos2 from=0 to=([:len $arrEmails]-1) do={  <br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; :set mailToX [:pick $arrEmails $arrPos2]  <br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; :log warning ("Статус BGP-пира " . $peerX . " восстановился! Отправляю информирующее письмо на " . $mailToX . "." ) &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /tool e-mail send to=$mailToX subject=$mailSubjectX body=$mailBodyX start-tls=yes; &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; <br /> &nbsp; &nbsp; &nbsp; &nbsp; if ($debug = true) do={ &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;:log info ("BGP-пир " . $peerX . " работает. Делать ничего не надо!") &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; <br /> &nbsp; &nbsp; &nbsp; &nbsp; # Устанавливаем статус пира в up &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; :set ($arrBgpState-&gt;$peerX) "up" &nbsp;<br /> &nbsp; &nbsp; &nbsp;} &nbsp; &nbsp; &nbsp;<br /> &nbsp; &nbsp; &nbsp;<br /> &nbsp; } else={ &nbsp;<br /> &nbsp; &nbsp; &nbsp;if ($debug = true) do={ &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; :log warning ("BGP-пир " . $peerX . " отключён. Пропускаю!") &nbsp;<br /> &nbsp; &nbsp; &nbsp;} &nbsp;<br /> &nbsp; } &nbsp; <br /> &nbsp; &nbsp; &nbsp;<br />} &nbsp;<br /><br />if ($debug = true) do={ &nbsp;<br /> &nbsp; :log info ("==============КОНЕЦ ПРОВЕРКИ СТАТУСА BGP ПИРОВ===============" ) &nbsp;<br />} &nbsp;<br /><br />В логах выскакивает такая ошибка: &nbsp;<br />Topics script error &nbsp;<br />Message: BGP Peer status is idle! Sending Email alert to &gt; mail@mail.com &gt; .<br /><br />Кто-нибудь может помочь разобраться, в чём проблема? &nbsp;<br />Модель роутера: CCR1072-1G-8S+ &nbsp;<br />Версия RouterOS: 6.39.2 <br />
			<i>26.03.2018 12:34:00, operat0r.</i>]]></description>
			<link>http://mikrotik.moscow/forum/forum57/87752-otpravka-pochty-pri-sboe-bgp.-oshibka-skripta./message420052</link>
			<guid>http://mikrotik.moscow/forum/forum57/87752-otpravka-pochty-pri-sboe-bgp.-oshibka-skripta./message420052</guid>
			<pubDate>Mon, 26 Mar 2018 12:34:00 -0400</pubDate>
			<category>RouterOS</category>
		</item>
	</channel>
</rss>
