feat(observability): add Prometheus/Grafana/Loki/Alertmanager/Alloy stack and remove legacy Monitoring UI
This commit is contained in:
+13
-54
@@ -10,12 +10,7 @@ import type {
|
||||
UserMessageResponse,
|
||||
UserMessageQueueStatus,
|
||||
NowPlayingSession,
|
||||
MonitoringPollerStatus,
|
||||
MonitoringOverviewResponse,
|
||||
AppVersionInfo,
|
||||
MonitoringStatus,
|
||||
MonitoringMetrics,
|
||||
DiskSpace,
|
||||
SSHKey,
|
||||
SSHKeyInput,
|
||||
SSHKeyGenerated,
|
||||
@@ -24,7 +19,6 @@ import type {
|
||||
SavedTaskRun,
|
||||
MonitoringMachine,
|
||||
MonitoringMachineInput,
|
||||
MonitoringMachineAction,
|
||||
MediaIndexStatus,
|
||||
MediaIndexActionResponse,
|
||||
MediaQueryResponse,
|
||||
@@ -37,6 +31,9 @@ import type {
|
||||
SSHValidationResult,
|
||||
DashboardShortcut,
|
||||
DashboardShortcutInput,
|
||||
AlertmanagerAlertSummary,
|
||||
AlertmanagerStatus,
|
||||
PrometheusTarget,
|
||||
} from "../types";
|
||||
|
||||
const BASE_URL = import.meta.env.VITE_API_URL || "/api";
|
||||
@@ -165,11 +162,7 @@ export const fetchNowPlaying = fetchActivity;
|
||||
// Monitoring
|
||||
export const fetchMonitoringMachines = () =>
|
||||
get<MonitoringMachine[]>("/api/monitoring/machines");
|
||||
export const fetchMonitoringPoller = () =>
|
||||
get<MonitoringPollerStatus>("/api/monitoring/poller");
|
||||
export const fetchAppVersion = () => get<AppVersionInfo>("/api/version");
|
||||
export const fetchMonitoringOverview = () =>
|
||||
get<MonitoringOverviewResponse>("/api/dashboard/monitoring");
|
||||
export const fetchDashboardShortcuts = () =>
|
||||
get<DashboardShortcut[]>("/api/dashboard/shortcuts");
|
||||
export const saveDashboardShortcut = (shortcut: DashboardShortcutInput) =>
|
||||
@@ -194,45 +187,6 @@ export const deleteDashboardShortcut = (shortcutId: string) =>
|
||||
del<{ status: string }>(
|
||||
`/api/dashboard/shortcuts/${encodeURIComponent(shortcutId)}`,
|
||||
);
|
||||
export const fetchMonitoringStatus = (machineId?: string) =>
|
||||
get<MonitoringStatus>(
|
||||
"/api/monitoring/status",
|
||||
machineId ? { machine_id: machineId } : undefined,
|
||||
);
|
||||
export const fetchMonitoringMetrics = (
|
||||
lastSeconds?: number | null,
|
||||
maxLines = 70_000,
|
||||
machineId?: string,
|
||||
) =>
|
||||
get<MonitoringMetrics>("/api/monitoring/metrics", {
|
||||
...(lastSeconds == null ? {} : { last_seconds: String(lastSeconds) }),
|
||||
max_lines: String(maxLines),
|
||||
...(machineId ? { machine_id: machineId } : {}),
|
||||
});
|
||||
export const fetchDiskSpace = (machineId?: string) =>
|
||||
get<DiskSpace>(
|
||||
"/api/monitoring/disk",
|
||||
machineId ? { machine_id: machineId } : undefined,
|
||||
);
|
||||
export const startCollector = (machineId?: string) =>
|
||||
post<{ message: string }>(
|
||||
machineId
|
||||
? `/api/monitoring/start?machine_id=${encodeURIComponent(machineId)}`
|
||||
: "/api/monitoring/start",
|
||||
);
|
||||
export const stopCollector = (machineId?: string) =>
|
||||
post<{ message: string }>(
|
||||
machineId
|
||||
? `/api/monitoring/stop?machine_id=${encodeURIComponent(machineId)}`
|
||||
: "/api/monitoring/stop",
|
||||
);
|
||||
export const restartCollector = (machineId?: string) =>
|
||||
post<{ message: string }>(
|
||||
machineId
|
||||
? `/api/monitoring/restart?machine_id=${encodeURIComponent(machineId)}`
|
||||
: "/api/monitoring/restart",
|
||||
);
|
||||
|
||||
export const fetchMonitoringSettings = () =>
|
||||
get<MonitoringMachine[]>("/api/settings/machines");
|
||||
export const fetchSSHKeys = () => get<SSHKey[]>("/api/settings/ssh-keys");
|
||||
@@ -242,11 +196,6 @@ export const generateSSHKey = (payload: {
|
||||
notes: string;
|
||||
bits?: number;
|
||||
}) => post<SSHKeyGenerated>("/api/settings/ssh-keys/generate", payload);
|
||||
export const fetchMonitoringMachineActions = (machineId: string, limit = 10) =>
|
||||
get<{ items: MonitoringMachineAction[]; total: number }>(
|
||||
`/api/monitoring/machines/${encodeURIComponent(machineId)}/actions`,
|
||||
{ limit: String(limit) },
|
||||
);
|
||||
export const saveSSHKey = (key: SSHKeyInput) =>
|
||||
fetch(
|
||||
buildUrl(
|
||||
@@ -428,3 +377,13 @@ export const fetchUserMessageQueueStatus = () =>
|
||||
|
||||
export const sendUserMessage = (formData: FormData) =>
|
||||
postForm<UserMessageResponse>("/api/users/message", formData);
|
||||
|
||||
// Observability summary endpoints
|
||||
export const fetchAlertmanagerAlerts = () =>
|
||||
get<AlertmanagerAlertSummary>("/api/monitoring/alerts");
|
||||
|
||||
export const fetchAlertmanagerStatus = () =>
|
||||
get<AlertmanagerStatus>("/api/monitoring/alertmanager-status");
|
||||
|
||||
export const fetchPrometheusTargets = () =>
|
||||
get<PrometheusTarget[]>("/api/monitoring/prometheus-targets");
|
||||
|
||||
Reference in New Issue
Block a user