-
Incident report
-
Resolution: Cannot Reproduce
-
Minor
-
None
-
1.8.3
-
None
-
sles 11
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
?>