build: добавлен pyproject.toml и Makefile, обновлены шаблоны
This commit is contained in:
+10
-1
@@ -1 +1,10 @@
|
||||
VIRTFUSION_TOKEN=your_token_here
|
||||
# Токен доступа к API VirtFusion (передается в заголовке Authorization: Bearer <TOKEN>)
|
||||
VIRTFUSION_TOKEN=your_virtfusion_token_here
|
||||
|
||||
# Токен Telegram-бота, полученный от @BotFather
|
||||
TELEGRAM_BOT_TOKEN=123456789:ABCdefGhIJKlmNoPQRsTUVwxyZ
|
||||
|
||||
# ID чата или канала для отправки уведомлений
|
||||
# Для персонального чата: 123456789
|
||||
# Для публичного/приватного канала: -1001234567890 (обязательно с префиксом -100)
|
||||
TELEGRAM_CHAT_ID=-1001234567890
|
||||
@@ -222,3 +222,4 @@ __marimo__/
|
||||
|
||||
# This
|
||||
config.json
|
||||
state.json
|
||||
@@ -0,0 +1,11 @@
|
||||
.PHONY: install-deps build clean
|
||||
|
||||
install-deps:
|
||||
echo "Проверка и установка зависимостей для сборки deb-пакета..."
|
||||
sudo apt update && sudo apt install -y debhelper dh-python pybuild-plugin-pyproject python3-build python3-all python3-setuptools build-essential devscripts
|
||||
|
||||
build: install-deps
|
||||
dpkg-buildpackage -us -uc -b
|
||||
|
||||
clean:
|
||||
debian/rules clean
|
||||
+13
-6
@@ -1,14 +1,21 @@
|
||||
{
|
||||
"_comment": "Конфигурационный файл локально хранится в корне проекта (./config.json), а на сервере — в /etc/traffic-checker/config.json",
|
||||
"thresholds": {
|
||||
"warning_percents": [
|
||||
80.0,
|
||||
90.0
|
||||
]
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"uuid": "00000000-0000-0000-0000-000000000000",
|
||||
"target": "Target name from xray-manager",
|
||||
"pretty_name": "Pretty name from xray-manager"
|
||||
"uuid": "11111111-2222-4333-8444-555555555555",
|
||||
"target": "nl1",
|
||||
"pretty_name": "🇳🇱 Netherlands #1"
|
||||
},
|
||||
{
|
||||
"uuid": "11111111-1111-1111-1111-111111111111",
|
||||
"target": "Target name from xray-manager",
|
||||
"pretty_name": "Pretty name from xray-manager"
|
||||
"uuid": "a1b2c3d4-e5f6-4a5b-8c9d-0e1f2a3b4c5d",
|
||||
"target": "de1",
|
||||
"pretty_name": "🇩🇪 Germany #1"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
[build-system]
|
||||
requires = ["setuptools>=61.0"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "traffic-checker"
|
||||
version = "0.1"
|
||||
description = "Traffic consumption monitoring CLI tool for remote servers with automated alerting"
|
||||
requires-python = ">=3.11"
|
||||
authors = [
|
||||
{ name = "Vladimir Khvan", email = "thisisnotablownfuse@gmail.com" }
|
||||
]
|
||||
classifiers = [
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.11",
|
||||
"Operating System :: POSIX :: Linux",
|
||||
]
|
||||
dependencies = [
|
||||
"requests>=2.32.3",
|
||||
]
|
||||
|
||||
[project.scripts]
|
||||
traffic-checker = "traffic_checker.main:main"
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
where = ["src"]
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"_comment": "Файл состояния локально хранится в корне проекта (./state.json), а на сервере — в /var/lib/traffic-checker/state.json",
|
||||
"11111111-2222-4333-8444-555555555555": {
|
||||
"last_threshold": 80.0,
|
||||
"is_critical": false,
|
||||
"period_reset": "2026-08-26T03:00:00+03:00"
|
||||
},
|
||||
"a1b2c3d4-e5f6-4a5b-8c9d-0e1f2a3b4c5d": {
|
||||
"last_threshold": 100.0,
|
||||
"is_critical": true,
|
||||
"period_reset": "2026-08-03T03:00:00+03:00"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user