Ad Widget

Collapse

JSON API: Host creating failed

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • marcherren
    Junior Member
    • Mar 2011
    • 28

    #1

    JSON API: Host creating failed

    Hi,

    I'm using a simple perl script to add hosts in a DM environment.

    I'm now strungling that I cannot add hosts on one of the nodes (it works well with the other)

    The error message itself is "No permissions to referred object or it does not exist!'"

    Does someone know what exactly this means? Is it somehow possible to exactly know which object it refers to?

    I've verified templateid and 100100000000006 and they are correct (actually I retrieve them via another JSON call)

    Here my JSON request:

    $VAR1 = {
    'auth' => '2372ffb05694d2ee7295837a74c8f7e0',
    'params' => {
    'interfaces' => [
    {
    'dns' => '',
    'useip' => 1,
    'ip' => '10.0.2.152',
    'type' => 2,
    'port' => 10050,
    'main' => 1
    }
    ],
    'nodeids' => 1,
    'groups' => [
    {
    'groupid' => '100100000000006'
    }
    ],
    'name' => 'FAEGFE02',
    'output' => 'extend',
    'templates' => [
    {
    'templateid' => '100100000010089'
    }
    ],
    'host' => 'FAEGFE02'
    },
    'jsonrpc' => '2.0',
    'id' => 3,
    'method' => 'host.create'
    };

    and the response :

    $VAR1 = bless( {
    'version' => 0,
    'content' => {
    'jsonrpc' => '2.0',
    'error' => {
    'data' => 'No permissions to referred object or it does not exist!',
    'message' => 'Application error.',
    'code' => -32500
    },
    'id' => 3
    },
    'jsontext' => '{"jsonrpc":"2.0","error":{"code":-32500,"message":"Application error.","data":"No permissions to referred object or it does not exist!"},"id":3}',
    'is_success' => 0
    }, 'JSON::RPC::Legacy::ReturnObject' );
  • marcherren
    Junior Member
    • Mar 2011
    • 28

    #2
    Ok, this is really strange.

    Let's say I have my host.create working on nodeid 1 and failing on nodeid2.

    If I now add the user on nodeid 2 into the "Enable debug user" group it then works with nodeid2 and no longer with nodeid 1.

    I can swap this behavior easily by adding/removing the user into the debug group.

    -> Created ZBX-5209

    Comment

    • getUP
      Member
      • Jun 2006
      • 34

      #3
      I'm not sure if the issues I'm having are related to ZBX-5209 but I'm having similar problems.

      [data] => No permissions to referred object or it does not exist!

      The command basically looks like this.

      {
      "method":"host.create",
      "params":{
      "host":"test-dev2",
      "name":"test-dev2",
      "interfaces":{
      "type":1,
      "main":1,
      "useip":1,
      "ip":"192.168.40.51",
      "dns":0,
      "port":10050
      },
      "groups":{
      "groupid":"100100000000005"
      },
      "status":1
      },
      "jsonrpc":"2.0",
      "id":2,
      "auth":"db5ffcfa0c568f6ee4a8fb77adc8a502"
      }

      Comment

      Working...