Ad Widget

Collapse

How to use history.get "search" parameter in API?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jnunez
    Junior Member
    • Apr 2020
    • 3

    #1

    How to use history.get "search" parameter in API?

    Hello Zabbix experts,

    I'm trying to get historical disk utilization on my hosts and I crafted the following request (this is after proper authentication):

    Code:
    {"jsonrpc": "2.0", "method": "history.get", "params": {"hostids": ["12630"], "output": "extend", "sortfield": "clock", "history": 3, "search": {"key_": "vfs.fs.size[/srv,*]"}, "searchWildcardsEnabled": true, "time_from": 1587562139, "time_till": 1587648539}, "id": "1", "auth": "481cbe460d85a4235a4aa9d69cc9ac9a"})
    But Zabbix API doesn't like the parameter "key_" inside my "search" argument.:

    Code:
    Response Body: {
        "jsonrpc": "2.0",
        "error": {
            "code": -32602,
            "message": "Invalid params.",
            "data": "Invalid parameter \"/search\": unexpected parameter \"key_\"."
        },
        "id": "1"
    }

    Sadly the API 4.4 documentation doesn't provide any examples on how to use the search as opposed to filter by passing multiple itemid's.

    Can someone tell me what I'm doing wrong or if there is a better way of doing this? Passing a "key_" argument works fine with the method 'item.get' (I know, different animal).

    Thanks,

    --Jose

  • user1234
    Member
    • Jul 2022
    • 35

    #2
    Any Solution?

    Comment

    • LenR
      Senior Member
      • Sep 2009
      • 1005

      #3
      I think you would have to search in get.item for the key_, then get history with itemids. I don't think you can do it in a single get.history.

      Comment

      Working...