feat: agent updates from SAC, poll config, SSH/WinRM fallback (0.12.0)
Add agent update settings, pending self-update via poll, desired config per host, and automatic or manual SSH/WinRM fallback when agents do not report agent.update events.
This commit is contained in:
@@ -230,6 +230,8 @@ export interface HostSummary {
|
||||
last_daily_report_at: string | null;
|
||||
last_inventory_at?: string | null;
|
||||
agent_status: "online" | "stale" | "unknown";
|
||||
version_status?: "ok" | "outdated" | "unknown";
|
||||
pending_agent_update?: boolean;
|
||||
ssh_admin_ok?: boolean | null;
|
||||
ssh_admin_checked_at?: string | null;
|
||||
}
|
||||
@@ -242,6 +244,13 @@ export interface HostDetail extends HostSummary {
|
||||
inventory: Record<string, unknown> | null;
|
||||
inventory_updated_at: string | null;
|
||||
created_at: string | null;
|
||||
pending_update_requested_at?: string | null;
|
||||
pending_update_target_version?: string | null;
|
||||
agent_config_revision?: number;
|
||||
agent_config?: Record<string, unknown> | null;
|
||||
agent_update_state?: string | null;
|
||||
agent_update_last_at?: string | null;
|
||||
agent_update_last_error?: string | null;
|
||||
}
|
||||
|
||||
export function fetchHost(id: number): Promise<HostDetail> {
|
||||
@@ -495,6 +504,66 @@ export function updateHostAgentViaSsh(hostId: number): Promise<HostSshActionResu
|
||||
});
|
||||
}
|
||||
|
||||
export interface HostAgentUpdateRequestResult {
|
||||
status: string;
|
||||
pending_agent_update: boolean;
|
||||
target_version: string | null;
|
||||
agent_update_state: string | null;
|
||||
}
|
||||
|
||||
export function requestHostAgentUpdate(hostId: number): Promise<HostAgentUpdateRequestResult> {
|
||||
return apiFetch<HostAgentUpdateRequestResult>(
|
||||
`/api/v1/hosts/${hostId}/actions/request-agent-update`,
|
||||
{ method: "POST" },
|
||||
);
|
||||
}
|
||||
|
||||
export function runHostAgentUpdateFallback(hostId: number): Promise<HostSshActionResult> {
|
||||
return apiFetch<HostSshActionResult>(`/api/v1/hosts/${hostId}/actions/agent-update-fallback`, {
|
||||
method: "POST",
|
||||
});
|
||||
}
|
||||
|
||||
export interface HostAgentConfigResponse {
|
||||
config_revision: number;
|
||||
settings: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export function patchHostAgentConfig(
|
||||
hostId: number,
|
||||
settings: Record<string, unknown>,
|
||||
): Promise<HostAgentConfigResponse> {
|
||||
return apiFetch<HostAgentConfigResponse>(`/api/v1/hosts/${hostId}/agent-config`, {
|
||||
method: "PATCH",
|
||||
body: JSON.stringify({ settings }),
|
||||
});
|
||||
}
|
||||
|
||||
export interface AgentUpdateSettings {
|
||||
mode: "gpo" | "sac";
|
||||
fallback_enabled: boolean;
|
||||
fallback_after_minutes: number;
|
||||
recommended_rdp_version: string | null;
|
||||
recommended_ssh_version: string | null;
|
||||
min_rdp_version: string | null;
|
||||
min_ssh_version: string | null;
|
||||
win_agent_update_script: string | null;
|
||||
source: string;
|
||||
}
|
||||
|
||||
export function fetchAgentUpdateSettings(): Promise<AgentUpdateSettings> {
|
||||
return apiFetch<AgentUpdateSettings>("/api/v1/settings/agent-updates");
|
||||
}
|
||||
|
||||
export function saveAgentUpdateSettings(
|
||||
payload: Partial<AgentUpdateSettings>,
|
||||
): Promise<AgentUpdateSettings> {
|
||||
return apiFetch<AgentUpdateSettings>("/api/v1/settings/agent-updates", {
|
||||
method: "PUT",
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
}
|
||||
|
||||
export interface DashboardSummary {
|
||||
events_last_24h: number;
|
||||
hosts_total: number;
|
||||
|
||||
Reference in New Issue
Block a user