Ad Widget

Collapse

How to run a remote command when a trigger is fired in Zabbix 7.4?

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ezoltan
    Junior Member
    • Feb 2024
    • 24

    #1

    How to run a remote command when a trigger is fired in Zabbix 7.4?

    Hi,

    I have a Zabbix 7.4 server and some monitored hosts.

    I have a Windows computer which needs to have a user logged on at all times. The computer is configured to autologon every time it is started/rebooted for there is an automation software that needs to run all the time, and it only runs in a logged-on user desktop environment. Sometimes it happens that the user is logged out and the computer just sits at the logon screen, hence the software stops.

    I configured a trigger and an alert which fire if there is no user logged on. It works just fine.

    Now my challenge: I want to reboot the computer when the trigger fires so that it auto-logs on with no user intervention. I watched Dmitry's tutorial at https://www.youtube.com/watch?v=CMlpFuGBruE and read his blog at https://blog.zabbix.com/zabbix-remote-commands/7500/, however his version of Zabbix is different. The UI has been rearranged and the various configuration elements do not match, and some are not available at all in the new interface.

    For instance, from https://www.zabbix.com/documentation...cations/action I gather that I should create a new trigger action. The page links to https://www.zabbix.com/documentation...tion/operation which states:

    Click image for larger version

Name:	image.png
Views:	136
Size:	33.4 KB
ID:	507608

    Let's try to create my conditional remote command action:

    Click image for larger version

Name:	image.png
Views:	189
Size:	14.0 KB
ID:	507604

    Click image for larger version

Name:	image.png
Views:	138
Size:	33.7 KB
ID:	507605

    And here we go, there is no remote command operation​​ available:

    Click image for larger version

Name:	image.png
Views:	135
Size:	85.4 KB
ID:	507607​​

    I spent the best part of the day trying to figure it out, but I ran out of options.

    The individual components such as system.run[command,state] are explained in the documentation but I can find nothing about how to meaningfully link them together to do what I want, and certainly not if the product is buggy or the documentation is incorrect, incomplete or scattered in odd places.

    Can someone please point me to a blog/article/video tutorial which explains the full process of how to configure Zabbix to run a command on the monitored computer (agent) when a trigger is fired.

    Dmitry, if you read this post, would it be too big of an ask to update the blog for the current version of Zabbix?

    Thank you.
    Attached Files
  • Answer selected by ezoltan at 28-09-2025, 21:02.
    ISiroshtan
    Senior Member
    • Nov 2019
    • 324

    Go Alerts - Scripts - Create script - Scope of "Action operation" - Type: Script - Execute on "Zabbix agent" - Fill rest to fit your requirement.
    Then you will be able to choose this script as an operation in action

    Documentation:
    Remote commands
    Specifcally the part:

    Predefined scripts
    Scripts that are available for action operations (webhook, script, SSH, Telnet, IPMI) are defined in global scripts.
    ​​

    Comment


    • ezoltan
      ezoltan commented
      Editing a comment
      Thank you ISiroshtan, that worked. The documentation is isn't that straight forward though. The wording is unclear, and the Operations section of the documentation at https://www.zabbix.com/documentation...g-an-operation makes no mention whatsoever about it.

      Thanks again :-)
  • ISiroshtan
    Senior Member
    • Nov 2019
    • 324

    #2
    Go Alerts - Scripts - Create script - Scope of "Action operation" - Type: Script - Execute on "Zabbix agent" - Fill rest to fit your requirement.
    Then you will be able to choose this script as an operation in action

    Documentation:
    Remote commands
    Specifcally the part:

    Predefined scripts
    Scripts that are available for action operations (webhook, script, SSH, Telnet, IPMI) are defined in global scripts.
    ​​

    Comment


    • ezoltan
      ezoltan commented
      Editing a comment
      Thank you ISiroshtan, that worked. The documentation is isn't that straight forward though. The wording is unclear, and the Operations section of the documentation at https://www.zabbix.com/documentation...g-an-operation makes no mention whatsoever about it.

      Thanks again :-)
Working...