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

API: exception when delete hostgroup

XMLWordPrintable

    • Icon: Incident report Incident report
    • Resolution: Fixed
    • Icon: Major Major
    • 2.0.0
    • 2.0.0
    • Documentation (D)
    • None

      I've discovered a weird behavior when creating and deleting a hostgroup. Api user is member of Zabbix administrators user group which has permission to manipulate all hostgroups.

      Error can be reproduced as shown below:

      1. Create a new hostgroup
      2. request
        POST /zabbix/api_jsonrpc.php HTTP/1.1
        Content-Type: application/json

      {
      "jsonrpc":"2.0",
      "method":"hostgroup.create",
      "params":[

      {"name":"new_group"}

      ],
      "auth":"780eda433f4c24b67bec89244c7976e6",
      "id":3
      }

      1. response
        HTTP/1.1 200 OK
        Content-Length: 53
        Date: Wed, 20 Jun 2012 15:42:21 GMT
        Server: Apache/2.2.16 (Debian)
        X-Powered-By: PHP/5.3.3-7+squeeze8
        Connection: close
        Content-Type: application/json

      {"jsonrpc":"2.0","result":

      {"groupids":["10"]}

      ,"id":3}

      1. Try to destroy newly created hostgroup
      1. request
        POST /zabbix/api_jsonrpc.php HTTP/1.1
        Content-Type: application/json

      {
      "jsonrpc":"2.0",
      "method":"hostgroup.delete",
      "params":[

      { "groupid":10 }

      ],
      "auth":"780eda433f4c24b67bec89244c7976e6",
      "id":2
      }

      1. response
        HTTP/1.1 200 OK
        Content-Length: 1106
        Date: Wed, 20 Jun 2012 15:43:54 GMT
        Server: Apache/2.2.16 (Debian)
        X-Powered-By: PHP/5.3.3-7+squeeze8
        Connection: close
        Content-Type: application/json

      {"jsonrpc":"2.0","error":{"code":-32500,"message":"Application error.","data":"You do not have permission to perform this operation.","debug":[

      {"file":"\/opt\/share\/zabbix\/frontend\/api\/classes\/CHostGroup.php","line":715,"function":"exception","class":"CZBXAPI","type":"::","args":[120,"You do not have permission to perform this operation."]}

      ,{"function":"delete","class":"CHostGroup","type":"->","args":[[

      {"groupid":10}

      ]]},{"file":"\/opt\/share\/zabbix\/frontend\/api\/rpc\/class.czbxrpc.php","line":106,"function":"call_user_func","args":[[{},"delete"],[

      {"groupid":10}

      ]]},{"file":"\/opt\/share\/zabbix\/frontend\/api\/rpc\/class.czbxrpc.php","line":64,"function":"callAPI","class":"czbxrpc","type":"::","args":["hostgroup.delete",[

      {"groupid":10}

      ]]},{"file":"\/opt\/share\/zabbix\/frontend\/api\/rpc\/class.cjsonrpc.php","line":66,"function":"call","class":"czbxrpc","type":"::","args":["hostgroup.delete",[

      {"groupid":10}

      ],"780eda433f4c24b67bec89244c7976e6"]},

      {"file":"\/opt\/share\/zabbix\/frontend\/api_jsonrpc.php","line":54,"function":"execute","class":"CJSONrpc","type":"->","args":[]}

      ]},"id":2}

            Unassigned Unassigned
            tadejm Tadej Murovec
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: