Ad Widget

Collapse

Disable Host after trigger or any better approach

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • atlantun
    Junior Member
    • May 2018
    • 3

    #1

    Disable Host after trigger or any better approach

    Hi Guys,
    I'm stuck trying to remove/disable hosts after a trigger event.


    Host is created : call zabbix 'host.create' api to add the host and assign it to a template A with additional macros etc...
    I have control of the create part.

    I have an external check item : calling an api
    and I have a trigger with a condition on the value returned from the api

    == all of this works fine.

    I would like to remove the host from zabbix ( or disable ) when a trigger condition is met.
    I only see actions such as send message and so.


    - i have tried to change my trigger into a discovery rule ( since I see the possibility to add/remove host ) but this is not very clear to me what a discovery rule is.

    Please let me know how to achive this
    Thank you
  • LenR
    Senior Member
    • Sep 2009
    • 1005

    #2
    You can use the Remote Command operation to run an api script. Instead of current host, point to a utility system for scripts. I run the Zabbix web on a separate host, so I use it for my script system. In prior releases I used this method to set inventory to automatic. You can pass the host name macro to the API.

    Comment

    • atlantun
      Junior Member
      • May 2018
      • 3

      #3
      Perfect
      thank you

      Comment

      • Artak
        Junior Member
        • May 2018
        • 1

        #4

        Hi Guys,

        I stuck to create host on zabbix via API
        The below is my JSON

        $Jsonbody2= @'
        {
        "jsonrpc": "2.0",
        "method": "host.create",
        "params": {
        "host": "TestHost",
        "interfaces": [
        {
        "type": 1,
        "main": 1,
        "useip": 1,
        "ip": "192.168.80.80",
        "dns": "",
        "port": "10050"
        }
        ],
        "groups": [@{groupid: "95"}]
        ,
        "templates": [
        {
        "templateid": "10273"
        }
        ]
        },
        "auth": "",
        "id": 2
        }

        Response always keeps the same:

        -32500 Application error. No permissions to referred object or it does not exist!

        Pls support

        Artak.

        Comment

        Working...