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

Looping through host.create dies with error code 32602

    XMLWordPrintable

    Details

    • Type: Incident report
    • Status: Closed
    • Priority: Minor
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.8.3
    • Fix Version/s: None
    • Component/s: API (A)
    • Labels:
      None
    • Environment:
      sles 11

      Description

      I've written a small script using the php api wrapper to generate fake loopback hosts.
      The script will run through a loop, and add a number of hosts successfully, but at some point in the loop it dies with the following:

      There was an error adding: fake12203594 : Array
      (
          [code] => -32602
          [message] => Invalid params.
          [data] => Not authorized
      )
      

      The script is as follows:

      <?php
      require_once("ZabbixAPI.class.php");
      
      // This enables debugging, this is rather verbose but can help debug problems
      //ZabbixAPI::debugEnabled(TRUE);
      
      // This logs into Zabbix, and returns false if it fails
      ZabbixAPI::login('http://localhost/zabbix','admin','zabbix')
          or die('Unable to login: '.print_r(ZabbixAPI::getLastError(),true));
      
      
      $numhosts=16000;
      $ip='127.0.0.1';
      $port='10050';
      $useip='1';
      $groups=array("groupid"=>7);
      $templates=array("templateid"=>10001);
      
      for($x=0;$x<$numhosts;$x++){
              $hostname='fake'.rand(800,20000000);
              ZabbixAPI::query('host', 'create', array(
                      "host"=>$hostname,
                      "ip"=>$ip,
                      "port"=>$port,
                      "useip"=>$useip,
                      "groups"=>$groups,
                      "templates"=>$templates
                      )
              ) or die ('There was an error adding: '.$hostname.' : '.print_r(ZabbixAPI::getLastError(),true));
      }//end for
      ?>
      

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            lukemacneil Luke MacNeil
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: