Ad Widget

Collapse

Zabbix API: Retrieve the problems that belongs to given templateids, for each host.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cyberphantom
    Member
    • Dec 2021
    • 67

    #1

    Zabbix API: Retrieve the problems that belongs to given templateids, for each host.

    Hello
    I'm new to zabbix api so I'm stucked on this problem
    Here's a example: I have one host that have 2 items. One of this items belongs to my template X. Those two items are alarmed, so they appear in "problem" tab. What I want is to retrieve the count of problems that are generated by an item that belongs to template X. Is that possible? I've tried many things, and I've started to think that it's not lol also, I'm reading and following the manual, but it's still hard for me to achieve this.

    What I've done (consider my host with hostid 10446 and the templateid for the template Y, 31149):

    {
    "jsonrpc": "2.0",
    "method": "trigger.get",
    "params": {
    "output": ["name","templateid","description","priority"],
    "filter": {
    "value": "1",
    "status": 0,
    "hostid": 10446,
    "templateid": 31149
    }
    },
    "auth": "xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "id": 1
    }
    note: I know how to do the count, I just placed this code above because it's more simple and I'm in doubt with this part of code

    It seems to work, but when I create new items that belongs to this template Y, they are not part of my count.
    What seemed strange for me was this number of templateid, my template Y don't have this id, but it shows me this number when I execute my code for bring to me the template id for my host problems lol

    plsss help me
  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4807

    #2
    trigger.get gives you trigger config. That has nothing to do with the events and problems you want to count...
    You probably need to get count of events / problems caused by a particular trigger (event.get / problem.get)

    Comment

    • cyberphantom
      Member
      • Dec 2021
      • 67

      #3
      Your response clear things up here
      I was reading the manual and I can't count events the way I though... well, I think
      So I create some tags for triggers, and now the problems are with those tags... so I'm counting problems with those tags, and I'm catching just the ones that I really need to count, separate of my other ones that belongs to another templates
      It seems to work, I just don't know if this is the way lol

      Thank you!!

      Comment

      Working...