diff --git a/README.md b/README.md index 4f12c6c..fb00766 100644 --- a/README.md +++ b/README.md @@ -37,3 +37,21 @@ sudo dpkg -i rkn-check.deb * ``failure`` — Ресурс успешно блокируется, произошла ошибка TCP * ``local-ip`` — Ресурс резолвится в локальный IP * ``available`` — Ресурс **не блокируется** + + +## Telegram + +* Adjust string 202 of ``/usr/bin/rkn-check.py`` with your bot-ID and chat_ID + +``` +202 cmdstring = "/usr/bin/curl -s -d \"chat_id=-10CHAT-ID57&disable_web_page_preview=1&text=Checked %d, errors: %d\"" % (total_count, available_count) + " https://api.telegram.org/bot36BOT-ID8:AAEBOT-ID9Ksl-6ABOT-IDY0/sendMessage" +203 +204 print (cmdstring) +205 +206 os.system( cmdstring ) + +``` + +* ``GET handy tg output as`` - **Checked 121040, errors: 0** + + diff --git a/rkn-check/usr/bin/rkn-check.py b/rkn-check/usr/bin/rkn-check.py index e97e54f..c7ca3ce 100755 --- a/rkn-check/usr/bin/rkn-check.py +++ b/rkn-check/usr/bin/rkn-check.py @@ -7,6 +7,8 @@ # Сторонние пакеты import requests from lxml import etree +import os +from subprocess import call # Наш конфигурационный файл sys.path.append('/etc/roskom') @@ -190,3 +192,9 @@ def parse_registry(filename): f.write("%s <%d>\n" % (link['url'], link['checked'])) print("---\nCheck finished in %dm:%.2fs using %d kb RES\nAvailable: %d, not available: %d" % (execution_minutes, execution_seconds, stat.ru_maxrss, available_count, total_count - available_count)) + +cmdstring = "/usr/bin/curl -s -d \"chat_id=-100YOUR-CHAT-ID357&disable_web_page_preview=1&text=Checked %d, errors: %d\"" % (total_count, available_count) + " https://api.telegram.org/bot36YOUR-BOT-ID18:YOUR-BOT-IDsl-6BOT-IDY0/sendMessage" + +print (cmdstring) + +os.system( cmdstring )