Files
MikrotikManager/lib/scheduler-settings.ts
T
Denozordec b9a75b6831 feat: implement internet path functionality with backend support
Added internet path settings and snapshot management to the application. This includes new database tables for internet path settings and snapshots, API routes for fetching and managing internet path data, and integration into the dashboard and data collection pages. Enhanced the scheduler to support internet path jobs, ensuring regular data collection and updates. Updated relevant types and interfaces to accommodate the new functionality.
2026-05-08 00:40:41 +07:00

87 lines
3.3 KiB
TypeScript

/** Типы и подписи для UI планировщика / страницы «Сбор данных» (совпадают с ответами API). */
/** Последний ключ — движок оповещений (читает БД после коллекторов; см. описание `alert_engine`). */
export const SCHEDULER_JOB_KEYS = [
"traffic",
"servers_rest_ping",
"uptime_resources",
"uptime_ping",
"uptime_speed",
"internet_path",
"gre_bgp",
"alert_engine",
] as const
export type SchedulerJobKey = (typeof SCHEDULER_JOB_KEYS)[number]
export const SCHEDULER_JOB_LABELS: Record<string, string> = {
traffic: "Трафик",
servers_rest_ping: "Серверы: REST API",
uptime_resources: "Uptime: ресурсы",
uptime_ping: "Uptime: ping",
uptime_speed: "Uptime: speed",
internet_path: "Internet Path",
gre_bgp: "GRE + BGP",
alert_engine: "Оповещения",
}
/** Кратко — для раскрытой карточки прогона и подсказок. */
export const SCHEDULER_JOB_DESCRIPTIONS: Record<string, string> = {
traffic: "Опрос интерфейсов RouterOS, запись сэмплов трафика в SQLite.",
servers_rest_ping:
"Проверка доступности каталога серверов: GET /system/identity (RouterOS REST), замер задержки без полного опроса.",
uptime_resources: "CPU, память, температура и др. метрики с устройств.",
uptime_ping: "ICMP-пинг по настроенным пробам мониторинга.",
uptime_speed: "Фоновые btest / speed-пробы между узлами (при включённых пробах).",
internet_path: "Снимок данных для карты интернет-маршрута на dashboard (WAN/JH/EN, route+runtime, speed-пробы).",
gre_bgp:
"Опрос GRE-туннелей и BGP-сессий на включённых серверах, запись сэмплов в SQLite для движка оповещений.",
alert_engine:
"Оценка правил по данным из SQLite (сэмплы пишут джобы сбора, в т.ч. «GRE + BGP» и «Серверы: REST API»).",
}
export interface CollectorSettingsDto {
enabled: boolean
intervalSec: number
probeIntervalSec?: number
speedIntervalSec?: number
retentionDays: number
lastCollectedAt: string | null
lastDurationMs: number | null
lastError: string | null
collectorRunning?: boolean
}
export interface SchedulerJobStatusDto {
jobKey: string
enabled: boolean
intervalSec: number
running: boolean
lastFinishedAt: string | null
lastStatus: string | null
lastDurationMs: number | null
lastError: string | null
}
export interface SchedulerStatusDto {
jobs: SchedulerJobStatusDto[]
}
export interface UptimeSettingsDto extends CollectorSettingsDto {
resourcesEnabled?: boolean
pingEnabled?: boolean
speedEnabled?: boolean
scheduler?: SchedulerStatusDto
}
export interface SchedulerRunRowDto {
id: string
jobKey: string
startedAt: string
finishedAt: string
status: string
error: string | null
durationMs: number
/** JSON снимка результатов прогона (серверы, пробы, speed и т.д.) */
resultJson?: string | null
}