Monitoring & alerts tools

These tools give an AI client access to a server’s real-time performance metrics and the alert rules that watch them. They cover requests like “how loaded is web-01 right now,” “which server is using the most disk I/O,” or “set up an alert for high memory usage on the database servers.”

Note

All tools accept workspace (required) and region (optional, defaults to the configured region). These common parameters are omitted from the tables below.

Summary

ToolDescriptionAccess
get_cpu_usageCPU utilization statistics for a serverRead-only
get_memory_usageMemory utilization statistics for a serverRead-only
get_disk_usageDisk space usage for a device or partitionRead-only
get_disk_ioDisk read/write throughput for a serverRead-only
get_network_trafficNetwork bandwidth and packet rates for a serverRead-only
get_top_serversTop 5 servers ranked by resource usageRead-only
get_server_metrics_summaryCombined CPU, memory, disk, and network overview for a serverRead-only
list_latest_metricsLatest CPU, memory, disk, and network reading for every serverRead-only
list_alertsTriggered alerts, with filteringRead-only
get_alertFull detail for a single alertRead-only
acknowledge_alertMark an alert as checked or dismissedIdempotent write
get_alert_rulesConfigured alert rules and thresholdsRead-only
create_alert_ruleCreate a new alert ruleAdditive
update_alert_ruleModify an existing alert ruleIdempotent write
delete_alert_rulePermanently delete an alert ruleDestructive
attach_alert_ruleAttach an existing rule to a serverIdempotent write
detach_alert_ruleDetach a rule from a serverIdempotent write
get_alert_rule_recipientsPreview who an alert rule would notify, as countsRead-only
preview_alert_ruleReplay a rule over past samples to see what it would have raisedRead-only
list_rule_overridesPer-server departures from a workspace rule, with filteringRead-only
get_rule_overrideFull detail for a single rule overrideRead-only
create_rule_overrideCreate a per-server departure from a ruleAdditive
update_rule_overrideModify an existing rule overrideIdempotent write
delete_rule_overridePermanently delete a rule overrideDestructive

Metrics

The five time-series metrics tools (get_cpu_usage, get_memory_usage, get_disk_usage, get_disk_io, get_network_traffic) all accept start_date and end_date in ISO 8601 format (e.g. 2024-01-01T00:00:00Z). When start_date is omitted, it defaults to 12 hours before the current time. That is also as far back as these tools reach: they read only the last 12 hours, so an earlier start_date still returns only the last 12 hours. Metrics are kept longer than that; these tools just don’t read further back. end_date is optional; when omitted, no end boundary is sent with the request, and the effective upper bound is determined by the API.

get_cpu_usage

Get CPU utilization metrics for a server over a time range. Returns current, average, min, and max usage percentage, along with a health status derived from the current value.

Access: Read-only

Parameters

ParameterTypeRequiredDescription
server_idstringYesServer ID to get metrics for
start_datestringNoStart of the time range, ISO 8601 (e.g. 2024-01-01T00:00:00Z). Defaults to 12 hours ago
end_datestringNoEnd of the time range, ISO 8601 (e.g. 2024-01-02T00:00:00Z)

Example

“Show me CPU usage for web-01 over the last hour”

The client resolves web-01 to a server ID and returns current, average, min, and max CPU usage with a status (idle, low, moderate, high, or critical).

get_memory_usage

Get RAM utilization metrics for a server over a time range. Returns current, average, min, and max usage percentage, along with a health status. Useful for investigating memory pressure or out-of-memory issues.

Access: Read-only

Parameters

ParameterTypeRequiredDescription
server_idstringYesServer ID to get metrics for
start_datestringNoStart of the time range, ISO 8601. Defaults to 12 hours ago
end_datestringNoEnd of the time range, ISO 8601

Example

“Is db-02 running low on memory?”

Returns memory usage statistics for the last 12 hours by default, including a status field that flags idle, low, moderate, high, or critical usage.

get_disk_usage

Get disk space usage for a server by device or partition. Returns usage percentage and total, used, and free space in human-readable units. Takes either device or partition; if neither is given, the tool automatically looks up the server’s available devices and uses the first one.

Access: Read-only

Parameters

ParameterTypeRequiredDescription
server_idstringYesServer ID to get metrics for
devicestringNoDevice path (e.g. /dev/sda1). Auto-discovered if omitted and partition is also omitted
partitionstringNoPartition ID (UUID), as listed by get_disk_info
start_datestringNoStart of the time range, ISO 8601. Defaults to 12 hours ago
end_datestringNoEnd of the time range, ISO 8601

Example

“How much disk space is left on the root partition of app-03?”

Returns current, average, min, and max usage percentage plus total/used/free space for the resolved device or partition.

get_disk_io

Get disk read/write throughput metrics for a server. Returns peak and average transfer rates per device. Useful for diagnosing storage performance bottlenecks.

Access: Read-only

Parameters

ParameterTypeRequiredDescription
server_idstringYesServer ID to get disk I/O metrics for
devicestringNoDisk device name (e.g. sda, nvme0n1)
start_datestringNoStart of the time range, ISO 8601. Defaults to 12 hours ago
end_datestringNoEnd of the time range, ISO 8601

Example

“Check disk I/O on the database server for the last hour”

Returns read/write throughput data points for the requested device and time range.

get_network_traffic

Get network bandwidth and traffic metrics for a server by interface. Returns current, average, and peak values for input/output throughput (bps) and packet rate (pps).

Access: Read-only

Parameters

ParameterTypeRequiredDescription
server_idstringYesServer ID to get metrics for
interfacestringYesInterface ID (UUID), as listed by get_network_interfaces. A name such as eth0 is refused with 400
start_datestringNoStart of the time range, ISO 8601. Defaults to 12 hours ago
end_datestringNoEnd of the time range, ISO 8601

Example

“What’s the network throughput on the load balancer’s eth0 over the last few hours?”

The agent looks up the ID of eth0 with get_network_interfaces, then calls get_network_traffic with it as interface. Returns current, average, and peak input/output bandwidth and packet rates for that interface.

get_top_servers

Get the top 5 servers in a workspace ranked by resource usage over the last 24 hours. Results are capped at 5 servers per metric type—this is not configurable. Supports querying multiple metric types in a single call.

Access: Read-only

Parameters

ParameterTypeRequiredDescription
metric_typesstringNoComma-separated metric types: cpu, memory, disk_io, traffic. Leave empty to get all four

Example

“Which servers are using the most CPU and memory right now?”

Calling with metric_types="cpu,memory" returns ranked results for both metrics in one response.

get_server_metrics_summary

Get a comprehensive monitoring overview for a single server, combining CPU, memory, disk, and network data availability into one compact response. Intended as a quick health check or a starting point before drilling into a specific metric with its dedicated tool.

Access: Read-only

Parameters

ParameterTypeRequiredDescription
server_idstringYesServer ID to get metrics for
hoursintegerNoHours of history to summarize. Default 12, which is also the cap

Example

“Give me a quick health check on web-01”

Returns a summary noting whether CPU, memory, disk, and network data are available for the requested window, with pointers to the dedicated tools for full time-series data.

list_latest_metrics

Get the latest CPU, memory, disk usage, disk I/O, and network reading for every server in the workspace in one request, one row per server, a page at a time. Use it for a fleet-wide view, such as which servers are busiest right now or which ones stopped reporting. For one server’s time series, use the dedicated metric tools above; for one server’s overview, use get_server_metrics_summary.

Note

Requires alpacon-server 2.37.0 or later.

Access: Read-only

Parameters

ParameterTypeRequiredDescription
searchstringNoFree-text search across server name, version, owner, and group name
groupsstringNoFilter by group ID(s)
tagstringNoFilter by tag, in key:value form
is_connectedbooleanNoFilter by whether the server’s agent is connected
statestringNostale returns servers with any metric overdue, including servers that store nothing at all; no_data returns only servers with nothing stored. stale includes every no_data server
orderingstringNoSort field: name, starred, sampled_at, cpu, memory, disk-usage (or disk_usage), disk-io (or disk_io), or net. Prefix with - for descending. A server with no value for the field sorts last
pageintegerNoPage number
page_sizeintegerNoItems per page, up to 100

Example

“Which servers have stopped reporting metrics?”

The agent calls list_latest_metrics with state="stale". Each row carries the server’s id, name, and is_connected, and one cell per metric (cpu, memory, disk-usage, disk-io, net) with its value, unit, sampled_at, and device, plus collected and reason, which say whether the value is missing, stale, or not collected. value, sampled_at, and device are null when nothing is stored for that metric. Servers that have never reported a metric are included too.

Alerts

Alert rules define the thresholds that generate alerts; alerts are the individual notifications those rules trigger. get_alert_rules and the CRUD tools below all operate on rules, while list_alerts, get_alert, and acknowledge_alert operate on the alerts a rule has produced. attach_alert_rule and detach_alert_rule connect a rule to the servers it watches; see Rule overrides below for tuning a rule on one server without changing it everywhere.

list_alerts

List alerts for a workspace, optionally filtered by server, alert type, severity, or server name, and by acknowledgement, dismissal, or resolution state. Without resolved, only open alerts are returned; pass resolved=true to review the resolved history instead. Each alert can carry the device and severity of the rule that raised it, and resolved_at once its condition clears.

Access: Read-only

Parameters

ParameterTypeRequiredDescription
server_idstringNoFilter by server ID
alert_typestringNoFilter by alert type (e.g. metric_threshold, server_disconnected)
severitystringNoFilter by severity: critical, warning, or info
server_namestringNoFilter by part of the server name
acknowledgedbooleanNoFilter by acknowledgement state (false returns active/unacknowledged alerts)
dismissedbooleanNoFilter by dismissed state
resolvedbooleanNoFilter by resolution state. Omitted or false, only open alerts are returned; true returns resolved alerts instead
pageintegerNoPage number
page_sizeintegerNoItems per page

Example

“Show me active alerts on the production servers”

Returns alerts filtered to acknowledged=false, so only alerts that haven’t been reviewed yet appear.

get_alert

Get full detail for a specific alert.

Access: Read-only

Parameters

ParameterTypeRequiredDescription
alert_idstringYesAlert ID to retrieve

Example

“What triggered alert abc-123?”

Returns the full alert record, including the rule and metric values that caused it to fire.

acknowledge_alert

Record an acknowledgement against an alert, marking it as checked (seen) or dismissed (not worth acting on). You get one acknowledgement per user per alert, and it can’t be changed afterward. Calling it again on an alert you already acknowledged still succeeds but records nothing: the response carries already_acknowledged: true and leaves out the action_type you recorded first, which get_alert shows. On alpacon-server older than 2.35.0, a repeat call is refused with error_code invalid instead.

Access: Idempotent write

Parameters

ParameterTypeRequiredDescription
alert_idstringYesAlert ID to acknowledge
action_typestringYeschecked or dismissed

Example

“Mark that disk space alert as seen, I’ll deal with it later”

The agent calls acknowledge_alert with action_type="checked"; a follow-up list_alerts filtered to acknowledged=false no longer includes it.

get_alert_rules

Get the monitoring alert rules configured for servers in a workspace, optionally filtered to one server.

Access: Read-only

Parameters

ParameterTypeRequiredDescription
server_idstringNoFilter rules to a specific server

Example

“What alert rules are configured for the database servers?”

Returns each rule’s full definition: name, target metric, threshold, operator, duration, recovery threshold, no-data window, device, severity, email destination, Slack channel post, and whether it’s the workspace default.

create_alert_rule

Create a workspace-level alert rule that watches one target metric, such as CPU, memory, or disk usage. Authoring a rule needs a paid plan; only one rule per target can be marked as the default. Creating a rule doesn’t attach it to any servers—use attach_alert_rule for that afterward.

Access: Additive

Parameters

ParameterTypeRequiredDescription
namestringYesName of the alert rule, unique within the workspace
targetstringYesTarget metric to watch (e.g. cpu-usage, memory-usage, disk-usage, or one of the peak/average bandwidth or packet-rate metrics)
thresholdnumberYesValue the metric must cross to trigger the alert
is_defaultbooleanNoMake this the default rule for the target, automatically applied to every server registered afterward. Default false
operatorstringNoWhich side of the threshold breaches: gte (default) fires at or above it, lte fires at or below it
duration_sintegerNoHow long the condition must hold before firing, in seconds. 0 (default) fires on a single breaching sample. A positive value must be at least two collection intervals for the target; shorter is rejected with 400 (metrics_alert_rule_duration_too_short)
recovery_thresholdnumberNoValue the metric must return to before the alert resolves. Omitted, the threshold itself resolves it
no_data_after_sintegerNoRaise an alert when no sample arrives for this many seconds
devicestringNoNarrow the rule to one disk, partition, or network interface. Only accepted for a device-scoped target (disk usage, disk I/O, network); cpu-usage and memory-usage are host-wide and reject it
severitystringNoSeverity the raised alert carries: critical, warning (default), or info. Only a critical rule can email; critical and warning can post to Slack; info reaches neither, whatever notify_email and notify_slack_channel say
notify_emailstringNoWho the alert email is addressed to, within the people who can already see the server: all (default), admins, group_members, or none. Only a human caller may set this—a service-token or agent write naming it is refused with 400 (metrics_alert_rule_destination_not_allowed). Takes effect only on a critical-severity rule
notify_slack_channelbooleanNoWhether a raise and its resolution post to the workspace’s connected Slack channel. Default true. Same human-only restriction as notify_email. Takes effect at critical and warning severity, not info

Example

“Alert me if any server’s memory usage goes above 90% for more than 5 minutes”

Creates a rule with target="memory-usage", threshold=90, and duration_s=300 so a brief spike doesn’t fire it. Attach it to the servers that should be watched with a follow-up attach_alert_rule call.

update_alert_rule

Update an existing alert rule. Only the fields included in the call are changed; at least one updatable field must be provided. Use this to adjust a threshold or rename a rule without recreating it.

Access: Idempotent write

Parameters

ParameterTypeRequiredDescription
rule_idstringYesAlert rule ID to update
namestringNoNew name
targetstringNoNew target metric
thresholdnumberNoNew threshold value
is_defaultbooleanNoMake this the default rule for the target
operatorstringNogte fires at or above the threshold, lte fires at or below it
duration_sintegerNoHow long the condition must hold before firing, in seconds. 0 fires on a single breaching sample. A positive value must be at least two collection intervals for the target; shorter is rejected with 400 (metrics_alert_rule_duration_too_short)
recovery_thresholdnumberNoValue the metric must return to before the alert resolves. Omitted, the threshold itself resolves it
no_data_after_sintegerNoRaise an alert when no sample arrives for this many seconds
devicestringNoNarrow the rule to one disk, partition, or network interface. Only accepted for a device-scoped target
severitystringNoSeverity the raised alert carries: critical, warning, or info. Only a critical rule can email; critical and warning can post to Slack; info reaches neither, whatever notify_email and notify_slack_channel say
notify_emailstringNoWho the alert email is addressed to: all, admins, group_members, or none. Same human-only restriction and severity behavior as on create_alert_rule. Omitted, the rule’s current value is left alone
notify_slack_channelbooleanNoWhether a raise and its resolution post to the workspace’s connected Slack channel. Same human-only restriction and severity behavior as on create_alert_rule. Omitted, the rule’s current value is left alone

Example

“Raise the CPU alert threshold for db-02 to 95%”

Updates only threshold on the matching rule, leaving its other fields unchanged.

delete_alert_rule

Permanently delete an alert rule. Use this to remove rules that are no longer needed.

Access: Destructive

Warning

Deleting an alert rule cannot be undone. To stop it watching one server without losing the rule for everyone else, use detach_alert_rule instead. To exempt just one server while the rule keeps running on the rest of the fleet, use create_rule_override with enabled=false instead of detaching or deleting.

Parameters

ParameterTypeRequiredDescription
rule_idstringYesAlert rule ID to delete

Example

“Delete the old disk space alert rule for the decommissioned server”

Removes the rule permanently; it stops evaluating and generating alerts immediately.

attach_alert_rule

Attach an existing alert rule to a server so the rule starts watching it. Use this after create_alert_rule to put a newly created rule to work—creating a rule doesn’t attach it to anything. Attaching a rule that’s already attached to the server succeeds without changing anything, so it’s safe to retry.

Access: Idempotent write

Parameters

ParameterTypeRequiredDescription
server_idstringYesServer the rule should watch
rule_idstringYesAlert rule to attach

Example

“Watch the new memory alert rule on web-01, web-02, and web-03”

The agent calls attach_alert_rule once per server with the rule’s ID.

detach_alert_rule

Detach an alert rule from a server so the rule stops watching it, without deleting the rule itself—it keeps watching every other server it’s attached to. Detaching a rule that was never attached to the server succeeds without changing anything.

Access: Idempotent write

Parameters

ParameterTypeRequiredDescription
server_idstringYesServer to stop watching
rule_idstringYesAlert rule to detach

Example

“Stop the CPU alert rule from watching db-02, but leave it running everywhere else”

The agent calls detach_alert_rule with db-02’s server ID and the rule’s ID; the rule keeps evaluating on every other attached server.

get_alert_rule_recipients

Preview who an alert rule would notify, as counts—never names—without waiting for it to actually fire.

Note

Requires alpacon-server 2.36.0 or later.

Access: Read-only

Parameters

ParameterTypeRequiredDescription
rule_idstringYesAlert rule ID to preview

Example

“How many people would hear about it if the CPU alert on db-02 fired right now?”

Returns email (mode echoing notify_email, count, and reasons broken down by admins/group_members/owner—these overlap and don’t have to sum to count), slack_channel (enabled echoing notify_slack_channel, connected for whether the workspace has a usable Slack installation), and event_subscriptions (machine listeners, unaffected by either destination). email.count is 0 for a warning- or info-severity rule regardless of notify_email—only a critical rule mails directly—and slack_channel.enabled/.connected stay as configured even for an info-severity rule, which posts nowhere either way.

Counted only over the servers the rule is attached to that you can see and that it can actually fire on. A 404 while the rule itself reads fine through get_alert_rules means every one of its servers is outside what you can see, not that the rule is gone; a rule attached to no server answers zeros instead.

preview_alert_rule

Replay an alert rule over recent stored samples and report what it would have raised, without saving anything. Use it before you create or change a rule to judge how noisy a threshold would be: how many episodes it would have opened, how many would have interrupted someone by email or Slack, and who would have received them. The replay judges the rule the same way a saved rule is judged, once every 60 seconds across the window. It stores nothing and records no activity.

To preview a rule that doesn’t exist yet, pass the rule fields (at least target and threshold) and servers. To preview a saved rule, pass rule_id: any rule field you also pass replaces that rule’s value, every field you leave out keeps the rule’s own, and the rule’s per-server overrides apply. Pass rule_id alone to preview the saved rule as it is.

Access: Read-only

Parameters

ParameterTypeRequiredDescription
rule_idstringNoSaved alert rule to preview. Its attached servers are the default for servers
serversarrayNoServer UUIDs to replay over, up to 20. Required when rule_id is omitted
window_sintegerNoHow far back to replay, in seconds: 60 to 604800 (seven days). Default 86400 (one day)
targetstringNoTarget metric, as on create_alert_rule
thresholdnumberNoValue the metric must cross to fire
operatorstringNogte or lte, as on create_alert_rule
duration_sintegerNoHow long the condition must hold before firing, in seconds
recovery_thresholdnumberNoValue the metric must return to before the alert resolves
no_data_after_sintegerNoRaise when no sample arrives for this many seconds
devicestringNoNarrow the rule to one disk, partition, or network interface. Device-scoped targets only
severitystringNocritical, warning, or info. Together with the destinations, decides whether an episode would have interrupted anyone
notify_emailstringNoall, admins, group_members, or none. Refused with 400 from a service-token or agent caller
notify_slack_channelbooleanNoWhether a raise would post to the workspace’s Slack channel. Refused with 400 from a service-token or agent caller

A replay covers at most 20 servers, at most five servers’ worth of seven days (servers times window_s), and at most 300,000 samples. Going past a limit is refused with 400 and its own error_code (metrics_alert_rule_preview_window_too_long, metrics_alert_rule_preview_too_many_servers, metrics_alert_rule_preview_too_many_samples); leaving out servers without a rule_id returns metrics_alert_rule_preview_servers_required, and a server you can’t reach returns server_not_found. Narrow the servers or the window and try again. A 404 means there is no rule with that rule_id, or every server it is attached to is outside what you can see.

Example

“Would a 90% CPU alert on the web servers have been noisy this past week?”

The agent calls preview_alert_rule with target="cpu-usage", threshold=90, the web servers’ UUIDs in servers, and window_s=604800. The response gives the replayed window, a summary (episodes, would_interrupt, open_at_end, longest_s), one row per server and device listing each episode’s raised_at, resolved_at, and peak, the recipients in the same shape as get_alert_rule_recipients, and not_reproduced, which names what a replay can’t know, such as the rule’s state before the window began.

Rule overrides

A rule override is a per-server departure from a workspace alert rule: a different threshold, recovery threshold, or duration for one server, or an outright exemption. Each field left unset on an override keeps the rule’s own value for that server—an override only overrides what you give it. A server can carry at most one override per rule; creating a second for the same pair is refused.

Note

Rule overrides are a variant of the underlying rule for one server, not a substitute for attach_alert_rule/detach_alert_rule. The rule still has to be attached to the server for either the rule or its override to evaluate.

list_rule_overrides

List the rule overrides configured in a workspace. Filter by server, rule, or enabled state to audit which servers depart from a workspace rule.

Access: Read-only

Parameters

ParameterTypeRequiredDescription
server_idstringNoFilter to overrides on this server
rule_idstringNoFilter to overrides on this rule
enabledbooleanNoFilter by the override’s enabled state; false is a whole-rule exemption for that server
pageintegerNoPage number
page_sizeintegerNoItems per page

Example

“Which servers have a different CPU alert threshold than the rest of the fleet?”

The agent calls list_rule_overrides with rule_id set to the CPU rule’s ID and reviews each override’s threshold.

get_rule_override

Get full detail for a single rule override.

Access: Read-only

Parameters

ParameterTypeRequiredDescription
override_idstringYesRule override ID to retrieve

Example

“Show me the override that’s exempting db-02 from the disk alert”

The agent calls get_rule_override with the override’s ID and reports its server, rule, and which fields it changes.

create_rule_override

Create a per-server departure from a workspace alert rule: replace the threshold, recovery_threshold, or duration_s for one server, or set enabled=false to exempt the server from the rule entirely regardless of the other fields.

Access: Additive

Parameters

ParameterTypeRequiredDescription
server_idstringYesServer the override applies to
rule_idstringYesAlert rule being overridden
thresholdnumberNoReplace the rule’s threshold for this server; unset keeps the rule’s value
recovery_thresholdnumberNoReplace the rule’s recovery threshold for this server; unset keeps the rule’s value
duration_sintegerNoReplace the rule’s duration for this server, in seconds; unset keeps the rule’s value, 0 fires on a single breaching sample
enabledbooleanNofalse exempts this server from the rule entirely, whatever the other fields hold. Default true, matching the rule

Example

“The staging database is noisier than production—raise its CPU alert threshold to 95% without touching the rule everywhere else”

The agent calls create_rule_override with server_id set to the staging database, rule_id set to the CPU rule, and threshold=95.

update_rule_override

Update an existing rule override. Only the fields you pass are sent; an omitted field keeps its current value on the override rather than reverting to the rule’s own value.

Access: Idempotent write

Parameters

ParameterTypeRequiredDescription
override_idstringYesRule override ID to update
server_idstringNoMove the override to a different server
rule_idstringNoMove the override to a different alert rule
thresholdnumberNoNew threshold override
recovery_thresholdnumberNoNew recovery threshold override
duration_sintegerNoNew duration override, in seconds
enabledbooleanNofalse exempts this server from the rule entirely
Note

A server can carry at most one override per rule. Moving an override onto a (server_id, rule_id) pair that already has one fails—delete the existing override first, or update it directly instead of moving this one onto it.

Example

“That staging override’s threshold is still too sensitive—push it to 98%”

The agent calls update_rule_override with the override’s ID and threshold=98, leaving recovery_threshold, duration_s, and enabled as they were.

Note

There’s no way to clear a single overridden field back to the rule’s own value through update_rule_override—an omitted field keeps its current value on the override. To fully remove a departure, use delete_rule_override instead.

delete_rule_override

Permanently delete a rule override, returning that server to the workspace rule’s own values.

Access: Destructive

Warning

Deletion is permanent. The server immediately starts evaluating the workspace rule’s own threshold and settings again.

Parameters

ParameterTypeRequiredDescription
override_idstringYesRule override ID to delete

Example

“Remove the CPU threshold override for the staging database, it should follow the fleet rule now”

The agent finds the override with list_rule_overrides, then calls delete_rule_override with its ID.

Last updated: