Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-11524

no way to limit on hosts/templates for usermacro.get

XMLWordPrintable

    • Icon: Incident report Incident report
    • Resolution: Unresolved
    • Icon: Trivial Trivial
    • None
    • 3.4.0alpha1
    • API (A)
    • tried also with 2.4, same problem

      have a host linked to a template with one usermacro with the same usermacro name in both.

      perform an api request :

      {
         "auth" : "cdb57c2c8ec88bfd1818a1c57175a460",
         "params" : {
            "selectHosts" : [
               "host"
            ],
            "filter" : {
               "macro" : "{$CPU_LOAD_THRESHOLD}"
            },
            "output" : [
               "value"
            ]
         },
         "id" : "9094709340",
         "jsonrpc" : "2.0",
         "method" : "usermacro.get"
      }
      

      the response :

      {
         "id" : "9094709340",
         "result" : [
            {
               "value" : "1",
               "hosts" : [],
               "hostmacroid" : "1"
            },
            {
               "value" : "0.9",
               "hostmacroid" : "2",
               "hosts" : [
                  {
                     "hostid" : "10105",
                     "host" : "A test host"
                  }
               ]
            }
         ],
         "jsonrpc" : "2.0"
      }
      

      notice how the host info for the first macro is empty. that's because it is a macro from the template.

      item.get offers at least some way to limit to templates/hosts with 'templated' and 'monitored' parameters. the empty structure is very confusing and it would be great to have a way to limit this api call to hosts/templates.

            Unassigned Unassigned
            richlv richlv
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: