Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add multiple agents group assignment section #7309

Merged
merged 2 commits into from
May 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions source/user-manual/agent/agent-management/grouping-agents.rst
Original file line number Diff line number Diff line change
Expand Up @@ -358,3 +358,58 @@ In the case of belonging to multiple groups, the configuration files of every gr
:alt: Multi-group shared files
:align: center
:width: 70%

Assigning multiple agents to a group
------------------------------------

It's also possible to assign multiple agents to a single group using the Wazuh API endpoint :api-ref:`PUT /agents/group <operation/api.controllers.agent_controller.put_multiple_agent_single_group>`. For instance, to assign agents with IDs ``001`` and ``002`` to the ``aws_agents`` group, execute the following request.
javimed marked this conversation as resolved.
Show resolved Hide resolved

.. code-block:: console
# curl -k -X PUT "https://localhost:55000/agents/group?agents_list=001,002&group_id=aws_agents" -H "Authorization: Bearer $TOKEN"
.. code-block:: json
:class: output
:emphasize-lines: 4,5,11
{
"data": {
"affected_items": [
"001",
"002"
],
"total_affected_items": 2,
"total_failed_items": 0,
"failed_items": []
},
"message": "All selected agents were assigned to aws_agents",
"error": 0
}
Then, you can list the agents belonging to the ``aws_agents`` group using the Wazuh API endpoint :api-ref:`GET /groups/{group_id}/agents <operation/api.controllers.agent_controller.get_agents_in_group>`.

.. code-block:: console
# curl -k -X GET "https://localhost:55000/groups/aws_agents/agents?select=id" -H "Authorization: Bearer $TOKEN"
.. code-block:: json
:class: output
:emphasize-lines: 5,8
{
"data": {
"affected_items": [
{
"id": "001"
},
{
"id": "002"
}
],
"total_affected_items": 2,
"total_failed_items": 0,
"failed_items": []
},
"message": "All selected agents information was returned",
"error": 0
}
Loading