Hi HA,
I had to check on the lab in order to validate the steps; here they are:
Labels will need to be used in order to be able to receive the
group information through Alerting.
_ Add labels to the agent's
ossec.conf, and restart the agent afterwards.
*****************************************************************************************
<labels>
<label key="agentname">pc</label>
<label key="agentgroup">windows</label>
</labels>*****************************************************************************************
_ Test the alarm you will be working with to confirm the labels are shown, for example:

_ Filter by alarm or whichever information you need, I will be using
event.id 554.
Go to the upper right corner "Inspect" > "Request" (extract/copy the query section). This will be used later on.

_ A new Monitor instance will be needed that will make use of the query content.
_Go to "Alerting" > "Monitors" > "Create Monitor". For Monitor Details, select "Per query monitor" > "Extraction query editor"
_ Data source will be
wazuh-alerts*
_ Insert the query extracted previously, editing the from-to fields
{
"query": {
"bool": {
"must": [],
"filter": [
{
"match_all": {}
},
{
"match_phrase": {
}
},
{
"range": {
"timestamp": {
"gte": "now-10m",
"lte": "now",
"format": "strict_date_optional_time"
}
}
}
],
"should": [],
"must_not": []
}
}
}
_ "Trigger" set as follows by default for this demonstration (events > 0):

_ Actions will have the information below:

Message text:
*****************************************************************************************
Monitor {{ctx.monitor.name}} just entered alert status. Please investigate the issue.
- Trigger: {{ctx.trigger.name}}
- Severity: {{ctx.trigger.severity}}
- Period start: {{ctx.periodStart}}
- Period end: {{ctx.periodEnd}}
- Occurrences: {{ctx.results.0.hits.total.value}}
{{#ctx.results.0.hits.hits}}
More Information:
- Agent name: {{_source.agent.name}}
- Agent name by label: {{_source.agent.name}}
- Agent group by label: {{_source.agent.labels.agentgroup}}
{{/ctx.results.0.hits.hits}} *****************************************************************************************
Testing by triggering the alarm again, should send out an email as configured:

Note there is two ways to display the agent name, but only one for the group, which is by the use of labels.
I hope this helps!.