XMLWordPrintable

    • Icon: Problem report Problem report
    • Resolution: Unresolved
    • Icon: Trivial Trivial
    • None
    • 7.0.8
    • None
    • None

      Hello!

      Filter parameter is not working in history.get API method.

      In item.get filter is working as expected:

      {
          "jsonrpc": "2.0",
          "method": "item.get",
          "params": {
              "output": ["key_", "name", "lastclock", "lastvalue", "units"],
              "monitored": true,
              "selectHosts": ["host", "name"],
              "filter": {
                  "host": [
                      "hostname"
                  ]
              },
              "search": {
                  "key_": "icmpping"
              },
              "searchWildcardsEnabled": true
          },
          "id": 1,
          "auth": "{{token}}"
      }

      But if I'm try to use same filter in history.get

      {
          "jsonrpc": "2.0",
          "method": "history.get",
          "params": {
              "output": "extend",
      
              "filter": {
                  "host": [
                      "hostname"
                  ]
              },
              "search": {
                  "key_": "icmpping"
              },
      
              "sortfield": "clock",
              "sortorder": "DESC",
              "limit": 10
          },
          "id": 1,
          "auth": "{{token}}"
      }

      then I get an error:

      {
          "jsonrpc": "2.0",
          "error": {
              "code": -32602,
              "message": "Invalid params.",
              "data": "Invalid parameter \"/filter\": unexpected parameter \"host\".",
              "debug": [
                  {
                      "file": "/usr/share/zabbix/include/classes/api/services/CHistory.php",
                      "line": 124,
                      "function": "exception",
                      "class": "CApiService",
                      "type": "::"
                  },
                  {
                      "file": "/usr/share/zabbix/include/classes/api/clients/CLocalApiClient.php",
                      "line": 126,
                      "function": "get",
                      "class": "CHistory",
                      "type": "->"
                  },
                  {
                      "file": "/usr/share/zabbix/include/classes/core/CJsonRpc.php",
                      "line": 99,
                      "function": "callMethod",
                      "class": "CLocalApiClient",
                      "type": "->"
                  },
                  {
                      "file": "/usr/share/zabbix/api_jsonrpc.php",
                      "line": 58,
                      "function": "execute",
                      "class": "CJsonRpc",
                      "type": "->"
                  }
              ]
          },
          "id": 1
      }

            zabbix.dev Zabbix Development Team
            Evgeny.Semerikov@x5.ru Evgeny Semerikov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: