Ad Widget

Collapse

Zabbix Agent Remote Commands Not Working

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RaviParikh
    Junior Member
    • Mar 2016
    • 6

    #1

    Zabbix Agent Remote Commands Not Working

    Hi,
    I've run into an issue where an Action setup to execute a remote command on the CurrentHost from which the trigger was raised is not working,
    I've checked the command manually and it works perfectly, I've tried changing commands ( even using system commands ) but none has worked.

    The agent nodes have no issues with network/firewall and I've enabled AllowRoot=1 and running zabbix from root user.

    Item Configured Type : Zabbix Agent
    Action Configured : Run remote commands on current host
    Zabbix Conf Has : EnableRemoteCommands=1 & LogRemoteCommands=1
    DebugLevel=4


    I've searched through the entire log but didn't find anything about why it failed to execute the command,

    Similarly I had enabled the zabbix server DebugLevel=4 and configured multiple actions on the trigger on remote host to send email as well as executed remote command, While email worked fine and got logged as well, Remote command didn't work !!

    I browsed through the various links but didn't find a solution for this problem. The main Issue I see is that on the dashboard it shows "Command NOT SENT", couldn't find the reason for failure from logs, Attaching the screenshot for action and failure.
    For simplicity I've just configured a remote command as "date" - It still says NOT SENT
    I can provide more information if needed to fix the issue. Thank you
    Attached Files
  • GPegel
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2015
    • 113

    #2
    Could you try to set this in your Zabbix Agent config file?

    Code:
    UnsafeUserParameters=1
    And does the Zabbix user has the rights to execute a command on that server? As in: how does your "visudo" looks like?

    A part of my "visudo" looks like this: Please note the last line, I had to add this to get my Remote Commands to work.

    Code:
    # Disable "ssh hostname sudo <cmd>", because it will show the password in clear.
    #         You have to run "ssh -t hostname sudo <cmd>".
    #
    Defaults    requiretty
    Defaults:zabbix !requiretty

    Comment

    • RaviParikh
      Junior Member
      • Mar 2016
      • 6

      #3
      @GPegel, Thanks for taking time to go through it and revert back,

      1> UnsafeUserParameters=1

      This had already been set to "1" as I am using a number of Userparameters to extend the agent functionality and dealing with argument passing.

      2> Since I've set AllowRoot=1 and I am running daemon from root user, I think permissions should not be an issue, However I've still setup full rights to zabbix users along with commenting our "requiretty" to ensure any sudo doesn't need a terminal.

      root 35693 1 0 Mar10 ? 00:00:00 /usr/sbin/zabbix_agentd

      Comment

      • heybails
        Junior Member
        • Jun 2016
        • 23

        #4
        did you ever fix this issue? I'm having the same problem. I can get send message to work as an action but not a remote command.

        Comment

        • RaviParikh
          Junior Member
          • Mar 2016
          • 6

          #5
          Nope, I had checked with one of the zabbix admins and they confirmed that they will not be adding support for this for now.
          I managed to get a work around on this by implementing a script which does the remote command execution and adding it as an action to the trigger. Hope this helps.

          Cheers.

          Comment

          • heybails
            Junior Member
            • Jun 2016
            • 23

            #6
            Wow! It's one of obvious needs of monitoring! Ugh, ok thanks for the reply. Can you share the example of how you set up the workaround? I'd greatly appreciate it.
            Last edited by heybails; 07-07-2016, 16:01.

            Comment

            • AlanDBA
              Junior Member
              • Jan 2014
              • 10

              #7
              Originally posted by RaviParikh
              Nope, I had checked with one of the zabbix admins and they confirmed that they will not be adding support for this for now.
              I managed to get a work around on this by implementing a script which does the remote command execution and adding it as an action to the trigger. Hope this helps.

              Cheers.
              RaviParikh, could you explain better how do you did that?

              Comment

              • mixmox
                Member
                • Apr 2020
                • 54

                #8
                any update?

                Comment

                Working...