Restart Agents from Manager

3,172 views
Skip to first unread message

bhanuprasad

unread,
Aug 17, 2021, 10:27:29 PM8/17/21
to Wazuh mailing list
Hi Team,

Trying to restart Agents from Wazuh-Manager but it seems to be, its not restarting agents.

Tried below command:

/var/ossec/bin/.agent_control -R -a

Is there port needs to be allowed on Agent side for this task? 

And how we can verify that agents were restarted successfully? 

Is it possible to restart Agents for which  status has "Disconnected"?

Thanks in advance. 

elw...@wazuh.com

unread,
Aug 18, 2021, 5:57:32 AM8/18/21
to Wazuh mailing list
Hello Bhanuprasad,


The Wazuh manager leverage the use of the reporting port 1514 in order to trigger an active response in the agents to restart them, thus the agents must be Active to be able to perform any action against them.

You can use both the Wazuh API  (recommended) and the Binary to restart the agents and verify that from the active response logs of the agent as below :


  • Using the Wazuh API : PUT /agents/restart?agents_list=009

    image (104).png


    [root@Agent2 vagrant]# tail -f /var/ossec/logs/active-responses.log
    Wed Aug 18 09:44:03 UTC 2021 /var/ossec/active-response/bin/restart-ossec.sh add - null (from_the_server) (no_rule_id)


     
  • Using the binary: /var/ossec/bin/agent_control -R -u 009 or /var/ossec/bin/agent_control -R -a


    image (105).png



You can find more about the Wazuh API reference here: https://documentation.wazuh.com/current/user-manual/api/reference.html#operation/api.controllers.agent_controller.restart_agent


Hope this helps.

Regards,
Wali

bhanuprasad

unread,
Aug 18, 2021, 10:21:44 PM8/18/21
to Wazuh mailing list
Hi,

Thank you for detailed response. 

Is it possible to restart all agents (Active) in one shot instead of single agent ? 

elw...@wazuh.com

unread,
Aug 19, 2021, 3:05:16 AM8/19/21
to Wazuh mailing list
Hello,

To restart all the agents via the API, you can use PUT /agents/restart or using the binary with /var/ossec/bin/agent_control -R -a

Hope this helps.

Regards.
Wali
Reply all
Reply to author
Forward
0 new messages