-
Notifications
You must be signed in to change notification settings - Fork 55
Open
Labels
Description
Description
The Wazuh agent should send an event to the server when performing a graceful shutdown. This event will be a stateless message sent directly, bypassing the agent's queue.
This task presents a challenge: the agent must send the message while shutting down quickly. Therefore, an independent sending mechanism with a timeout will be implemented.
Requirements
- When the agent receives a shutdown signal, it must send to the server:
- A stateless message indicating the shutdown.
- A stateful message to update its status to "shut down."
- The agent must not re-authenticate after sending these messages.
Configuration
Proposed configuration option:
agent:
shutdown_notify_timeout: 10s
Stateless message format
Metadata
{ "module": "agent" }
Data
{
"event": {
"original": "The agent is shutting down.",
"created": "2025-02-10 11:30:01.000"
}
}
Plan
- Validate the stateless message format.
- Propose the stateful message format, involving the Server and Indexer teams.
- Add the
shutdown_notify_timeout
configuration option. - Develop the functionality to send both messages during the agent's shutdown routine.
- Add tests for this use case.
- Update technical documentation.
Definition of done
- The agent sends both stateless and stateful messages upon shutdown.
- Messages are sent without re-authentication.
- The
shutdown_notify_timeout
is configurable. - Tests cover normal and edge cases.
- Documentation is updated accordingly.
Additional notes
- The stateful message format is yet to be defined.
- This design provides a "best effort" approach to mark the agent's status in the inventory. It does not guarantee the agent will be marked as disconnected after shutdown.
- The agent will also send these events when shutting down due to a system reboot.