Ad Widget

Collapse

(API) Get problem history

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • quackduck
    Member
    • Feb 2025
    • 36

    #1

    (API) Get problem history

    I need to get the equivalence of "problem history" via the Zabbix API for the past two years or so. This view contains past problems and currently active ones.

    There's no solid documentation on the details of how to exactly this via API calls. The documentation is quite vague.

    Unclear whether I need to use event.get or problem.get or both to derive the information that I'm after.

    Please help
  • quackduck
    Member
    • Feb 2025
    • 36

    #2
    Not even behaving as any of the many possible interpretations of the vague doc. The heck.

    Comment

    • quackduck
      Member
      • Feb 2025
      • 36

      #3
      For anyone reading this. Don't waste your time with problem_Time_from or problem_time_till mentioned in the "documentation" for event.get. https://www.zabbix.com/documentation...ence/event/get.
      It either has literally no effect or random undefined behavior.


      This will return everything (the problem-parameters are completely ignored).

      event.get(
      output='extend', # ["clock", "value", "name", "eventid"],
      source=0, # trigger
      object=0, # trigger
      # selectRelatedObject = 'extend', # ['event_name']
      selectHosts = ['host'],
      problem_time_from = now,
      problem_time_till = now,
      )

      Comment

      • cyber
        Senior Member
        Zabbix Certified SpecialistZabbix Certified Professional
        • Dec 2006
        • 4807

        #4
        if you need a problem list, then you should use problem.get.
        https://www.zabbix.com/documentation...al/definitions explains, what is event, what is a problem... Event is trigger turning to püroblem state, another event is that trigger returning to OK state... It can be caused by calculation or by correlation or done manually etc...

        Comment

        • quackduck
          Member
          • Feb 2025
          • 36

          #5
          If anyone get into the same problem in the future and is reading this, the only way to get the problem history is to fetch all events for a certain time period and caucluate the problems yourself. Further, you'll have to manually correlate the problems with 'maintenances' if you need accurate statues - events have a 'suppress' field that isn't timestamped (the WebUI for problem history suffers inaccuracies because of this too, I've checked). Zabbix wasn't originally designed for this kind of historic correctness.

          Lastly: do an event search for events past (before and after) your search window for each kind of problem/trigger/tag/host/whatever: use the time_till and time_from sorted in the relevant order and limit the search result to one.

          Then do whatever you have to do with this data.

          Comment

          Working...