Uploaded image for project: 'ZABBIX FEATURE REQUESTS'
  1. ZABBIX FEATURE REQUESTS
  2. ZBXNEXT-5415

usermacro.get results not as expected

XMLWordPrintable

    • Icon: Change Request Change Request
    • Resolution: Duplicate
    • Icon: Major Major
    • None
    • 4.2.6
    • API (A)
    • None

      I've started writing some script which is using my zapish https://github.com/kloczek/zapish/ to have basic macro operations from commandline like get, update, delete and create host macros.
      On writing that script I've been using documentation https://www.zabbix.com/documentation/4.2/manual/api/reference/usermacro/get

      On writing get command I found that resuts which are produced by API are not as I've been expecting.
      So on calling API usermacro.get using curl I have:

      $ curl --silent -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","method":"usermacro.get","params":{"output":"extended","hostid":"10457"},"auth":"3ca3d45adf4f52b9027476dfbe2f89b4","id":0}' http://zabbix.mustard/api_jsonrpc.php; echo
      {"jsonrpc":"2.0","result":[{"hostmacroid":"835"},{"hostmacroid":"836"},{"hostmacroid":"837"},{"hostmacroid":"838"},{"hostmacroid":"839"},{"hostmacroid":"781"},{"hostmacroid":"780"},{"hostmacroid":"778"},{"hostmacroid":"777"},{"hostmacroid":"779"},{"hostmacroid":"774"},{"hostmacroid":"773"},{"hostmacroid":"776"},{"hostmacroid":"775"},{"hostmacroid":"351"},{"hostmacroid":"352"},{"hostmacroid":"356"},{"hostmacroid":"357"},{"hostmacroid":"358"},{"hostmacroid":"359"},{"hostmacroid":"363"},{"hostmacroid":"364"},{"hostmacroid":"365"},{"hostmacroid":"366"},{"hostmacroid":"367"},{"hostmacroid":"369"},{"hostmacroid":"368"},{"hostmacroid":"370"},{"hostmacroid":"372"},{"hostmacroid":"371"},{"hostmacroid":"373"},{"hostmacroid":"375"},{"hostmacroid":"374"},{"hostmacroid":"376"},{"hostmacroid":"378"},{"hostmacroid":"377"},{"hostmacroid":"382"},{"hostmacroid":"384"},{"hostmacroid":"383"},{"hostmacroid":"385"},{"hostmacroid":"386"},{"hostmacroid":"397"},{"hostmacroid":"396"},{"hostmacroid":"398"},{"hostmacroid":"395"},{"hostmacroid":"399"},{"hostmacroid":"393"},{"hostmacroid":"394"},{"hostmacroid":"412"},{"hostmacroid":"409"},{"hostmacroid":"411"},{"hostmacroid":"404"},{"hostmacroid":"405"},{"hostmacroid":"406"},{"hostmacroid":"413"},{"hostmacroid":"408"},{"hostmacroid":"410"},{"hostmacroid":"414"},{"hostmacroid":"402"},{"hostmacroid":"407"},{"hostmacroid":"403"},{"hostmacroid":"668"},{"hostmacroid":"669"},{"hostmacroid":"420"},{"hostmacroid":"422"},{"hostmacroid":"419"},{"hostmacroid":"421"},{"hostmacroid":"425"},{"hostmacroid":"417"},{"hostmacroid":"418"},{"hostmacroid":"431"},{"hostmacroid":"433"},{"hostmacroid":"430"},{"hostmacroid":"432"},{"hostmacroid":"436"},{"hostmacroid":"428"},{"hostmacroid":"429"},{"hostmacroid":"670"},{"hostmacroid":"671"},{"hostmacroid":"673"},{"hostmacroid":"652"},{"hostmacroid":"653"},{"hostmacroid":"655"},{"hostmacroid":"654"},{"hostmacroid":"648"},{"hostmacroid":"649"},{"hostmacroid":"651"},{"hostmacroid":"650"},{"hostmacroid":"439"},{"hostmacroid":"674"},{"hostmacroid":"442"},{"hostmacroid":"675"},{"hostmacroid":"443"},{"hostmacroid":"440"},{"hostmacroid":"441"},{"hostmacroid":"676"},{"hostmacroid":"475"},{"hostmacroid":"472"},{"hostmacroid":"474"},{"hostmacroid":"476"},{"hostmacroid":"471"},{"hostmacroid":"473"},{"hostmacroid":"477"},{"hostmacroid":"469"},{"hostmacroid":"470"},{"hostmacroid":"484"},{"hostmacroid":"483"},{"hostmacroid":"485"},{"hostmacroid":"482"},{"hostmacroid":"486"},{"hostmacroid":"480"},{"hostmacroid":"481"},{"hostmacroid":"493"},{"hostmacroid":"492"},{"hostmacroid":"494"},{"hostmacroid":"491"},{"hostmacroid":"495"},{"hostmacroid":"489"},{"hostmacroid":"490"},{"hostmacroid":"505"},{"hostmacroid":"502"},{"hostmacroid":"506"},{"hostmacroid":"501"},{"hostmacroid":"507"},{"hostmacroid":"500"},{"hostmacroid":"498"},{"hostmacroid":"499"},{"hostmacroid":"515"},{"hostmacroid":"510"},{"hostmacroid":"511"},{"hostmacroid":"516"},{"hostmacroid":"514"},{"hostmacroid":"512"},{"hostmacroid":"513"},{"hostmacroid":"519"},{"hostmacroid":"517"},{"hostmacroid":"518"},{"hostmacroid":"534"},{"hostmacroid":"533"},{"hostmacroid":"535"},{"hostmacroid":"538"},{"hostmacroid":"536"},{"hostmacroid":"537"},{"hostmacroid":"544"},{"hostmacroid":"543"},{"hostmacroid":"647"},{"hostmacroid":"549"},{"hostmacroid":"541"},{"hostmacroid":"547"},{"hostmacroid":"542"},{"hostmacroid":"548"},{"hostmacroid":"557"},{"hostmacroid":"555"},{"hostmacroid":"554"},{"hostmacroid":"558"},{"hostmacroid":"556"},{"hostmacroid":"552"},{"hostmacroid":"561"},{"hostmacroid":"559"},{"hostmacroid":"553"},{"hostmacroid":"560"},{"hostmacroid":"574"},{"hostmacroid":"575"},{"hostmacroid":"579"},{"hostmacroid":"580"},{"hostmacroid":"572"},{"hostmacroid":"578"},{"hostmacroid":"576"},{"hostmacroid":"573"},{"hostmacroid":"577"},{"hostmacroid":"585"},{"hostmacroid":"584"},{"hostmacroid":"586"},{"hostmacroid":"583"},{"hostmacroid":"589"},{"hostmacroid":"582"},{"hostmacroid":"587"},{"hostmacroid":"581"},{"hostmacroid":"588"},{"hostmacroid":"596"},{"hostmacroid":"595"},{"hostmacroid":"597"},{"hostmacroid":"594"},{"hostmacroid":"592"},{"hostmacroid":"593"},{"hostmacroid":"601"},{"hostmacroid":"602"},{"hostmacroid":"603"},{"hostmacroid":"604"},{"hostmacroid":"623"},{"hostmacroid":"619"},{"hostmacroid":"656"},{"hostmacroid":"624"},{"hostmacroid":"620"},{"hostmacroid":"657"},{"hostmacroid":"627"},{"hostmacroid":"622"},{"hostmacroid":"625"},{"hostmacroid":"621"},{"hostmacroid":"626"},{"hostmacroid":"631"},{"hostmacroid":"630"},{"hostmacroid":"637"},{"hostmacroid":"635"},{"hostmacroid":"632"},{"hostmacroid":"636"},{"hostmacroid":"672"},{"hostmacroid":"658"},{"hostmacroid":"659"},{"hostmacroid":"660"},{"hostmacroid":"661"},{"hostmacroid":"662"},{"hostmacroid":"663"},{"hostmacroid":"664"},{"hostmacroid":"665"},{"hostmacroid":"666"},{"hostmacroid":"667"},{"hostmacroid":"677"},{"hostmacroid":"678"},{"hostmacroid":"679"},{"hostmacroid":"680"},{"hostmacroid":"681"},{"hostmacroid":"682"},{"hostmacroid":"683"},{"hostmacroid":"684"},{"hostmacroid":"685"},{"hostmacroid":"686"},{"hostmacroid":"687"},{"hostmacroid":"688"},{"hostmacroid":"689"},{"hostmacroid":"690"},{"hostmacroid":"691"},{"hostmacroid":"692"},{"hostmacroid":"693"},{"hostmacroid":"694"},{"hostmacroid":"695"},{"hostmacroid":"696"},{"hostmacroid":"697"},{"hostmacroid":"698"},{"hostmacroid":"699"},{"hostmacroid":"700"},{"hostmacroid":"701"},{"hostmacroid":"702"},{"hostmacroid":"703"},{"hostmacroid":"704"},{"hostmacroid":"705"},{"hostmacroid":"706"},{"hostmacroid":"707"},{"hostmacroid":"708"},{"hostmacroid":"709"},{"hostmacroid":"710"},{"hostmacroid":"711"},{"hostmacroid":"712"},{"hostmacroid":"713"},{"hostmacroid":"714"},{"hostmacroid":"715"},{"hostmacroid":"716"},{"hostmacroid":"717"},{"hostmacroid":"718"},{"hostmacroid":"719"},{"hostmacroid":"720"},{"hostmacroid":"721"},{"hostmacroid":"722"},{"hostmacroid":"723"},{"hostmacroid":"724"},{"hostmacroid":"725"},{"hostmacroid":"726"},{"hostmacroid":"727"},{"hostmacroid":"728"},{"hostmacroid":"729"},{"hostmacroid":"730"},{"hostmacroid":"731"},{"hostmacroid":"732"},{"hostmacroid":"733"},{"hostmacroid":"734"},{"hostmacroid":"735"},{"hostmacroid":"736"},{"hostmacroid":"737"},{"hostmacroid":"738"},{"hostmacroid":"739"},{"hostmacroid":"740"},{"hostmacroid":"741"},{"hostmacroid":"742"},{"hostmacroid":"743"},{"hostmacroid":"744"},{"hostmacroid":"745"},{"hostmacroid":"746"},{"hostmacroid":"747"},{"hostmacroid":"748"},{"hostmacroid":"749"},{"hostmacroid":"750"},{"hostmacroid":"751"},{"hostmacroid":"752"},{"hostmacroid":"753"},{"hostmacroid":"754"},{"hostmacroid":"755"},{"hostmacroid":"756"},{"hostmacroid":"757"},{"hostmacroid":"758"},{"hostmacroid":"759"},{"hostmacroid":"760"},{"hostmacroid":"761"},{"hostmacroid":"762"},{"hostmacroid":"763"},{"hostmacroid":"764"},{"hostmacroid":"765"},{"hostmacroid":"766"},{"hostmacroid":"768"},{"hostmacroid":"767"},{"hostmacroid":"769"},{"hostmacroid":"770"},{"hostmacroid":"771"},{"hostmacroid":"772"},{"hostmacroid":"782"},{"hostmacroid":"783"},{"hostmacroid":"784"},{"hostmacroid":"785"},{"hostmacroid":"786"},{"hostmacroid":"787"},{"hostmacroid":"788"},{"hostmacroid":"789"},{"hostmacroid":"790"},{"hostmacroid":"791"},{"hostmacroid":"792"},{"hostmacroid":"793"},{"hostmacroid":"794"},{"hostmacroid":"795"},{"hostmacroid":"796"},{"hostmacroid":"797"},{"hostmacroid":"798"},{"hostmacroid":"799"},{"hostmacroid":"800"},{"hostmacroid":"801"},{"hostmacroid":"802"},{"hostmacroid":"815"},{"hostmacroid":"861"},{"hostmacroid":"804"},{"hostmacroid":"831"},{"hostmacroid":"833"},{"hostmacroid":"832"},{"hostmacroid":"830"},{"hostmacroid":"828"},{"hostmacroid":"812"},{"hostmacroid":"822"},{"hostmacroid":"829"},{"hostmacroid":"827"},{"hostmacroid":"826"},{"hostmacroid":"813"},{"hostmacroid":"824"},{"hostmacroid":"806"},{"hostmacroid":"808"},{"hostmacroid":"805"},{"hostmacroid":"807"},{"hostmacroid":"825"},{"hostmacroid":"809"},{"hostmacroid":"810"},{"hostmacroid":"811"},{"hostmacroid":"823"},{"hostmacroid":"821"},{"hostmacroid":"834"},{"hostmacroid":"840"},{"hostmacroid":"841"},{"hostmacroid":"842"},{"hostmacroid":"843"},{"hostmacroid":"844"},{"hostmacroid":"845"},{"hostmacroid":"846"},{"hostmacroid":"847"},{"hostmacroid":"848"},{"hostmacroid":"849"},{"hostmacroid":"850"},{"hostmacroid":"851"},{"hostmacroid":"852"},{"hostmacroid":"853"},{"hostmacroid":"854"},{"hostmacroid":"855"},{"hostmacroid":"856"},{"hostmacroid":"857"},{"hostmacroid":"858"},{"hostmacroid":"859"},{"hostmacroid":"860"}],"id":0
      

      which is not what I've been expecting like on example on documentation and to be honest I have no idea what exactly it is in that output.

      Quickest way to reproduce result in your env is clone https://github.com/kloczek/zapish than go to examples/ directory and execute "./host_macro get <some_host_name>"

            zabbix.dev Zabbix Development Team
            kloczek Tomasz Kłoczko
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: