Ad Widget

Collapse

host.delete error "No permissions to referred object or it does not exist!"

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rajlistuser
    Junior Member
    • Mar 2018
    • 11

    #1

    host.delete error "No permissions to referred object or it does not exist!"

    Hello,

    I am using Zabbix API in python connecting to Zabbix API Version 3.4.7 to add and delete hosts from docker events. I am testing with Admin user and host.add works as expected. But host.delete is giving me the following error:

    Code:
    Response Body: {
        "jsonrpc": "2.0",
        "id": 8,
        "error": {
            "message": "Application error.",
            "code": -32500,
            "data": "No permissions to referred object or it does not exist!"
        }
    }
    My request is as follows:

    Code:
    Sending: {
        "params": [
            [
                "10269"
            ]
        ],
        "jsonrpc": "2.0",
        "method": "host.delete",
        "auth": "19742d8e0f7b9029186abe7ffe642336",
        "id": 8
    }
    The object does exist as I do a host.get prior to deletion. The host.get response is as follows:


    Code:
    Sending: {
        "params": {
            "filter": {
                "host": "docker-simple-ha-3251"
            }
        },
        "jsonrpc": "2.0",
        "method": "host.get",
        "auth": "19742d8e0f7b9029186abe7ffe642336",
        "id": 7
    }
    Response Code: 200
    Response Body: {
        "jsonrpc": "2.0",
        "result": [
            {
                "available": "0",
                "tls_connect": "1",
                "maintenance_type": "0",
                "ipmi_errors_from": "0",
                "ipmi_username": "",
                "snmp_disable_until": "0",
                "ipmi_authtype": "-1",
                "ipmi_disable_until": "0",
                "lastaccess": "0",
                "snmp_error": "",
                "tls_psk": "",
                "ipmi_privilege": "2",
                "jmx_error": "",
                "jmx_available": "0",
                "maintenanceid": "0",
                "snmp_available": "0",
                "tls_psk_identity": "",
                "status": "1",
                "description": "",
                "tls_accept": "1",
                "host": "docker-simple-ha-3251",
                "disable_until": "0",
                "ipmi_password": "",
                "templateid": "0",
                "tls_issuer": "",
                "ipmi_available": "0",
                "maintenance_status": "0",
                "snmp_errors_from": "0",
                "ipmi_error": "",
                "proxy_hostid": "0",
                "hostid": "10269",
                "name": "docker-simple-ha-3251",
                "jmx_errors_from": "0",
                "jmx_disable_until": "0",
                "flags": "0",
                "error": "",
                "maintenance_from": "0",
                "tls_subject": "",
                "errors_from": "0"
            }
        ],
        "id": 7
    }
    I have gone through all the google results and could not find any link relevant to this situation.

    Any help to get this moving will be much appreciated.
  • alexthefifth
    Junior Member
    • Feb 2019
    • 11

    #2
    In case someone else runs into this problem (I ran into something similar with pyzabbix), the problem is within the request body -- there is a list within a list for the "params":

    Code:
    ...
    
     Sending: {     "params": [         [             "10269"         ]     ]
    ...
    In my case I was calling:
    Code:
    zapi.host.delete(params=['1111'])
    but I should have been calling:
    Code:
    zapi.host.delete('1111')

    Comment

    • max.ch.88
      Senior Member
      • Oct 2018
      • 206

      #3
      Originally posted by rajlistuser

      My request is as follows:

      Code:
      Sending: {
      "params": [
      [
      "10269"
      ]
      ],
      "jsonrpc": "2.0",
      "method": "host.delete",
      "auth": "19742d8e0f7b9029186abe7ffe642336",
      "id": 8
      }
      .
      Hi. You have extra brackets. Look at differences in the example.

      https://www.zabbix.com/documentation...ce/host/delete
      { "jsonrpc": "2.0", "method": "host.delete", "params": [ "13", "32" ], "auth": "038e1d7b1735c6a5436ee9eae095879e", "id": 1 }
      Last edited by max.ch.88; 19-03-2019, 19:35.

      Comment

      Working...