Ad Widget

Collapse

Zabbix API item.get vs history.get

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ravigu
    Junior Member
    • May 2020
    • 2

    #1

    Zabbix API item.get vs history.get

    Hi,

    I am new to Zabbix and trying to pull performance data (let say for "CPU system time", "Total memory") from Zabbix using Zabbix::Tiny REST API.

    I used item.get method and it is returning last sample value by using "prevvalue" but item.get doesn't support time range for performance data collection. So, I switched to history.get method but history.get returning data for some metrics only (let say "Used disk space on /" and"Used disk space on /boot" for some hosts only).

    Since I never used Zabbix before, I don't know if there is any settings, I need to check, so that history.get also return data for all metrics for all hosts.
    Also where should I look into Zabbix console to check, if history is enabled for required metrics/hosts and how long the data will be kept in history?


    Appreciate, if someone could help me with above 2 queries.

    regards,
    Ravi
  • Atsushi
    Senior Member
    • Aug 2013
    • 2028

    #2
    item.get is an API for acquiring the item setting information. history.get is an API to get the history information that gets the value based on the setting of the item. If you want to get the value of each item at the moment, you can use history.get.
    What parameters did you try to get the value from?
    Zabbix allows user groups to specify which host group's host information is accessible. If you can only get values for some hosts, check the permissions of the user group to which your user belongs.
    You can use the web front end to access the Monitoring->Latest data and see the value of the retrieved item and its time for each host. Please set filtering as necessary and click the Apply button.

    Comment

    • ravigu
      Junior Member
      • May 2020
      • 2

      #3
      Thanks Atsushi for your response !!!

      The issue is resolved now. Actually, I was trying to fetch data for last 5 minutes but data was returned for some hosts and for some random metrics only.
      Below are the issue details and resolution for the same (for other users like me ):

      1)
      Requirement: I was trying to fetch data for "CPU system time" and "Available memory" in one query.
      Behavior : Data was returned either for CPU or Memory but not for both in one query.
      Fact : Data type for CPU and Memory are different and "history" parameter in "history.get" method doesn't support multiple values.
      resolution : supplied data type of metric (variable replacement) in query using "value_type" for metric in question.
      history => value_type

      This resolve the issue of getting data for some metrics only.

      2)
      Requirement : Trying to fetch performance data for all hosts.
      Behavior : Data was returned for some hosts only.
      Fact : Some metrics data was collected every minute and some metrics data was collected for every five minutes.
      Resolution : Check the polling interval for all metrics in question.

      After Adjusting time duration, this resolve the issue of getting data for some hosts only.

      Regards,
      Ravi

      Comment

      Working...