Ad Widget

Collapse

curl command (remote commands)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Michal S.
    Junior Member
    • Aug 2022
    • 7

    #1

    curl command (remote commands)

    Hello,

    I have zabbix_agentd 4.4.9 installed on Red Hat Enterprise Linux Server release 7.5. I monitor at this host especially disk space for ElasticSearch by Zbx-agent and indices in Elasticsearch by HTTP Agent.
    I added the trigger action which is started when I have read-only indices in my Cluster. Trigger informs me about read-only indices. To do that I want to use curl command:
    curl -X PUT "{HOST.IP}:9200/_all/_settings" -H 'Content-Type: application/json' -d'{ "index.blocks.read_only_allow_delete" : null } }'

    I checked this command and it works correctly. I also checked this command like this: sudo -u zabbix curl..... And it works.

    This is what i did:
    - zabbix_agentd.conf - enable remote commands, enable log remote commands, Server IP added and more.
    - added trigger action,
    - update operations (I want to execute command only when user update a problem) -> remote command -> custom script with curl command (execute on zabbix agent)
    - in visudo: zabbix ALL=(ALL) NOPASSWD: ALL

    In the action logs I have information that command was executed. Unfortunately I don't have the expected result.

    Maybe somebody can help me or advise me on something.

    Thanks in advance,
    Michal
    ​​
  • zabfish
    Junior Member
    • Nov 2022
    • 3

    #2
    Advice would be to gather more information like an error message or log entry. Other than that, it looks like you may have an extra '}' at the end. Not sure if that was just a bad translation.

    Comment

    • Michal S.
      Junior Member
      • Aug 2022
      • 7

      #3
      Thank you zabfish​ for your response. An extra '}' doesn't really matter. I corrected that and I still have the same issue.

      I send the logs below.

      Action log:
      Command:
      HOST:curl -X PUT "{HOST.IP}:9200/_all/_settings" -H 'Content-Type: application/json' -d'{ "index.blocks.read_only_allow_delete" : null }'
      Status: Executed

      Log from zabbix​_agentd.log:
      27652:20221117:091441.281 Executing command 'curl -X PUT "<HOST.IP>:9200/_all/_settings" -H 'Content-Type: application/json' -d'{ "index.blocks.read_only_allow_delete" : null }' '

      I will be grateful for any suggestion.

      Comment

      • Michal S.
        Junior Member
        • Aug 2022
        • 7

        #4
        I changed "Execute on" Zabbix server and everything works correctly. I do this as a remote command type: global script.
        Previously the command was executed by a Zabbix agent. I still have no idea why it doesn't work with agent. I know that probably there is a problem associated with permissions (I added zabbix user to sudoers).
        If I find the solution I will inform you.​

        Comment

        • zabfish
          Junior Member
          • Nov 2022
          • 3

          #5

          so those logs are from the node running the agent? Trying to get a logical picture, since I don't really have experience with what you are trying to accomplish

          Comment

          • Singularity
            Member
            • Aug 2020
            • 81

            #6
            Did you tried to use Zabbix elastic search template ? https://www.zabbix.com/integrations/elasticsearch
            You will be able to control almost everything from Zabbix UI itself.( I monitor almost everything of elastic search using this template )

            Comment

            • Michal S.
              Junior Member
              • Aug 2022
              • 7

              #7
              Hello Singularity​. Yes, I'm using this template. I created two additional items to monitor and count read-only indices. When my cluster has read-only indices my trigger is fired. I created an action which unblocks read-only indices (of course after fulfillment of certain conditions). I wanted to execute this action by the zabbix agent but it didn't work. It works when the zabbix server executes this command. For me this solution is ok but I'm curious why my remote command doesn't work with Zabbix agent. I don't like letting go, but I don't have time right now to still grind with finding the solution.

              Comment

              Working...