Ad Widget

Collapse

How do I: Execute script to restart Zabbix Agent?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • TecDragon
    Member
    • Nov 2019
    • 63

    #1

    How do I: Execute script to restart Zabbix Agent?

    For some reason, quite a few of our devices do not restart the Zabbix agent after a reboot. Primarily this occurs on Windows 2019 std servers. I am using PsService to restart the zabbix service remotely.

    Code:
    PsService.exe \\SERVER01.domain.org -accepteula -u AdminUser -p AdminPassword restart "Zabbix Agent 2"
    Very simple and it works.

    However, what I want to do is that if the Zabbix agent shows unreachable for 3m minutes (the standard zabbix trigger) that is will automatically try to restart the zabbix service. As PsService is a windows thing and Zabbix is on a linux server I am lost on how that works. So I may need to know if this can be done from Linux to Windows - if so how? And where\how do I set up Zabbix to execute the script to restart the Zabbix server?
  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4807

    #2
    If PS is your thing, then maybe .. https://docs.microsoft.com/en-us/pow...powershell-7.2

    Comment

    • StefTresMan
      Member
      • Feb 2022
      • 32

      #3
      If the agent is not running on the host, you can't use it to start itself. You'll have to use scripting on the host itself. Probably the service's settings might help: set startup type to delayed, and on the recovery page set first and second failure to 'restart the service'
      Zabbix can't trigger UserParameters if the agent is not running.

      Comment

      Working...