Server Chief webhooks
Server Chief sends a webhook when a server goes offline or comes back, a metric alert fires or resolves, metrics stop arriving, storage degrades, or a server is added, changed, or removed. Use them to page your on-call engineer, open a ticket, or keep an inventory in another system current without polling the API.
Deliveries are signed, retried, and logged the same way in every Chief Tools product. Read Receive webhooks first for verification, responses, retries, and duplicates. This page covers what is specific to Server Chief.
Set up an endpoint
Add endpoints under Settings › Webhooks in Server Chief, then send a test event from the endpoint's page. Deliveries come with the User-Agent ServerChief-Webhooks/1.0.
To set up endpoints from code, use the webhooks API with a token that has the serverchief:webhooks:write scope:
Code
The response includes the endpoint's secret. Store it right away: it is only returned when the endpoint is created and when you rotate its secret. Then send a test event to check your receiver. The same API lists event types, events, and deliveries with each attempt's request and response, and resends them.
Events go to the endpoints of the team that owns the server. Teams that see a server because it was shared with them get no events for it.
Events
Each event's data.object is a Server or an Alert, as the API returns it when the event happens. Some events add fields next to object in data.
Each event type below links to its page in the API reference, with the request headers and every field of the payload. The OpenAPI document also lists the events under webhooks, so you can generate types for your receiver from it.
Servers
| Type | Sent when |
|---|---|
server.created | A server is added. It waits for its agent, with status set to pending. A server added by an install command that creates servers gets this event and server.enrolled together. |
server.enrolled | A server's agent enrolls for the first time. Reinstalling the agent on the same server does not send it again. |
server.updated | A server's name, hostname, metadata, location, settings, or tags change. |
server.deleted | A server is removed. object is the server as it was right before. |
Availability
| Type | Sent when | Extra data fields |
|---|---|---|
server.offline | An active server has not checked in for 15 minutes. | |
server.online | An offline server checks in again. | offline_since: when it went offline |
server.reboot_stalled | A server has not checked in for 6 minutes after it started a reboot. The server counts as offline, and server.online follows once it is back. | command_id: the reboot command |
A server whose reboot stalls gets server.reboot_stalled instead of server.offline.
Metric alerts
| Type | Sent when | Extra data fields |
|---|---|---|
alert.fired | A metric alert rule fires for a server. | |
alert.resolved | A firing alert closes. | reason: why it closed |
metrics.stalled | An online server that collects metrics has delivered none for about 25 minutes. | stalled_at: when the stall was first noticed |
metrics.resumed | Metrics from that server arrive again. | stalled_at |
reason on alert.resolved is one of:
recovered: the metric stayed within the rule for two checks in a row.out_of_scope: the rule no longer covers the server, or the server stopped collecting metrics.rule_changed,rule_disabled, orrule_deleted: someone changed, turned off, or deleted the rule.
Only recovered means the problem went away. Handle unknown reasons like a closed alert.
When many servers stop delivering metrics at the same moment, the cause is on our side, and Server Chief sends no metrics.stalled events for them.
Storage health
| Type | Sent when | Extra data fields |
|---|---|---|
server.storage_unhealthy | A RAID array or ZFS pool degrades, or a disk fails, or storage that was unhealthy gets worse. | health, problems, unhealthy_since |
server.storage_healthy | The server's storage is healthy again. | unhealthy_since |
health is degraded or failed. problems lists what is wrong, each with its own health, a subject such as an array or disk name, and a description you can show to a person. Storage that improves but stays unhealthy sends no event.
Examples
A server went offline
Code
The full object has every field of the Server schema. enrollment is always null in webhooks, so enrollment tokens never leave Server Chief this way.
An alert resolved
Code
The alert's own closed_reason field is a sentence for people. Branch on data.reason instead.
Common integrations
- Paging. Subscribe to
server.offline,server.reboot_stalled,alert.fired, andserver.storage_unhealthy. Close the page onserver.online,alert.resolvedwithreasonset torecovered, andserver.storage_healthy. - Inventory sync. Subscribe to
server.created,server.updated, andserver.deleted, and store the server fromdata.object. Use List servers once to load existing servers, and again to catch up after your receiver was down for longer than the retries last.
Events are kept for 30 days. For anything older, read the current state from the API.