API does not delete old entries when you add an element to a screen

XMLWordPrintable

    • Type: Incident report
    • Resolution: Fixed
    • Priority: Major
    • None
    • Affects Version/s: None
    • Component/s: API (A)
    • None

      Let's say I have a screen with id 7, and a graph with id 390.

      I add (using python lib for the API) the graph to the screen at position x=0,y=1 , the trace :

      20: url: http://10.2.23.10/zabbix/api_jsonrpc.php
      10: Trying to login with 'api':'md5(8a5da52ed126447d359e70c05721a8aa)'
      10: json_obj: {'params':

      {'password': 'api', 'user': 'api'}

      , 'jsonrpc': '2.0', 'method': 'user.authenticate', 'auth': '', 'id': 0}
      10: Connection object <httplib.HTTPConnection instance at 0x1a09a70>
      20: Sending: {"params":

      {"password": "api", "user": "api"}

      , "jsonrpc": "2.0", "method": "user.authenticate", "auth": "", "id": 0}
      10: Sending headers:

      {'Content-Type': 'application/json-rpc', 'User-Agent': 'python/zabbix_api'}

      20: Response Code: 200 OK
      10: Response Body:

      {'jsonrpc': '2.0', 'result': 'a1d06d59703117af287be229ddbddc4f', 'id': 0}

      10: json_obj: {'params': {}, 'jsonrpc': '2.0', 'method': 'APIInfo.version', 'auth': 'a1d06d59703117af287be229ddbddc4f', 'id': 1}
      10: Connection object <httplib.HTTPConnection instance at 0x1a09cb0>
      20: Sending: {"params": {}, "jsonrpc": "2.0", "method": "APIInfo.version", "auth": "a1d06d59703117af287be229ddbddc4f", "id": 1}
      10: Sending headers:

      {'Content-Type': 'application/json-rpc', 'User-Agent': 'python/zabbix_api'}

      20: Response Code: 200 OK
      10: Response Body:

      {'jsonrpc': '2.0', 'result': '1.2', 'id': 1}

      Zabbix API Version: 1.2
      10: json_obj: {'params':

      {'sessionid': 'a1d06d59703117af287be229ddbddc4f'}

      , 'jsonrpc': '2.0', 'method': 'user.checkAuthentication', 'auth': 'a1d06d59703117af287be229ddbddc4f', 'id': 2}
      10: Connection object <httplib.HTTPConnection instance at 0x1a09dd0>
      20: Sending: {"params":

      {"sessionid": "a1d06d59703117af287be229ddbddc4f"}

      , "jsonrpc": "2.0", "method": "user.checkAuthentication", "auth": "a1d06d59703117af287be229ddbddc4f", "id": 2}
      10: Sending headers:

      {'Content-Type': 'application/json-rpc', 'User-Agent': 'python/zabbix_api'}

      20: Response Code: 200 OK
      10: Response Body:

      {'jsonrpc': '2.0', 'result': True, 'id': 2}

      Logged in: True
      10: json_obj: {'params': {'screenitems': [

      {'rowspan': '0', 'width': '500', 'resourcetype': '0', 'resourceid': '390', 'dynamic': '0', 'height': '100', 'halign': '0', 'url': '', 'y': 1, 'x': 0}

      ], 'screenids': ['7']}, 'jsonrpc': '2.0', 'method': 'screen.addItems', 'auth': 'a1d06d59703117af287be229ddbddc4f', 'id': 3}
      10: Connection object <httplib.HTTPConnection instance at 0x1a09d88>
      20: Sending: {"params": {"screenitems": [

      {"rowspan": "0", "width": "500", "resourcetype": "0", "resourceid": "390", "dynamic": "0", "height": "100", "halign": "0", "url": "", "y": 1, "x": 0}

      ], "screenids": ["7"]}, "jsonrpc": "2.0", "method": "screen.addItems", "auth": "a1d06d59703117af287be229ddbddc4f", "id": 3}
      10: Sending headers:

      {'Content-Type': 'application/json-rpc', 'User-Agent': 'python/zabbix_api'}

      20: Response Code: 200 OK
      10: Response Body:

      {'jsonrpc': '2.0', 'result': True, 'id': 3}

      I execute it many times, then if I try to get the screen_items they are all here. Even with sql :
      mysql> select count from screens_items where resourceid=390 and x=0 and y=1 and screenid=7;
      -------------

      count

      -------------

      9

      -------------

      I think that when you add a new screen_item to some position, the previous item should be deleted from the table.

            Assignee:
            Unassigned
            Reporter:
            Maxence Dunnewind
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: