Ad Widget

Collapse

zabbix 2.2.3 api host/hostgroup massremove do not work

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • frederic.martinsons
    Junior Member
    • May 2014
    • 2

    #1

    zabbix 2.2.3 api host/hostgroup massremove do not work

    Hello, i'm on linux and i decide to go and give a try to the zabbix API.

    No problem getting a list of host/host group/template. No problem to add a host to an host group but I didn't manage to remove a host from a group. I used to functions, the two of them didn't work. See the message below.

    for host.massremove I send:
    Code:
    {
        'method': 'host.massremove',
        'params': {
            'groups': [{'groupid': '17'}],
            'hosts': [{'hostid': '10205'}]
        },
        'jsonrpc': '2.0',
        'id': 4,
        'auth': '10ad0fac3d0e6a75237b3af6a6837183'
    }
    and I got:
    Code:
    {
        "id": 4,
        "jsonrpc": "2.0",
        "error": {
            "code": -32500,
            "message": "Application error.",
            "data": "You do not have permission to perform this operation."
        }
    }
    I'm logged into Admin and I have no problem removinf from host by the web frontend with the same account.

    More disturbing is the hostgroup.massremove method when I send:
    Code:
    {
        'method': 'hostgroup.massremove',
        'params': {
            'groups': [{'groupid': '17'}],
            'hosts': [{'hostid': '10205'}]
        },
        'jsonrpc': '2.0',
        'id': 4,
        'auth': '6aa88a60ff12f502ab73b36fb1c86176'
    }
    I got:
    Code:
    {
        "result": {
            "groupids": null
        },
        "jsonrpc": "2.0",
        "id": 4
    }
    So I don't understand what's going on with these remove functions. I saw several bug reporting about this kind of behavior but all for 2.0.x and 1.8.x and all fix. I didn't found any log on the zabbix server showing something in particular.

    Can you please help me with this problem ?
  • frederic.martinsons
    Junior Member
    • May 2014
    • 2

    #2
    Well nervermind, I completely failed to put the right parameters of the functions. The right parameters are :
    Code:
       'params': {
           'hostids': ['10200'],
           'groupids': ['17']}
        },
    instead of :
    Code:
        'params': {
            'groups': [{'groupid': '17'}],
            'hosts': [{'hostid': '10205'}]
        },
    Sorry for this. Nevertheless, it seems to be a good idea to reply with a more meaningful message other than "You do not have permission to perform this operation" , something like "unknown or bad parameters".

    Originally posted by frederic.martinsons
    Hello, i'm on linux and i decide to go and give a try to the zabbix API.

    No problem getting a list of host/host group/template. No problem to add a host to an host group but I didn't manage to remove a host from a group. I used to functions, the two of them didn't work. See the message below.

    for host.massremove I send:
    Code:
    {
        'method': 'host.massremove',
        'params': {
            'groups': [{'groupid': '17'}],
            'hosts': [{'hostid': '10205'}]
        },
        'jsonrpc': '2.0',
        'id': 4,
        'auth': '10ad0fac3d0e6a75237b3af6a6837183'
    }
    and I got:
    Code:
    {
        "id": 4,
        "jsonrpc": "2.0",
        "error": {
            "code": -32500,
            "message": "Application error.",
            "data": "You do not have permission to perform this operation."
        }
    }
    I'm logged into Admin and I have no problem removinf from host by the web frontend with the same account.

    More disturbing is the hostgroup.massremove method when I send:
    Code:
    {
        'method': 'hostgroup.massremove',
        'params': {
            'groups': [{'groupid': '17'}],
            'hosts': [{'hostid': '10205'}]
        },
        'jsonrpc': '2.0',
        'id': 4,
        'auth': '6aa88a60ff12f502ab73b36fb1c86176'
    }
    I got:
    Code:
    {
        "result": {
            "groupids": null
        },
        "jsonrpc": "2.0",
        "id": 4
    }
    So I don't understand what's going on with these remove functions. I saw several bug reporting about this kind of behavior but all for 2.0.x and 1.8.x and all fix. I didn't found any log on the zabbix server showing something in particular.

    Can you please help me with this problem ?

    Comment

    Working...