Ad Widget

Collapse

API - history.get does not return the item's historical value

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • brenoacp
    Junior Member
    • Jun 2016
    • 26

    #1

    API - history.get does not return the item's historical value

    Hi everyone!
    Staff need to search the history of an item to generate some graphics in an automated report.
    But the API query does not return any value. Let me give you an example:
    Follow the query below using host.get
    Query:

    {
    "output":["host"],
    "sortfield": "name",
    "hostids": "10129",
    "selectItems":["itemid","name","key_"]
    }

    result:

    {
    "hostid": "10129",
    "host": "SRVAD01",
    "items": [
    {
    "itemid": "24687",
    "name": "Host name of zabbix_agentd running",
    "key_": "agent.hostname"
    }

    So far so good, more when I query with method history.get using for example the "itemid": "24687" the result is null:
    Query:
    {
    "output": "extend",
    "history": 0,
    "itemids": "24687",
    "sortfield": "clock",
    "sortorder": "DESC",
    "limit": 10
    }

    Result:

    {
    "jsonrpc": "2.0",
    "result": [],
    "id": 25
    }

    What was I doing wrong? Could you please help me?

    Best Regards,
    Breno Padovan
  • jan.garaj
    Senior Member
    Zabbix Certified Specialist
    • Jan 2010
    • 506

    #2
    Code:
    "history": 0,
    + doc https://www.zabbix.com/documentation...e/history/get:
    Code:
    History object types to return.
    
    Possible values:
    0 - numeric float;
    1 - character;
    2 - log;
    3 - numeric unsigned;
    4 - text.
    
    Default: 3.
    Hostname is a text value, so try to use:
    Code:
    "history": 4,
    Devops Monitoring Expert advice: Dockerize/automate/monitor all the things.
    My DevOps stack: Docker / Kubernetes / Mesos / ECS / Terraform / Elasticsearch / Zabbix / Grafana / Puppet / Ansible / Vagrant

    Comment

    • brenoacp
      Junior Member
      • Jun 2016
      • 26

      #3
      Originally posted by jan.garaj
      Code:
      "history": 0,
      + doc https://www.zabbix.com/documentation...e/history/get:
      Code:
      History object types to return.
      
      Possible values:
      0 - numeric float;
      1 - character;
      2 - log;
      3 - numeric unsigned;
      4 - text.
      
      Default: 3.
      Hostname is a text value, so try to use:
      Code:
      "history": 4,

      Thanks for the feedback.
      That's right, I was using the wrong object type.

      Best regards,
      Breno Padovan

      Comment

      Working...