Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-1852

1.0 API (with Zabbix 1.8) unable to create host based on initial 5 groups even with super-user privileges.

XMLWordPrintable

    • Icon: Incident report Incident report
    • Resolution: Won't fix
    • Icon: Critical Critical
    • None
    • 1.8
    • API (A)
    • None
    • Tested to be true on Gentoo x86 and CentOS 5.4 x86-64-bit via a PHP-based JSON-RPC navigator...

      Via the JSON-RPC API, users are currently unable to create a host based on a hostgroup that was defined during the initial setup, (groups 1-5). This was attempted with various users with various permissions, even the administrative user with full privileges to everything. I am using the PHP API for Zabbix that I created for this, but I'm sure this would hold true for any API calls. For example, if you attempt to call the following...

      ZabbixAPI::query('host','create',array('host'=>'test','groups'=>array(2)));

      It returns the following error...

      [ CHost::create ] You do not have enough rights for operation

      But if I first create a group, manually or with the API, then it works fine. So I can do the following for example...

      ZabbixAPI::query('hostgroup','create',array('name'=>'testgroup'));
      $new_group_id = ZabbixAPI::fetch_string('hostgroup','get',array('pattern'=>'testgroup'));
      $result = ZabbixAPI::query('host','create',array('host'=>'test','groups'=>array($new_group_id)));

      And this will complete properly, a host will be created, tied to the new testgroup I created. This is rather... odd.

      Here are two of my comments on this topic.

      First, why does a host REQUIRE a group (hostgroup) when in the Zabbix web interface it does not? I would prefer to be able to create hosts without having to associate them with groups. This seems like a unnecessary requirement.

      Second, of course, this is also a bug and needs to be able to add servers to the existing 5 hostgroups.

      Cheers!

            Unassigned Unassigned
            farley Andrew Farley
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: