Delete host via action, Zabbix

Поделиться
HTML-код
  • Опубликовано: 20 окт 2024

Комментарии • 6

  • @MarkoJovanovicunngenant
    @MarkoJovanovicunngenant 10 месяцев назад

    Thank you for sharing this. Just one thing. Is this only auto remove host by your trigger which is as example put here by icmp or it works out of box with let say Zabbix agent is unreachable for 60 minutes? Or it will trigger any problem? I have lot triggers which can be in a problem but not for removing.

  • @faustinechisasa9696
    @faustinechisasa9696 2 года назад

    Thanks for sharing

  • @rafaelscabral53
    @rafaelscabral53 2 года назад

    Good. 😀

  • @sunandpanda4458
    @sunandpanda4458 11 месяцев назад

    I have done all the steps but the host is not deleting from the UI.. can you please help me with this .. if maunally executing getting
    " 56 3 undefined"

  • @TiagoDomingosFigueiredo
    @TiagoDomingosFigueiredo 9 месяцев назад

    hi !
    Do you know why you are giving this error?
    cannot execute script: ReferenceError: identifier ' CurLHttpRequest' undefined
    at [anon] (duktape.c83869) internal
    at [anon] (function:5) prevestsyield

    • @Leakim945
      @Leakim945 20 дней назад

      // convert to JSON all input arguments
      var params = JSON.parse(value);
      // define new HTTP request
      var req = new HttpRequest();
      // where Zabbix API endpoint is located
      var json_rpc = params.url + '/api_jsonrpc.php';
      // this will be JSON call
      req.addHeader('Content-Type: application/json');
      // prepare the data to be sent
      var requestData = JSON.stringify({
      "jsonrpc": "2.0",
      "method": "host.delete",
      "params": [params.hostid],
      "auth": params.token,
      "id": 1
      });
      // send POST request and capture response
      var response = JSON.parse(req.post(json_rpc, requestData));
      // log the response result
      Zabbix.Log(3, JSON.stringify(response));
      // return the hostid (or any other value you need)
      return params.hostid;