Ad Widget

Collapse

Zabbix 1.9.9 API Host.create() trouble

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sire
    Senior Member
    • Jul 2010
    • 210

    #1

    Zabbix 1.9.9 API Host.create() trouble

    Hi all,

    I am trying to create a host in 1.9.9 using Zabbix API, but it fails.

    Here is my JSON-RPC object:
    PHP Code:
    {
       
    "params" : {
          
    "interfaces" : [
             {
                
    "useip" 1,
                
    "ip" "10.1.2.3",
                
    "type" 1,
                
    "port" 10050
             
    },
             {
                
    "useip" 1,
                
    "ip" "10.1.2.3",
                
    "type" 2,
                
    "port" 161
             
    }
          ],
          
    "groups" : [
             {
                
    "groupid" "11"
             
    }
          ],
          
    "templates" : [
             {
                
    "templateid" "10049"
             
    }
          ],
          
    "host" "myhost1"
       
    },
       
    "auth" "f201fa9018f8f59fca8aea5577aab156",
       
    "jsonrpc" "2.0",
       
    "method" "host.create",
       
    "id" 7

    I get the following error message:
    PHP Code:
    In create_hostError: {"data":"Incorrect arguments passed to function","message":"Invalid params.","code":-32602
    I have double checked that group and template ids do exist. I guess this might be a typo or brackets issue, but I can't find it.

    Host.create() call worked for me flawlessly in 1.8. I modified it for use with 1.9 according to this manual: http://www.zabbix.com/documentation/...pi/host/create

    Please, somebody help me

    I should have possible post this message to Zabbix Troubleshooting and Problems thread, sorry if I did it wrong.
    Last edited by sire; 03-02-2012, 14:42.
    Regards,
    Sergey Syreskin

    Monitored hosts: 2646 / Active items: 23604 / Server performance: 765.74

    Temporary out of Zabbix business
  • sire
    Senior Member
    • Jul 2010
    • 210

    #2
    Update:

    By debugging Zabbix API I have figured out, that fields "main" and "dns" are mandatory in the "interfaces" section. However, after adding the above fields to my JSON request, I get another error: "You do not have permission to perform this operation". The user, that connects to Zabbix API is a member of the "Zabbix administrators" group and is a Zabbix Super-Administrator, so the problem seems to be in permission check routines.
    Regards,
    Sergey Syreskin

    Monitored hosts: 2646 / Active items: 23604 / Server performance: 765.74

    Temporary out of Zabbix business

    Comment

    • sire
      Senior Member
      • Jul 2010
      • 210

      #3
      IMHO this bug is caused by the https://support.zabbix.com/browse/ZBX-4615 issue.
      Regards,
      Sergey Syreskin

      Monitored hosts: 2646 / Active items: 23604 / Server performance: 765.74

      Temporary out of Zabbix business

      Comment

      Working...