Ad Widget

Collapse

Zabbix 3.0 broke my utility

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • StarDestroyer
    Junior Member
    • Jun 2014
    • 20

    #1

    Zabbix 3.0 broke my utility

    I have a small utility that has been very useful to us here internally. You simply visit the webpage and it will return a list of all servers that currently have an active trigger. It's been working great for quite some time. I just updated to v3.0 and it's now essentially useless.

    How it works

    It's a very simple utility. There's some logic server side to handle authenticating with a read-only ID. Once that auth is processed, it sends a simple query to the API:

    Code:
    {"jsonrpc":"2.0",
      "method":"trigger.get",
      "auth":"<valid>",
      "id":1,
      "params":{"output":["triggerid","description","priority","error"],
                "expandData":1,
    			"expandDescription":1,
    			"filter":{"value":1,
    			          "status":0
    					  }
    			}
    }
    In v2, this returned a list of all active triggers along with their hostname and a few details about the trigger. This allowed me to build a webpage with some simple JavaScript that contained all servers with an active trigger.

    In v3, this returns almost all of the above information. It does not contain the hostname (or any value I can find that even points to the host with the issue). This makes it impossible to list the servers that are having the issues... only a semi-cryptic list of issues.

    It seems that this is because v2.4 deprecated the "expandData" param and v3.0 removed it. However, I cannot locate any replacement for this parameter.
  • jrbeilke
    Junior Member
    • May 2016
    • 4

    #2
    According to the API docs trigger.get has the "selectHosts" parameter which will "Return the hosts that the trigger belongs to in the hosts property."



    I am using this with my own queries in 3.0 and am able to get the hostid and name with the trigger.get query.

    "selectHosts": ["hostid", "name"]

    Comment

    • jan.garaj
      Senior Member
      Zabbix Certified Specialist
      • Jan 2010
      • 506

      #3
      You need:
      Code:
      "selectHosts": "extend",
      Test it with ZAPIX trigget.get query .
      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

      • StarDestroyer
        Junior Member
        • Jun 2014
        • 20

        #4
        Thank-you both for your replies. Friday afternoon I reverted my installation to v2.4 (I had not actually intended to update to 3.0 yet... I was doing a server migration and had installed 3.0 on the new server).

        However, seeing who this 'selectHosts' param exists in v2.4, I migrated my utility to use that instead. I had to do some minor changes to it as 'selectHosts' returns data different than 'expandData' did, but all the data was there and full functionality was restored.

        Now when I do finally update to v3.0 (which is in the plans) I'm pretty confident everything will continue to work as expected .

        Comment

        Working...