Skip to content

Commit

Permalink
Merge pull request #7309 from wazuh/fix/7205-add-agents-group-assignment
Browse files Browse the repository at this point in the history
Add multiple agents group assignment section
  • Loading branch information
javimed authored May 17, 2024
2 parents c84d724 + 532e6e0 commit 39b5b83
Showing 1 changed file with 55 additions and 0 deletions.
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.

.. 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
}

0 comments on commit 39b5b83

Please sign in to comment.